* [PATCH] gpio: pl061: Pass irqchip when adding gpiochip
@ 2019-06-25 11:18 Linus Walleij
2019-06-26 11:11 ` Sudeep Holla
2019-06-27 10:32 ` Manivannan Sadhasivam
0 siblings, 2 replies; 3+ messages in thread
From: Linus Walleij @ 2019-06-25 11:18 UTC (permalink / raw)
To: linux-gpio
Cc: Bartosz Golaszewski, Linus Walleij, Sudeep Holla,
Manivannan Sadhasivam
We need to convert all old gpio irqchips to pass the irqchip
setup along when adding the gpio_chip.
For chained irqchips this is a pretty straight-forward
conversion.
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/gpio-pl061.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index dc42571e6fdc..84af248f5172 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -286,6 +286,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
{
struct device *dev = &adev->dev;
struct pl061 *pl061;
+ struct gpio_irq_chip *girq;
int ret, irq;
pl061 = devm_kzalloc(dev, sizeof(*pl061), GFP_KERNEL);
@@ -313,10 +314,6 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
pl061->gc.parent = dev;
pl061->gc.owner = THIS_MODULE;
- ret = gpiochip_add_data(&pl061->gc, pl061);
- if (ret)
- return ret;
-
/*
* irq_chip support
*/
@@ -335,19 +332,24 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
}
pl061->parent_irq = irq;
- ret = gpiochip_irqchip_add(&pl061->gc, &pl061->irq_chip,
- 0, handle_bad_irq,
- IRQ_TYPE_NONE);
- if (ret) {
- dev_info(&adev->dev, "could not add irqchip\n");
+ girq = &pl061->gc.irq;
+ girq->chip = &pl061->irq_chip;
+ girq->parent_handler = pl061_irq_handler;
+ girq->num_parents = 1;
+ girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),
+ GFP_KERNEL);
+ if (!girq->parents)
+ return -ENOMEM;
+ girq->parents[0] = irq;
+ girq->default_type = IRQ_TYPE_NONE;
+ girq->handler = handle_bad_irq;
+
+ ret = devm_gpiochip_add_data(dev, &pl061->gc, pl061);
+ if (ret)
return ret;
- }
- gpiochip_set_chained_irqchip(&pl061->gc, &pl061->irq_chip,
- irq, pl061_irq_handler);
amba_set_drvdata(adev, pl061);
- dev_info(&adev->dev, "PL061 GPIO chip @%pa registered\n",
- &adev->res.start);
+ dev_info(dev, "PL061 GPIO chip %s registered\n", dev_name(dev));
return 0;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: pl061: Pass irqchip when adding gpiochip
2019-06-25 11:18 [PATCH] gpio: pl061: Pass irqchip when adding gpiochip Linus Walleij
@ 2019-06-26 11:11 ` Sudeep Holla
2019-06-27 10:32 ` Manivannan Sadhasivam
1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2019-06-26 11:11 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-gpio, Bartosz Golaszewski, Manivannan Sadhasivam,
Sudeep Holla
On Tue, Jun 25, 2019 at 01:18:24PM +0200, Linus Walleij wrote:
> We need to convert all old gpio irqchips to pass the irqchip
> setup along when adding the gpio_chip.
>
> For chained irqchips this is a pretty straight-forward
> conversion.
>
FWIW, looks good to me and breaks nothing :), so
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: pl061: Pass irqchip when adding gpiochip
2019-06-25 11:18 [PATCH] gpio: pl061: Pass irqchip when adding gpiochip Linus Walleij
2019-06-26 11:11 ` Sudeep Holla
@ 2019-06-27 10:32 ` Manivannan Sadhasivam
1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2019-06-27 10:32 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, Bartosz Golaszewski, Sudeep Holla
On Tue, Jun 25, 2019 at 01:18:24PM +0200, Linus Walleij wrote:
> We need to convert all old gpio irqchips to pass the irqchip
> setup along when adding the gpio_chip.
>
> For chained irqchips this is a pretty straight-forward
> conversion.
>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Looks good to me!
Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Thanks,
Mani
> ---
> drivers/gpio/gpio-pl061.c | 30 ++++++++++++++++--------------
> 1 file changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
> index dc42571e6fdc..84af248f5172 100644
> --- a/drivers/gpio/gpio-pl061.c
> +++ b/drivers/gpio/gpio-pl061.c
> @@ -286,6 +286,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
> {
> struct device *dev = &adev->dev;
> struct pl061 *pl061;
> + struct gpio_irq_chip *girq;
> int ret, irq;
>
> pl061 = devm_kzalloc(dev, sizeof(*pl061), GFP_KERNEL);
> @@ -313,10 +314,6 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
> pl061->gc.parent = dev;
> pl061->gc.owner = THIS_MODULE;
>
> - ret = gpiochip_add_data(&pl061->gc, pl061);
> - if (ret)
> - return ret;
> -
> /*
> * irq_chip support
> */
> @@ -335,19 +332,24 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
> }
> pl061->parent_irq = irq;
>
> - ret = gpiochip_irqchip_add(&pl061->gc, &pl061->irq_chip,
> - 0, handle_bad_irq,
> - IRQ_TYPE_NONE);
> - if (ret) {
> - dev_info(&adev->dev, "could not add irqchip\n");
> + girq = &pl061->gc.irq;
> + girq->chip = &pl061->irq_chip;
> + girq->parent_handler = pl061_irq_handler;
> + girq->num_parents = 1;
> + girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),
> + GFP_KERNEL);
> + if (!girq->parents)
> + return -ENOMEM;
> + girq->parents[0] = irq;
> + girq->default_type = IRQ_TYPE_NONE;
> + girq->handler = handle_bad_irq;
> +
> + ret = devm_gpiochip_add_data(dev, &pl061->gc, pl061);
> + if (ret)
> return ret;
> - }
> - gpiochip_set_chained_irqchip(&pl061->gc, &pl061->irq_chip,
> - irq, pl061_irq_handler);
>
> amba_set_drvdata(adev, pl061);
> - dev_info(&adev->dev, "PL061 GPIO chip @%pa registered\n",
> - &adev->res.start);
> + dev_info(dev, "PL061 GPIO chip %s registered\n", dev_name(dev));
>
> return 0;
> }
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-27 10:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-25 11:18 [PATCH] gpio: pl061: Pass irqchip when adding gpiochip Linus Walleij
2019-06-26 11:11 ` Sudeep Holla
2019-06-27 10:32 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).