Skip to content

Commit add679d

Browse files
author
Marc Zyngier
committed
Merge branch irq/parent_device into irq/irqchip-next
* irq/parent_device: : . : Move irq_chip::parent_device to irq_domain::dev to track the : PM state of the device implementing the irqchip. : . genirq: Kill irq_chip::parent_device pinctrl: starfive: Move PM device over to irq domain pinctrl: npcm: Fix broken references to chip->parent_device gpio: tpmx86: Move PM device over to irq domain gpio: rcar: Move PM device over to irq domain gpio: omap: Move PM device over to irq domain gpio: mt7621: Kill parent_device usage irqchip/imx-intmux: Move PM device over to irq domain irqchip/renesas-irqc: Move PM device over to irq domain irqchip/renesas-intc-irqpin: Move PM device over to irq domain irqchip/gic: Move PM device over to irq domain genirq: Allow the PM device to originate from irq domain Signed-off-by: Marc Zyngier <maz@kernel.org>
2 parents 689daef + beb0622 commit add679d

13 files changed

Lines changed: 59 additions & 40 deletions

File tree

drivers/gpio/gpio-mt7621.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ mediatek_gpio_bank_probe(struct device *dev, int bank)
239239

240240
rg->chip.offset = bank * MTK_BANK_WIDTH;
241241
rg->irq_chip.name = dev_name(dev);
242-
rg->irq_chip.parent_device = dev;
243242
rg->irq_chip.irq_unmask = mediatek_gpio_irq_unmask;
244243
rg->irq_chip.irq_mask = mediatek_gpio_irq_mask;
245244
rg->irq_chip.irq_mask_ack = mediatek_gpio_irq_mask;

drivers/gpio/gpio-omap.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,8 @@ static void omap_gpio_mod_init(struct gpio_bank *bank)
986986
writel_relaxed(0, base + bank->regs->ctrl);
987987
}
988988

