From: Linus Walleij <linus.walleij@linaro.org>
To: linux-gpio@vger.kernel.org
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Linus Walleij <linus.walleij@linaro.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Anders Darander <anders@chargestorm.se>,
Roger Quadros <rogerq@ti.com>
Subject: [PATCH] gpio: pcf857x: Use irqchip template
Date: Fri, 17 Jul 2020 16:48:35 +0200 [thread overview]
Message-ID: <20200717144835.68150-1-linus.walleij@linaro.org> (raw)
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.
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Anders Darander <anders@chargestorm.se>
Cc: Roger Quadros <rogerq@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/gpio-pcf857x.c | 47 +++++++++++++++++++------------------
1 file changed, 24 insertions(+), 23 deletions(-)
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
index 14fb8f6a1ad2..a2a8d155c75e 100644
--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -334,29 +334,19 @@ static int pcf857x_probe(struct i2c_client *client,
gpio->out = ~n_latch;
gpio->status = gpio->out;
- status = devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio);
- if (status < 0)
- goto fail;
-
/* Enable irqchip if we have an interrupt */
if (client->irq) {
- gpio->irqchip.name = "pcf857x",
- gpio->irqchip.irq_enable = pcf857x_irq_enable,
- gpio->irqchip.irq_disable = pcf857x_irq_disable,
- gpio->irqchip.irq_ack = noop,
- gpio->irqchip.irq_mask = noop,
- gpio->irqchip.irq_unmask = noop,
- gpio->irqchip.irq_set_wake = pcf857x_irq_set_wake,
- gpio->irqchip.irq_bus_lock = pcf857x_irq_bus_lock,
- gpio->irqchip.irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock,
- status = gpiochip_irqchip_add_nested(&gpio->chip,
- &gpio->irqchip,
- 0, handle_level_irq,
- IRQ_TYPE_NONE);
- if (status) {
- dev_err(&client->dev, "cannot add irqchip\n");
- goto fail;
- }
+ struct gpio_irq_chip *girq;
+
+ gpio->irqchip.name = "pcf857x";
+ gpio->irqchip.irq_enable = pcf857x_irq_enable;
+ gpio->irqchip.irq_disable = pcf857x_irq_disable;
+ gpio->irqchip.irq_ack = noop;
+ gpio->irqchip.irq_mask = noop;
+ gpio->irqchip.irq_unmask = noop;
+ gpio->irqchip.irq_set_wake = pcf857x_irq_set_wake;
+ gpio->irqchip.irq_bus_lock = pcf857x_irq_bus_lock;
+ gpio->irqchip.irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock;
status = devm_request_threaded_irq(&client->dev, client->irq,
NULL, pcf857x_irq, IRQF_ONESHOT |
@@ -365,10 +355,21 @@ static int pcf857x_probe(struct i2c_client *client,
if (status)
goto fail;
- gpiochip_set_nested_irqchip(&gpio->chip, &gpio->irqchip,
- client->irq);
+ girq = &gpio->chip.irq;
+ girq->chip = &gpio->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_level_irq;
+ girq->threaded = true;
}
+ status = devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio);
+ if (status < 0)
+ goto fail;
+
/* Let platform code set up the GPIOs and their users.
* Now is the first time anyone could use them.
*/
--
2.26.2
reply other threads:[~2020-07-17 14:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200717144835.68150-1-linus.walleij@linaro.org \
--to=linus.walleij@linaro.org \
--cc=anders@chargestorm.se \
--cc=bgolaszewski@baylibre.com \
--cc=geert+renesas@glider.be \
--cc=linux-gpio@vger.kernel.org \
--cc=rogerq@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).