mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 13:41:30 +00:00
gpio: pl061: Pass irqchip when adding gpiochip
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: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Tested-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
d1d522d4f8
commit
04ce935c6b
1 changed files with 16 additions and 14 deletions
|
@ -286,6 +286,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
|
||||||
{
|
{
|
||||||
struct device *dev = &adev->dev;
|
struct device *dev = &adev->dev;
|
||||||
struct pl061 *pl061;
|
struct pl061 *pl061;
|
||||||
|
struct gpio_irq_chip *girq;
|
||||||
int ret, irq;
|
int ret, irq;
|
||||||
|
|
||||||
pl061 = devm_kzalloc(dev, sizeof(*pl061), GFP_KERNEL);
|
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.parent = dev;
|
||||||
pl061->gc.owner = THIS_MODULE;
|
pl061->gc.owner = THIS_MODULE;
|
||||||
|
|
||||||
ret = gpiochip_add_data(&pl061->gc, pl061);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* irq_chip support
|
* irq_chip support
|
||||||
*/
|
*/
|
||||||
|
@ -335,19 +332,24 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
|
||||||
}
|
}
|
||||||
pl061->parent_irq = irq;
|
pl061->parent_irq = irq;
|
||||||
|
|
||||||
ret = gpiochip_irqchip_add(&pl061->gc, &pl061->irq_chip,
|
girq = &pl061->gc.irq;
|
||||||
0, handle_bad_irq,
|
girq->chip = &pl061->irq_chip;
|
||||||
IRQ_TYPE_NONE);
|
girq->parent_handler = pl061_irq_handler;
|
||||||
if (ret) {
|
girq->num_parents = 1;
|
||||||
dev_info(&adev->dev, "could not add irqchip\n");
|
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;
|
return ret;
|
||||||
}
|
|
||||||
gpiochip_set_chained_irqchip(&pl061->gc, &pl061->irq_chip,
|
|
||||||
irq, pl061_irq_handler);
|
|
||||||
|
|
||||||
amba_set_drvdata(adev, pl061);
|
amba_set_drvdata(adev, pl061);
|
||||||
dev_info(&adev->dev, "PL061 GPIO chip @%pa registered\n",
|
dev_info(dev, "PL061 GPIO chip %s registered\n", dev_name(dev));
|
||||||
&adev->res.start);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue