* [PATCH] gpio: pxa: schedule a devm action for the clock struct
@ 2022-07-05 17:18 Bartosz Golaszewski
2022-07-06 11:48 ` Andy Shevchenko
0 siblings, 1 reply; 5+ messages in thread
From: Bartosz Golaszewski @ 2022-07-05 17:18 UTC (permalink / raw)
To: Robert Jarzmik, Linus Walleij
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski, Hulk Robot,
Signed-off-by : Yuan Can
The clock is never released after probe(). Schedule devm actions for
putting and disabling the clock.
Reported-by: Hulk Robot <hulkci@huawei.com>
Reported-by: Signed-off-by: Yuan Can <yuancan@huawei.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
drivers/gpio/gpio-pxa.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index c7fbfa3ae43b..73a83b493b2e 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -610,6 +610,20 @@ static int pxa_gpio_probe_dt(struct platform_device *pdev,
#define pxa_gpio_probe_dt(pdev, pchip) (-1)
#endif
+static void pxa_gpio_clk_put(void *data)
+{
+ struct clk *clk = data;
+
+ clk_put(clk);
+}
+
+static void pxa_gpio_clk_disable_unprepare(void *data)
+{
+ struct clk *clk = data;
+
+ clk_disable_unprepare(clk);
+}
+
static int pxa_gpio_probe(struct platform_device *pdev)
{
struct pxa_gpio_chip *pchip;
@@ -667,18 +681,24 @@ static int pxa_gpio_probe(struct platform_device *pdev)
PTR_ERR(clk));
return PTR_ERR(clk);
}
+
+ ret = devm_add_action_or_reset(&pdev->dev, pxa_gpio_clk_put, clk);
+ if (ret)
+ return ret;
+
ret = clk_prepare_enable(clk);
- if (ret) {
- clk_put(clk);
+ if (ret)
+ return ret;
+
+ ret = devm_add_action_or_reset(&pdev->dev,
+ pxa_gpio_clk_disable_unprepare, clk);
+ if (ret)
return ret;
- }
/* Initialize GPIO chips */
ret = pxa_init_gpio_chip(pchip, pxa_last_gpio + 1, gpio_reg_base);
- if (ret) {
- clk_put(clk);
+ if (ret)
return ret;
- }
/* clear all GPIO edge detects */
for_each_gpio_bank(gpio, c, pchip) {
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: pxa: schedule a devm action for the clock struct
2022-07-05 17:18 [PATCH] gpio: pxa: schedule a devm action for the clock struct Bartosz Golaszewski
@ 2022-07-06 11:48 ` Andy Shevchenko
2022-07-06 12:11 ` Bartosz Golaszewski
0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2022-07-06 11:48 UTC (permalink / raw)
To: Bartosz Golaszewski, Stephen Boyd
Cc: Robert Jarzmik, Linus Walleij, open list:GPIO SUBSYSTEM,
Linux Kernel Mailing List, Hulk Robot, Signed-off-by : Yuan Can
On Tue, Jul 5, 2022 at 7:29 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> The clock is never released after probe(). Schedule devm actions for
> putting and disabling the clock.
...
> Reported-by: Signed-off-by: Yuan Can <yuancan@huawei.com>
Me puzzled.
...
> + ret = devm_add_action_or_reset(&pdev->dev, pxa_gpio_clk_put, clk);
> + if (ret)
> + return ret;
> +
> ret = clk_prepare_enable(clk);
> + if (ret)
> + return ret;
> +
> + ret = devm_add_action_or_reset(&pdev->dev,
> + pxa_gpio_clk_disable_unprepare, clk);
> + if (ret)
> return ret;
Can we use recently introduced clk APIs for that? Maybe Stephen has an
immutable branch you may reuse?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: pxa: schedule a devm action for the clock struct
2022-07-06 11:48 ` Andy Shevchenko
@ 2022-07-06 12:11 ` Bartosz Golaszewski
2022-07-06 12:31 ` Andy Shevchenko
0 siblings, 1 reply; 5+ messages in thread
From: Bartosz Golaszewski @ 2022-07-06 12:11 UTC (permalink / raw)
To: Andy Shevchenko, Stephen Boyd
Cc: Robert Jarzmik, Linus Walleij, open list:GPIO SUBSYSTEM,
Linux Kernel Mailing List, Hulk Robot, Yuan Can
On Wed, Jul 6, 2022 at 1:49 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
s>
> On Tue, Jul 5, 2022 at 7:29 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > The clock is never released after probe(). Schedule devm actions for
> > putting and disabling the clock.
>
> ...
>
> > Reported-by: Signed-off-by: Yuan Can <yuancan@huawei.com>
>
> Me puzzled.
>
Yuan Can sent the following patch:
https://patchwork.ozlabs.org/project/linux-gpio/patch/20220704130323.104294-1-yuancan@huawei.com/
I responded that it was not complete and sent this instead.
>
> ...
>
> > + ret = devm_add_action_or_reset(&pdev->dev, pxa_gpio_clk_put, clk);
> > + if (ret)
> > + return ret;
> > +
> > ret = clk_prepare_enable(clk);
> > + if (ret)
> > + return ret;
> > +
> > + ret = devm_add_action_or_reset(&pdev->dev,
> > + pxa_gpio_clk_disable_unprepare, clk);
> > + if (ret)
> > return ret;
>
> Can we use recently introduced clk APIs for that? Maybe Stephen has an
> immutable branch you may reuse?
Sure, sounds good! Stephen, would you mind providing me with a branch for that?
Bart
>
> --
> With Best Regards,
> Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: pxa: schedule a devm action for the clock struct
2022-07-06 12:11 ` Bartosz Golaszewski
@ 2022-07-06 12:31 ` Andy Shevchenko
2022-07-06 15:07 ` Bartosz Golaszewski
0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2022-07-06 12:31 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Stephen Boyd, Robert Jarzmik, Linus Walleij,
open list:GPIO SUBSYSTEM, Linux Kernel Mailing List, Hulk Robot,
Yuan Can
On Wed, Jul 6, 2022 at 2:11 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> On Wed, Jul 6, 2022 at 1:49 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Tue, Jul 5, 2022 at 7:29 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
...
> > > Reported-by: Signed-off-by: Yuan Can <yuancan@huawei.com>
> >
> > Me puzzled.
>
> Yuan Can sent the following patch:
> https://patchwork.ozlabs.org/project/linux-gpio/patch/20220704130323.104294-1-yuancan@huawei.com/
>
> I responded that it was not complete and sent this instead.
I understand that, I am puzzled with Reported-by: followed by SoB.
What is this format? Is it something new and documented?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: pxa: schedule a devm action for the clock struct
2022-07-06 12:31 ` Andy Shevchenko
@ 2022-07-06 15:07 ` Bartosz Golaszewski
0 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2022-07-06 15:07 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Stephen Boyd, Robert Jarzmik, Linus Walleij,
open list:GPIO SUBSYSTEM, Linux Kernel Mailing List, Hulk Robot,
Yuan Can
On Wed, Jul 6, 2022 at 2:32 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Wed, Jul 6, 2022 at 2:11 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > On Wed, Jul 6, 2022 at 1:49 PM Andy Shevchenko
> > <andy.shevchenko@gmail.com> wrote:
> > > On Tue, Jul 5, 2022 at 7:29 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> ...
>
> > > > Reported-by: Signed-off-by: Yuan Can <yuancan@huawei.com>
> > >
> > > Me puzzled.
> >
> > Yuan Can sent the following patch:
> > https://patchwork.ozlabs.org/project/linux-gpio/patch/20220704130323.104294-1-yuancan@huawei.com/
> >
> > I responded that it was not complete and sent this instead.
>
> I understand that, I am puzzled with Reported-by: followed by SoB.
> What is this format? Is it something new and documented?
>
Ah! No, it's just my brain on not enough coffee I suppose. Thanks, I'll fix it.
Bart
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-07-06 15:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 17:18 [PATCH] gpio: pxa: schedule a devm action for the clock struct Bartosz Golaszewski
2022-07-06 11:48 ` Andy Shevchenko
2022-07-06 12:11 ` Bartosz Golaszewski
2022-07-06 12:31 ` Andy Shevchenko
2022-07-06 15:07 ` Bartosz Golaszewski
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).