* [PATCH] gpio: ftgpio: Move hardware initialization
@ 2019-08-19 8:27 Linus Walleij
2019-08-19 9:02 ` Phil Reid
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2019-08-19 8:27 UTC (permalink / raw)
To: linux-gpio; +Cc: Bartosz Golaszewski, Linus Walleij
It is probably wise to initialize the hardware before registering
the irq chip.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/gpio-ftgpio010.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-ftgpio010.c b/drivers/gpio/gpio-ftgpio010.c
index 250e71f3e688..3118d282514a 100644
--- a/drivers/gpio/gpio-ftgpio010.c
+++ b/drivers/gpio/gpio-ftgpio010.c
@@ -296,10 +296,6 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
girq->handler = handle_bad_irq;
girq->parents[0] = irq;
- ret = devm_gpiochip_add_data(dev, &g->gc, g);
- if (ret)
- goto dis_clk;
-
/* Disable, unmask and clear all interrupts */
writel(0x0, g->base + GPIO_INT_EN);
writel(0x0, g->base + GPIO_INT_MASK);
@@ -308,6 +304,10 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
/* Clear any use of debounce */
writel(0x0, g->base + GPIO_DEBOUNCE_EN);
+ ret = devm_gpiochip_add_data(dev, &g->gc, g);
+ if (ret)
+ goto dis_clk;
+
platform_set_drvdata(pdev, g);
dev_info(dev, "FTGPIO010 @%p registered\n", g->base);
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpio: ftgpio: Move hardware initialization
2019-08-19 8:27 [PATCH] gpio: ftgpio: Move hardware initialization Linus Walleij
@ 2019-08-19 9:02 ` Phil Reid
0 siblings, 0 replies; 2+ messages in thread
From: Phil Reid @ 2019-08-19 9:02 UTC (permalink / raw)
To: Linus Walleij, linux-gpio; +Cc: Bartosz Golaszewski
On 19/08/2019 16:27, Linus Walleij wrote:
> It is probably wise to initialize the hardware before registering
> the irq chip.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/gpio/gpio-ftgpio010.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpio-ftgpio010.c b/drivers/gpio/gpio-ftgpio010.c
> index 250e71f3e688..3118d282514a 100644
> --- a/drivers/gpio/gpio-ftgpio010.c
> +++ b/drivers/gpio/gpio-ftgpio010.c
> @@ -296,10 +296,6 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
> girq->handler = handle_bad_irq;
> girq->parents[0] = irq;
>
> - ret = devm_gpiochip_add_data(dev, &g->gc, g);
> - if (ret)
> - goto dis_clk;
> -
> /* Disable, unmask and clear all interrupts */
> writel(0x0, g->base + GPIO_INT_EN);
> writel(0x0, g->base + GPIO_INT_MASK);
> @@ -308,6 +304,10 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
> /* Clear any use of debounce */
> writel(0x0, g->base + GPIO_DEBOUNCE_EN);
>
> + ret = devm_gpiochip_add_data(dev, &g->gc, g);
> + if (ret)
> + goto dis_clk;
> +
> platform_set_drvdata(pdev, g);
Should it also be after platform_set_drvdata?
But it doesn't look like it's used anywhere other than in _remove
so I guess it does't matter.
> dev_info(dev, "FTGPIO010 @%p registered\n", g->base);
>
>
--
Regards
Phil Reid
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-19 9:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-19 8:27 [PATCH] gpio: ftgpio: Move hardware initialization Linus Walleij
2019-08-19 9:02 ` Phil Reid
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).