hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/irqchip/irq-renesas-intc-irqpin.c
....@@ -1,20 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Renesas INTC External IRQ Pin Driver
34 *
45 * Copyright (C) 2013 Magnus Damm
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program; if not, write to the Free Software
17
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
186 */
197
208 #include <linux/init.h>
....@@ -83,8 +71,7 @@
8371 };
8472
8573 struct intc_irqpin_config {
86
- unsigned int irlm_bit;
87
- unsigned needs_irlm:1;
74
+ int irlm_bit; /* -1 if non-existent */
8875 };
8976
9077 static unsigned long intc_irqpin_read32(void __iomem *iomem)
....@@ -361,11 +348,10 @@
361348
362349 static const struct intc_irqpin_config intc_irqpin_irlm_r8a777x = {
363350 .irlm_bit = 23, /* ICR0.IRLM0 */
364
- .needs_irlm = 1,
365351 };
366352
367353 static const struct intc_irqpin_config intc_irqpin_rmobile = {
368
- .needs_irlm = 0,
354
+ .irlm_bit = -1,
369355 };
370356
371357 static const struct of_device_id intc_irqpin_dt_ids[] = {
....@@ -401,10 +387,8 @@
401387 int k;
402388
403389 p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL);
404
- if (!p) {
405
- dev_err(dev, "failed to allocate driver data\n");
390
+ if (!p)
406391 return -ENOMEM;
407
- }
408392
409393 /* deal with driver instance configuration */
410394 of_property_read_u32(dev->of_node, "sense-bitfield-width",
....@@ -474,8 +458,8 @@
474458 goto err0;
475459 }
476460
477
- i->iomem = devm_ioremap_nocache(dev, io[k]->start,
478
- resource_size(io[k]));
461
+ i->iomem = devm_ioremap(dev, io[k]->start,
462
+ resource_size(io[k]));
479463 if (!i->iomem) {
480464 dev_err(dev, "failed to remap IOMEM\n");
481465 ret = -ENXIO;
....@@ -484,7 +468,7 @@
484468 }
485469
486470 /* configure "individual IRQ mode" where needed */
487
- if (config && config->needs_irlm) {
471
+ if (config && config->irlm_bit >= 0) {
488472 if (io[INTC_IRQPIN_REG_IRLM])
489473 intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_IRLM,
490474 config->irlm_bit, 1, 1);
....@@ -522,7 +506,8 @@
522506 }
523507
524508 irq_chip = &p->irq_chip;
525
- irq_chip->name = name;
509
+ irq_chip->name = "intc-irqpin";
510
+ irq_chip->parent_device = dev;
526511 irq_chip->irq_mask = disable_fn;
527512 irq_chip->irq_unmask = enable_fn;
528513 irq_chip->irq_set_type = intc_irqpin_irq_set_type;