gpio: wcove: Use irqchip template
Subsystems (3)
PATCH 1/1 gpio: wcove: Use irqchip template
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add_nested() and gpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip.
---
Same notices as on the Crystalcove: this one I actually managed to compiletest properly.
--- drivers/gpio/gpio-wcove.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-)
drivers/gpio/gpio-wcove.c +16 -14
@@ -400,6 +400,7 @@ static int wcove_gpio_probe(struct platform_device *pdev)struct wcove_gpio *wg;int virq, ret, irq;struct device *dev; +struct gpio_irq_chip *girq;/* * This gpio platform device is created by a mfd device (see
@@ -442,19 +443,6 @@ static int wcove_gpio_probe(struct platform_device *pdev) wg->dev = dev; wg->regmap = pmic->regmap; - ret =devm_gpiochip_add_data (dev, &wg->chip, wg); -if (ret) { -dev_err (dev,"Failed to add gpiochip: %d\n" , ret); -return ret; - } - - ret =gpiochip_irqchip_add_nested (&wg->chip, &wcove_irqchip,0 , - handle_simple_irq,IRQ_TYPE_NONE ); -if (ret) { -dev_err (dev,"Failed to add irqchip: %d\n" , ret); -return ret; - } - virq =regmap_irq_get_virq (wg->regmap_irq_chip, irq);if (virq <0 ) {dev_err (dev,"Failed to get virq by irq %d\n" , irq);
@@ -468,7 +456,21 @@ static int wcove_gpio_probe(struct platform_device *pdev)return ret; } -gpiochip_set_nested_irqchip (&wg->chip, &wcove_irqchip, virq); + girq = &wg->chip.irq; + girq->chip = &wcove_irqchip; +/* This will let us handle the parent IRQ in the driver */ + girq->parent_handler =NULL ; + girq->num_parents =0 ; + girq->parents =NULL ; + girq->default_type =IRQ_TYPE_NONE ; + girq->handler = handle_simple_irq; + girq->threaded = true; + + ret =devm_gpiochip_add_data (dev, &wg->chip, wg); +if (ret) { +dev_err (dev,"Failed to add gpiochip: %d\n" , ret); +return ret; + }/* Enable GPIO0 interrupts */ ret = regmap_update_bits(wg->regmap, IRQ_MASK_BASE, GPIO_IRQ0_MASK,
Signature · 1 line
2.26.2
Hi,
Quoted 6 lines · Linus Walleij
This makes the driver use the irqchip template to assign properties to the
gpio_irq_chipinstead of using the explicit calls togpiochip_irqchip_add_nested()andgpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip.
Quoted 7 lines
Cc Bin Gao <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Hans de Goede <[email protected]>Signed-off-by Linus Walleij <[email protected]>---
Same notices as on the Crystalcove: this one I actually managed to compiletest properly.
I've given this patch a test-run on a machine with the Whiskey Cove PMIC and with the caveat that I've not actually tested the GPIO IRQ functionality, since that does not seem to be used on any machines, I see no adverse side effects from this patch, so it is:
Regards,
Hans
Quoted 60 lines
--- drivers/gpio/gpio-wcove.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-)drivers/gpio/gpio-wcove.c +16
-14@@ -400,6 +400,7 @@ static int wcove_gpio_probe(struct platform_device *pdev)struct wcove_gpio *wg;int virq, ret, irq;struct device *dev; +struct gpio_irq_chip *girq;/* * This gpio platform device is created by a mfd device (see @@ -442,19 +443,6 @@ static int wcove_gpio_probe(struct platform_device *pdev) wg->dev = dev; wg->regmap = pmic->regmap; - ret =devm_gpiochip_add_data (dev, &wg->chip, wg); -if (ret) { -dev_err (dev,"Failed to add gpiochip: %d\n" , ret); -return ret; - } - - ret =gpiochip_irqchip_add_nested (&wg->chip, &wcove_irqchip,0 , - handle_simple_irq,IRQ_TYPE_NONE ); -if (ret) { -dev_err (dev,"Failed to add irqchip: %d\n" , ret); -return ret; - } - virq =regmap_irq_get_virq (wg->regmap_irq_chip, irq);if (virq <0 ) {dev_err (dev,"Failed to get virq by irq %d\n" , irq);@@ -468,7 +456,21 @@ static int wcove_gpio_probe(struct platform_device *pdev)return ret; } -gpiochip_set_nested_irqchip (&wg->chip, &wcove_irqchip, virq); + girq = &wg->chip.irq; + girq->chip = &wcove_irqchip; +/* This will let us handle the parent IRQ in the driver */ + girq->parent_handler =NULL ; + girq->num_parents =0 ; + girq->parents =NULL ; + girq->default_type =IRQ_TYPE_NONE ; + girq->handler = handle_simple_irq; + girq->threaded = true; + + ret =devm_gpiochip_add_data (dev, &wg->chip, wg); +if (ret) { +dev_err (dev,"Failed to add gpiochip: %d\n" , ret); +return ret; + }/* Enable GPIO0 interrupts */ ret = regmap_update_bits(wg->regmap, IRQ_MASK_BASE, GPIO_IRQ0_MASK,
Andy Shevchenko
AppliedQuoted 15 lines · Hans de Goede
Quoted 6 lines · Linus Walleij
This makes the driver use the irqchip template to assign properties to the
gpio_irq_chipinstead of using the explicit calls togpiochip_irqchip_add_nested()andgpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip.Quoted 7 lines
Cc Bin Gao <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Hans de Goede <[email protected]>Signed-off-by Linus Walleij <[email protected]>---
Same notices as on the Crystalcove: this one I actually managed to compiletest properly.
Quoted 7 lines
I've given this patch a test-run on a machine with the Whiskey Cove PMIC and with the caveat that I've not actually tested the GPIO IRQ functionality, since that does not seem to be used on any machines, I see no adverse side effects from this patch, so it is:
Tested-by Hans de Goede <[email protected]>
Applied to my branch, thanks!
Same for Crystal Cove.
Signature · 2 lines
With Best Regards, Andy Shevchenko