Skip to content

Commit 15d9e7e

Browse files
digetxlinusw
authored andcommitted
gpio: max77620: Use irqchip template
This change addresses one of the GPIO-core TODOs for the MAX77620 driver which requires modern drivers to use the irqchip template. Instead of using the GPIO's irqchip-helpers for creating the IRQ domain, the gpio_irq_chip structure is now filled by the driver itself and then gpiochip_add_data() takes care of instantiating the IRQ domain for us. Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Laxman Dewangan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent c607e5e commit 15d9e7e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/gpio/gpio-max77620.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ static int max77620_gpio_probe(struct platform_device *pdev)
277277
if (!mgpio)
278278
return -ENOMEM;
279279

280+
mutex_init(&mgpio->buslock);
280281
mgpio->rmap = chip->rmap;
281282
mgpio->dev = &pdev->dev;
282283

@@ -291,6 +292,11 @@ static int max77620_gpio_probe(struct platform_device *pdev)
291292
mgpio->gpio_chip.can_sleep = 1;
292293
mgpio->gpio_chip.base = -1;
293294

295+
mgpio->gpio_chip.irq.chip = &max77620_gpio_irqchip;
296+
mgpio->gpio_chip.irq.default_type = IRQ_TYPE_NONE;
297+
mgpio->gpio_chip.irq.handler = handle_edge_irq;
298+
mgpio->gpio_chip.irq.threaded = true;
299+
294300
platform_set_drvdata(pdev, mgpio);
295301

296302
ret = devm_gpiochip_add_data(&pdev->dev, &mgpio->gpio_chip, mgpio);
@@ -299,11 +305,6 @@ static int max77620_gpio_probe(struct platform_device *pdev)
299305
return ret;
300306
}
301307

302-
mutex_init(&mgpio->buslock);
303-
304-
gpiochip_irqchip_add_nested(&mgpio->gpio_chip, &max77620_gpio_irqchip,
305-
0, handle_edge_irq, IRQ_TYPE_NONE);
306-
307308
ret = devm_request_threaded_irq(&pdev->dev, gpio_irq, NULL,
308309
max77620_gpio_irqhandler, IRQF_ONESHOT,
309310
"max77620-gpio", mgpio);
@@ -312,9 +313,6 @@ static int max77620_gpio_probe(struct platform_device *pdev)
312313
return ret;
313314
}
314315

315-
gpiochip_set_nested_irqchip(&mgpio->gpio_chip, &max77620_gpio_irqchip,
316-
gpio_irq);
317-
318316
return 0;
319317
}
320318

0 commit comments

Comments
 (0)