Skip to content

Commit 80606cb

Browse files
committed
gpio: max77620: Use helper variable and clarify
Most other drivers fill out the gpio_irq_chip using a struct gpio_irq_chip *girq helper variable for ease of reading. We also make a habit of explicitly assigning NULL and zero to the parent IRQs when using ordinary IRQ handlers in the driver, mostly for code readability and maintenance. Signed-off-by: Linus Walleij <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Cc: Dmitry Osipenko <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 761b5c3 commit 80606cb

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

drivers/gpio/gpio-max77620.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ static int max77620_gpio_probe(struct platform_device *pdev)
288288
{
289289
struct max77620_chip *chip = dev_get_drvdata(pdev->dev.parent);
290290
struct max77620_gpio *mgpio;
291+
struct gpio_irq_chip *girq;
291292
unsigned int gpio_irq;
292293
int ret;
293294

@@ -316,11 +317,16 @@ static int max77620_gpio_probe(struct platform_device *pdev)
316317
mgpio->gpio_chip.can_sleep = 1;
317318
mgpio->gpio_chip.base = -1;
318319

319-
mgpio->gpio_chip.irq.chip = &max77620_gpio_irqchip;
320-
mgpio->gpio_chip.irq.default_type = IRQ_TYPE_NONE;
321-
mgpio->gpio_chip.irq.handler = handle_edge_irq;
322-
mgpio->gpio_chip.irq.init_hw = max77620_gpio_irq_init_hw,
323-
mgpio->gpio_chip.irq.threaded = true;
320+
girq = &mgpio->gpio_chip.irq;
321+
girq->chip = &max77620_gpio_irqchip;
322+
/* This will let us handle the parent IRQ in the driver */
323+
girq->parent_handler = NULL;
324+
girq->num_parents = 0;
325+
girq->parents = NULL;
326+
girq->default_type = IRQ_TYPE_NONE;
327+
girq->handler = handle_edge_irq;
328+
girq->init_hw = max77620_gpio_irq_init_hw,
329+
girq->threaded = true;
324330

325331
platform_set_drvdata(pdev, mgpio);
326332

0 commit comments

Comments
 (0)