989-
static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
989+
static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc,
990+
struct device *pm_dev)
990991
{
991992
struct gpio_irq_chip *irq;
992993
static int gpio;
@@ -1052,6 +1053,7 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
10521053
if (ret)
10531054
return dev_err_probe(bank->chip.parent, ret, "Could not register gpio chip\n");
10541055

1056+
irq_domain_set_pm_device(bank->chip.irq.domain, pm_dev);
10551057
ret = devm_request_irq(bank->chip.parent, bank->irq,
10561058
omap_gpio_irq_handler,
10571059
0, dev_name(bank->chip.parent), bank);
@@ -1402,7 +1404,6 @@ static int omap_gpio_probe(struct platform_device *pdev)
14021404
irqc->irq_bus_sync_unlock = gpio_irq_bus_sync_unlock,
14031405
irqc->name = dev_name(&pdev->dev);
14041406
irqc->flags = IRQCHIP_MASK_ON_SUSPEND;
1405-
irqc->parent_device = dev;
14061407

14071408
bank->irq = platform_get_irq(pdev, 0);
14081409
if (bank->irq <= 0) {
@@ -1466,7 +1467,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
14661467

14671468
omap_gpio_mod_init(bank);
14681469

1469-
ret = omap_gpio_chip_init(bank, irqc);
1470+
ret = omap_gpio_chip_init(bank, irqc, dev);
14701471
if (ret) {
14711472
pm_runtime_put_sync(dev);
14721473
pm_runtime_disable(dev);

drivers/gpio/gpio-rcar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,6 @@ static int gpio_rcar_probe(struct platform_device *pdev)
530530

531531
irq_chip = &p->irq_chip;
532532
irq_chip->name = "gpio-rcar";
533-
irq_chip->parent_device = dev;
534533
irq_chip->irq_mask = gpio_rcar_irq_disable;
535534
irq_chip->irq_unmask = gpio_rcar_irq_enable;
536535
irq_chip->irq_set_type = gpio_rcar_irq_set_type;
@@ -552,6 +551,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
552551
goto err0;
553552
}
554553

554+
irq_domain_set_pm_device(gpio_chip->irq.domain, dev);
555555
ret = devm_request_irq(dev, p->irq_parent, gpio_rcar_irq_handler,
556556
IRQF_SHARED, name, p);
557557
if (ret) {

drivers/gpio/gpio-tqmx86.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
281281
u8 irq_status;
282282

283283
irq_chip->name = chip->label;
284-
irq_chip->parent_device = &pdev->dev;
285284
irq_chip->irq_mask = tqmx86_gpio_irq_mask;
286285
irq_chip->irq_unmask = tqmx86_gpio_irq_unmask;
287286
irq_chip->irq_set_type = tqmx86_gpio_irq_set_type;
@@ -316,6 +315,8 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
316315
goto out_pm_dis;
317316
}
318317

318+
irq_domain_set_pm_device(girq->domain, dev);
319+
319320
dev_info(dev, "GPIO functionality initialized with %d pins\n",
320321
chip->ngpio);
321322

drivers/irqchip/irq-gic.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,13 +1127,12 @@ static const struct irq_domain_ops gic_irq_domain_ops = {
11271127
.unmap = gic_irq_domain_unmap,
11281128
};
11291129

1130-
static void gic_init_chip(struct gic_chip_data *gic, struct device *dev,
1131-
const char *name, bool use_eoimode1)
1130+
static void gic_init_chip(struct gic_chip_data *gic, const char *name,
1131+
bool use_eoimode1)
11321132
{
11331133
/* Initialize irq_chip */
11341134
gic->chip = gic_chip;
11351135
gic->chip.name = name;
1136-
gic->chip.parent_device = dev;
11371136

11381137
if (use_eoimode1) {
11391138
gic->chip.irq_mask = gic_eoimode1_mask_irq;
@@ -1268,10 +1267,10 @@ static int __init __gic_init_bases(struct gic_chip_data *gic,
12681267

12691268
if (static_branch_likely(&supports_deactivate_key) && gic == &gic_data[0]) {
12701269
name = kasprintf(GFP_KERNEL, "GICv2");
1271-
gic_init_chip(gic, NULL, name, true);
1270+
gic_init_chip(gic, name, true);
12721271
} else {
12731272
name = kasprintf(GFP_KERNEL, "GIC-%d", (int)(gic-&gic_data[0]));
1274-
gic_init_chip(gic, NULL, name, false);
1273+
gic_init_chip(gic, name, false);
12751274
}
12761275

12771276
ret = gic_init_bases(gic, handle);
@@ -1460,7 +1459,7 @@ int gic_of_init_child(struct device *dev, struct gic_chip_data **gic, int irq)
14601459
if (!*gic)
14611460
return -ENOMEM;
14621461

1463-
gic_init_chip(*gic, dev, dev->of_node->name, false);
1462+
gic_init_chip(*gic, dev->of_node->name, false);
14641463

14651464
ret = gic_of_setup(*gic, dev->of_node);
14661465
if (ret)
@@ -1472,6 +1471,7 @@ int gic_of_init_child(struct device *dev, struct gic_chip_data **gic, int irq)
14721471
return ret;
14731472
}
14741473

1474+
irq_domain_set_pm_device((*gic)->domain, dev);
14751475
irq_set_chained_handler_and_data(irq, gic_handle_cascade_irq, *gic);
14761476

14771477
return 0;

drivers/irqchip/irq-imx-intmux.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
#define CHAN_MAX_NUM 0x8
6262

6363
struct intmux_irqchip_data {
64-
struct irq_chip chip;
6564
u32 saved_reg;
6665
int chanidx;
6766
int irq;
@@ -114,7 +113,7 @@ static void imx_intmux_irq_unmask(struct irq_data *d)
114113
raw_spin_unlock_irqrestore(&data->lock, flags);
115114
}
116115

117-
static struct irq_chip imx_intmux_irq_chip = {
116+
static struct irq_chip imx_intmux_irq_chip __ro_after_init = {
118117
.name = "intmux",
119118
.irq_mask = imx_intmux_irq_mask,
120119
.irq_unmask = imx_intmux_irq_unmask,
@@ -126,7 +125,7 @@ static int imx_intmux_irq_map(struct irq_domain *h, unsigned int irq,
126125
struct intmux_irqchip_data *data = h->host_data;
127126

128127
irq_set_chip_data(irq, data);
129-
irq_set_chip_and_handler(irq, &data->chip, handle_level_irq);
128+
irq_set_chip_and_handler(irq, &imx_intmux_irq_chip, handle_level_irq);
130129

131130
return 0;
132131
}
@@ -241,8 +240,6 @@ static int imx_intmux_probe(struct platform_device *pdev)
241240
}
242241

243242
for (i = 0; i < channum; i++) {
244-
data->irqchip_data[i].chip = imx_intmux_irq_chip;
245-
data->irqchip_data[i].chip.parent_device = &pdev->dev;
246243
data->irqchip_data[i].chanidx = i;
247244

248245
data->irqchip_data[i].irq = irq_of_parse_and_map(np, i);
@@ -260,6 +257,7 @@ static int imx_intmux_probe(struct platform_device *pdev)
260257
goto out;
261258
}
262259
data->irqchip_data[i].domain = domain;
260+
irq_domain_set_pm_device(domain, &pdev->dev);
263261

264262
/* disable all interrupt sources of this channel firstly */
265263
writel_relaxed(0, data->regs + CHANIER(i));

drivers/irqchip/irq-renesas-intc-irqpin.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,6 @@ static int intc_irqpin_probe(struct platform_device *pdev)
508508

509509
irq_chip = &p->irq_chip;
510510
irq_chip->name = "intc-irqpin";
511-
irq_chip->parent_device = dev;
512511
irq_chip->irq_mask = disable_fn;
513512
irq_chip->irq_unmask = enable_fn;
514513
irq_chip->irq_set_type = intc_irqpin_irq_set_type;
@@ -523,6 +522,8 @@ static int intc_irqpin_probe(struct platform_device *pdev)
523522
goto err0;
524523
}
525524

525+
irq_domain_set_pm_device(p->irq_domain, dev);
526+
526527
if (p->shared_irqs) {
527528
/* request one shared interrupt */
528529
if (devm_request_irq(dev, p->irq[0].requested_irq,

drivers/irqchip/irq-renesas-irqc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,14 @@ static int irqc_probe(struct platform_device *pdev)
188188
p->gc->reg_base = p->cpu_int_base;
189189
p->gc->chip_types[0].regs.enable = IRQC_EN_SET;
190190
p->gc->chip_types[0].regs.disable = IRQC_EN_STS;
191-
p->gc->chip_types[0].chip.parent_device = dev;
192191
p->gc->chip_types[0].chip.irq_mask = irq_gc_mask_disable_reg;
193192
p->gc->chip_types[0].chip.irq_unmask = irq_gc_unmask_enable_reg;
194193
p->gc->chip_types[0].chip.irq_set_type = irqc_irq_set_type;
195194
p->gc->chip_types[0].chip.irq_set_wake = irqc_irq_set_wake;
196195
p->gc->chip_types[0].chip.flags = IRQCHIP_MASK_ON_SUSPEND;
197196

197+
irq_domain_set_pm_device(p->irq_domain, dev);
198+
198199
/* request interrupts one by one */
199200
for (k = 0; k < p->number_of_irqs; k++) {
200201
if (devm_request_irq(dev, p->irq[k].requested_irq,

drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ struct npcm7xx_gpio {
7878
struct gpio_chip gc;
7979
int irqbase;
8080
int irq;
81-
void *priv;
8281
struct irq_chip irq_chip;
8382
u32 pinctrl_id;
8483
int (*direction_input)(struct gpio_chip *chip, unsigned offset);
@@ -226,7 +225,7 @@ static void npcmgpio_irq_handler(struct irq_desc *desc)
226225
chained_irq_enter(chip, desc);
227226
sts = ioread32(bank->base + NPCM7XX_GP_N_EVST);
228227
en = ioread32(bank->base + NPCM7XX_GP_N_EVEN);
229-
dev_dbg(chip->parent_device, "==> got irq sts %.8x %.8x\n", sts,
228+
dev_dbg(bank->gc.parent, "==> got irq sts %.8x %.8x\n", sts,
230229
en);
231230

232231
sts &= en;
@@ -241,33 +240,33 @@ static int npcmgpio_set_irq_type(struct irq_data *d, unsigned int type)
241240
gpiochip_get_data(irq_data_get_irq_chip_data(d));
242241
unsigned int gpio = BIT(d->hwirq);
243242

244-
dev_dbg(d->chip->parent_device, "setirqtype: %u.%u = %u\n", gpio,
243+
dev_dbg(bank->gc.parent, "setirqtype: %u.%u = %u\n", gpio,
245244
d->irq, type);
246245
switch (type) {
247246
case IRQ_TYPE_EDGE_RISING:
248-
dev_dbg(d->chip->parent_device, "edge.rising\n");
247+
dev_dbg(bank->gc.parent, "edge.rising\n");
249248
npcm_gpio_clr(&bank->gc, bank->base + NPCM7XX_GP_N_EVBE, gpio);
250249
npcm_gpio_clr(&bank->gc, bank->base + NPCM7XX_GP_N_POL, gpio);
251250
break;
252251
case IRQ_TYPE_EDGE_FALLING:
253-
dev_dbg(d->chip->parent_device, "edge.falling\n");
252+
dev_dbg(bank->gc.parent, "edge.falling\n");
254253
npcm_gpio_clr(&bank->gc, bank->base + NPCM7XX_GP_N_EVBE, gpio);
255254
npcm_gpio_set(&bank->gc, bank->base + NPCM7XX_GP_N_POL, gpio);
256255
break;
257256
case IRQ_TYPE_EDGE_BOTH:
258-
dev_dbg(d->chip->parent_device, "edge.both\n");
257+
dev_dbg(bank->gc.parent, "edge.both\n");
259258
npcm_gpio_set(&bank->gc, bank->base + NPCM7XX_GP_N_EVBE, gpio);
260259
break;
261260
case IRQ_TYPE_LEVEL_LOW:
262-
dev_dbg(d->chip->parent_device, "level.low\n");
261+
dev_dbg(bank->gc.parent, "level.low\n");
263262
npcm_gpio_set(&bank->gc, bank->base + NPCM7XX_GP_N_POL, gpio);
264263
break;
265264
case IRQ_TYPE_LEVEL_HIGH:
266-
dev_dbg(d->chip->parent_device, "level.high\n");
265+
dev_dbg(bank->gc.parent, "level.high\n");
267266
npcm_gpio_clr(&bank->gc, bank->base + NPCM7XX_GP_N_POL, gpio);
268267
break;
269268
default:
270-
dev_dbg(d->chip->parent_device, "invalid irq type\n");
269+
dev_dbg(bank->gc.parent, "invalid irq type\n");
271270
return -EINVAL;
272271
}
273272

@@ -289,7 +288,7 @@ static void npcmgpio_irq_ack(struct irq_data *d)
289288
gpiochip_get_data(irq_data_get_irq_chip_data(d));
290289
unsigned int gpio = d->hwirq;
291290

292-
dev_dbg(d->chip->parent_device, "irq_ack: %u.%u\n", gpio, d->irq);
291+
dev_dbg(bank->gc.parent, "irq_ack: %u.%u\n", gpio, d->irq);
293292
iowrite32(BIT(gpio), bank->base + NPCM7XX_GP_N_EVST);
294293
}
295294

@@ -301,7 +300,7 @@ static void npcmgpio_irq_mask(struct irq_data *d)
301300
unsigned int gpio = d->hwirq;
302301

303302
/* Clear events */
304-
dev_dbg(d->chip->parent_device, "irq_mask: %u.%u\n", gpio, d->irq);
303+
dev_dbg(bank->gc.parent, "irq_mask: %u.%u\n", gpio, d->irq);
305304
iowrite32(BIT(gpio), bank->base + NPCM7XX_GP_N_EVENC);
306305
}
307306

@@ -313,7 +312,7 @@ static void npcmgpio_irq_unmask(struct irq_data *d)
313312
unsigned int gpio = d->hwirq;
314313

315314
/* Enable events */
316-
dev_dbg(d->chip->parent_device, "irq_unmask: %u.%u\n", gpio, d->irq);
315+
dev_dbg(bank->gc.parent, "irq_unmask: %u.%u\n", gpio, d->irq);
317316
iowrite32(BIT(gpio), bank->base + NPCM7XX_GP_N_EVENS);
318317
}
319318

@@ -323,7 +322,7 @@ static unsigned int npcmgpio_irq_startup(struct irq_data *d)
323322
unsigned int gpio = d->hwirq;
324323

325324
/* active-high, input, clear interrupt, enable interrupt */
326-
dev_dbg(d->chip->parent_device, "startup: %u.%u\n", gpio, d->irq);
325+
dev_dbg(gc->parent, "startup: %u.%u\n", gpio, d->irq);
327326
npcmgpio_direction_input(gc, gpio);
328327
npcmgpio_irq_ack(d);
329328
npcmgpio_irq_unmask(d);

drivers/pinctrl/pinctrl-starfive.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,6 @@ static int starfive_probe(struct platform_device *pdev)
13071307
sfp->gc.base = -1;
13081308
sfp->gc.ngpio = NR_GPIOS;
13091309

1310-
starfive_irq_chip.parent_device = dev;
13111310
starfive_irq_chip.name = sfp->gc.label;
13121311

13131312
sfp->gc.irq.chip = &starfive_irq_chip;
@@ -1330,6 +1329,8 @@ static int starfive_probe(struct platform_device *pdev)
13301329
if (ret)
13311330
return dev_err_probe(dev, ret, "could not register gpiochip\n");
13321331

1332+
irq_domain_set_pm_device(sfp->gc.irq.domain, dev);
1333+
13331334
out_pinctrl_enable:
13341335
return pinctrl_enable(sfp->pctl);
13351336
}

0 commit comments

Comments
 (0)