* [PATCH] gpio: pcie-idio-24: Use irqchip template
@ 2020-07-22 11:00 Linus Walleij
2020-07-22 17:30 ` William Breathitt Gray
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2020-07-22 11:00 UTC (permalink / raw)
To: linux-gpio; +Cc: Bartosz Golaszewski, Linus Walleij, William Breathitt Gray
This makes the driver use the irqchip template to assign
properties to the gpio_irq_chip instead of using the
explicit call to gpiochip_irqchip_add().
The irqchip is instead added while adding the gpiochip.
Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/gpio-pcie-idio-24.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/gpio/gpio-pcie-idio-24.c b/drivers/gpio/gpio-pcie-idio-24.c
index 1d475794a50f..a68941d19ac6 100644
--- a/drivers/gpio/gpio-pcie-idio-24.c
+++ b/drivers/gpio/gpio-pcie-idio-24.c
@@ -457,6 +457,7 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
int err;
const size_t pci_bar_index = 2;
const char *const name = pci_name(pdev);
+ struct gpio_irq_chip *girq;
idio24gpio = devm_kzalloc(dev, sizeof(*idio24gpio), GFP_KERNEL);
if (!idio24gpio)
@@ -490,6 +491,15 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
idio24gpio->chip.set = idio_24_gpio_set;
idio24gpio->chip.set_multiple = idio_24_gpio_set_multiple;
+ girq = &idio24gpio->chip.irq;
+ girq->chip = &idio_24_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_edge_irq;
+
raw_spin_lock_init(&idio24gpio->lock);
/* Software board reset */
@@ -501,13 +511,6 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return err;
}
- err = gpiochip_irqchip_add(&idio24gpio->chip, &idio_24_irqchip, 0,
- handle_edge_irq, IRQ_TYPE_NONE);
- if (err) {
- dev_err(dev, "Could not add irqchip (%d)\n", err);
- return err;
- }
-
err = devm_request_irq(dev, pdev->irq, idio_24_irq_handler, IRQF_SHARED,
name, idio24gpio);
if (err) {
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpio: pcie-idio-24: Use irqchip template
2020-07-22 11:00 [PATCH] gpio: pcie-idio-24: Use irqchip template Linus Walleij
@ 2020-07-22 17:30 ` William Breathitt Gray
0 siblings, 0 replies; 2+ messages in thread
From: William Breathitt Gray @ 2020-07-22 17:30 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, Bartosz Golaszewski
[-- Attachment #1: Type: text/plain, Size: 2226 bytes --]
On Wed, Jul 22, 2020 at 01:00:27PM +0200, Linus Walleij wrote:
> This makes the driver use the irqchip template to assign
> properties to the gpio_irq_chip instead of using the
> explicit call to gpiochip_irqchip_add().
>
> The irqchip is instead added while adding the gpiochip.
>
> Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
> ---
> drivers/gpio/gpio-pcie-idio-24.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpio/gpio-pcie-idio-24.c b/drivers/gpio/gpio-pcie-idio-24.c
> index 1d475794a50f..a68941d19ac6 100644
> --- a/drivers/gpio/gpio-pcie-idio-24.c
> +++ b/drivers/gpio/gpio-pcie-idio-24.c
> @@ -457,6 +457,7 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> int err;
> const size_t pci_bar_index = 2;
> const char *const name = pci_name(pdev);
> + struct gpio_irq_chip *girq;
>
> idio24gpio = devm_kzalloc(dev, sizeof(*idio24gpio), GFP_KERNEL);
> if (!idio24gpio)
> @@ -490,6 +491,15 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> idio24gpio->chip.set = idio_24_gpio_set;
> idio24gpio->chip.set_multiple = idio_24_gpio_set_multiple;
>
> + girq = &idio24gpio->chip.irq;
> + girq->chip = &idio_24_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_edge_irq;
> +
> raw_spin_lock_init(&idio24gpio->lock);
>
> /* Software board reset */
> @@ -501,13 +511,6 @@ static int idio_24_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> return err;
> }
>
> - err = gpiochip_irqchip_add(&idio24gpio->chip, &idio_24_irqchip, 0,
> - handle_edge_irq, IRQ_TYPE_NONE);
> - if (err) {
> - dev_err(dev, "Could not add irqchip (%d)\n", err);
> - return err;
> - }
> -
> err = devm_request_irq(dev, pdev->irq, idio_24_irq_handler, IRQF_SHARED,
> name, idio24gpio);
> if (err) {
> --
> 2.26.2
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-22 17:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22 11:00 [PATCH] gpio: pcie-idio-24: Use irqchip template Linus Walleij
2020-07-22 17:30 ` William Breathitt Gray
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).