Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] pmdomain: core: add dummy release function to genpd device
@ 2024-12-18 18:44 Lucas Stach
  2024-12-19  8:26 ` Luca Ceresoli
  2024-12-19 14:40 ` Ulf Hansson
  0 siblings, 2 replies; 6+ messages in thread
From: Lucas Stach @ 2024-12-18 18:44 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-pm, kernel, patchwork-lst, Luca Ceresoli, Peng Fan

The genpd device, which is really only used as a handle to lookup
OPP, but not even registered to the device core otherwise and thus
lifetime linked to the genpd struct it is contained in, is missing
a release function. After b8f7bbd1f4ec ("pmdomain: core: Add
missing put_device()") the device will be cleaned up going through
the driver core device_release() function, which will warn when no
release callback is present for the device. Add a dummy release
function to shut up the warning.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
It's a bit unfortunate that the genpd even needs to have this
not-really-a-device just for the sake of the OPP lookup.
---
 drivers/pmdomain/core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index bb11f467dc78..83659d79e07d 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -2142,6 +2142,11 @@ static int genpd_set_default_power_state(struct generic_pm_domain *genpd)
 	return 0;
 }
 
+static void genpd_release_opp_dev(struct device *dev)
+{
+	/* nothing to be done here */
+}
+
 static int genpd_alloc_data(struct generic_pm_domain *genpd)
 {
 	struct genpd_governor_data *gd = NULL;
@@ -2173,6 +2178,7 @@ static int genpd_alloc_data(struct generic_pm_domain *genpd)
 
 	genpd->gd = gd;
 	device_initialize(&genpd->dev);
+	genpd->dev.release = genpd_release_opp_dev;
 
 	if (!genpd_is_dev_name_fw(genpd)) {
 		dev_set_name(&genpd->dev, "%s", genpd->name);
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] pmdomain: core: add dummy release function to genpd device
  2024-12-18 18:44 [PATCH] pmdomain: core: add dummy release function to genpd device Lucas Stach
@ 2024-12-19  8:26 ` Luca Ceresoli
  2024-12-19 14:40 ` Ulf Hansson
  1 sibling, 0 replies; 6+ messages in thread
From: Luca Ceresoli @ 2024-12-19  8:26 UTC (permalink / raw)
  To: Lucas Stach
  Cc: Ulf Hansson, linux-pm, kernel, patchwork-lst, Peng Fan,
	Hervé Codina

Hello Lucas,

On Wed, 18 Dec 2024 19:44:33 +0100
Lucas Stach <l.stach@pengutronix.de> wrote:

> The genpd device, which is really only used as a handle to lookup
> OPP, but not even registered to the device core otherwise and thus
> lifetime linked to the genpd struct it is contained in, is missing
> a release function. After b8f7bbd1f4ec ("pmdomain: core: Add
> missing put_device()") the device will be cleaned up going through
> the driver core device_release() function, which will warn when no
> release callback is present for the device. Add a dummy release
> function to shut up the warning.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>

Thanks for the very quick response!

Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pmdomain: core: add dummy release function to genpd device
  2024-12-18 18:44 [PATCH] pmdomain: core: add dummy release function to genpd device Lucas Stach
  2024-12-19  8:26 ` Luca Ceresoli
@ 2024-12-19 14:40 ` Ulf Hansson
  2024-12-19 14:48   ` Ulf Hansson
  1 sibling, 1 reply; 6+ messages in thread
From: Ulf Hansson @ 2024-12-19 14:40 UTC (permalink / raw)
  To: Lucas Stach; +Cc: linux-pm, kernel, patchwork-lst, Luca Ceresoli, Peng Fan

On Wed, 18 Dec 2024 at 19:44, Lucas Stach <l.stach@pengutronix.de> wrote:
>
> The genpd device, which is really only used as a handle to lookup
> OPP, but not even registered to the device core otherwise and thus
> lifetime linked to the genpd struct it is contained in, is missing
> a release function. After b8f7bbd1f4ec ("pmdomain: core: Add
> missing put_device()") the device will be cleaned up going through
> the driver core device_release() function, which will warn when no
> release callback is present for the device. Add a dummy release
> function to shut up the warning.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> It's a bit unfortunate that the genpd even needs to have this
> not-really-a-device just for the sake of the OPP lookup.

Right. Although, I have patches in the pipe that will make use of it
that isn't limited to the use for OPP.

> ---
>  drivers/pmdomain/core.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
> index bb11f467dc78..83659d79e07d 100644
> --- a/drivers/pmdomain/core.c
> +++ b/drivers/pmdomain/core.c
> @@ -2142,6 +2142,11 @@ static int genpd_set_default_power_state(struct generic_pm_domain *genpd)
>         return 0;
>  }
>
> +static void genpd_release_opp_dev(struct device *dev)

The above said, would you mind changing the name to
"genpd_provider_release". Or something along those lines.

> +{
> +       /* nothing to be done here */
> +}
> +
>  static int genpd_alloc_data(struct generic_pm_domain *genpd)
>  {
>         struct genpd_governor_data *gd = NULL;
> @@ -2173,6 +2178,7 @@ static int genpd_alloc_data(struct generic_pm_domain *genpd)
>
>         genpd->gd = gd;
>         device_initialize(&genpd->dev);
> +       genpd->dev.release = genpd_release_opp_dev;
>
>         if (!genpd_is_dev_name_fw(genpd)) {
>                 dev_set_name(&genpd->dev, "%s", genpd->name);
> --
> 2.47.1
>

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pmdomain: core: add dummy release function to genpd device
  2024-12-19 14:40 ` Ulf Hansson
@ 2024-12-19 14:48   ` Ulf Hansson
  2024-12-31 10:45     ` Geert Uytterhoeven
  0 siblings, 1 reply; 6+ messages in thread
From: Ulf Hansson @ 2024-12-19 14:48 UTC (permalink / raw)
  To: Lucas Stach; +Cc: linux-pm, kernel, patchwork-lst, Luca Ceresoli, Peng Fan

On Thu, 19 Dec 2024 at 15:40, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Wed, 18 Dec 2024 at 19:44, Lucas Stach <l.stach@pengutronix.de> wrote:
> >
> > The genpd device, which is really only used as a handle to lookup
> > OPP, but not even registered to the device core otherwise and thus
> > lifetime linked to the genpd struct it is contained in, is missing
> > a release function. After b8f7bbd1f4ec ("pmdomain: core: Add
> > missing put_device()") the device will be cleaned up going through
> > the driver core device_release() function, which will warn when no
> > release callback is present for the device. Add a dummy release
> > function to shut up the warning.
> >
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> > It's a bit unfortunate that the genpd even needs to have this
> > not-really-a-device just for the sake of the OPP lookup.
>
> Right. Although, I have patches in the pipe that will make use of it
> that isn't limited to the use for OPP.
>
> > ---
> >  drivers/pmdomain/core.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
> > index bb11f467dc78..83659d79e07d 100644
> > --- a/drivers/pmdomain/core.c
> > +++ b/drivers/pmdomain/core.c
> > @@ -2142,6 +2142,11 @@ static int genpd_set_default_power_state(struct generic_pm_domain *genpd)
> >         return 0;
> >  }
> >
> > +static void genpd_release_opp_dev(struct device *dev)
>
> The above said, would you mind changing the name to
> "genpd_provider_release". Or something along those lines.
>

Well, it's kind of trivial so I just amended the patch when applying.
Thanks for fixing this!

Applied for fixes and by adding a stable tag.

Kind rergards
Uffe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pmdomain: core: add dummy release function to genpd device
  2024-12-19 14:48   ` Ulf Hansson
@ 2024-12-31 10:45     ` Geert Uytterhoeven
  2025-01-02 20:07       ` Ulf Hansson
  0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2024-12-31 10:45 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Lucas Stach, linux-pm, kernel, patchwork-lst, Luca Ceresoli,
	Peng Fan

Hi Ulf,

On Thu, Dec 19, 2024 at 3:49 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> Applied for fixes and by adding a stable tag.

commit f64f610ec6ab59dd0391b03842cea3a4cd8ee34f
Author: Lucas Stach <l.stach@pengutronix.de>
Date:   Wed Dec 18 19:44:33 2024 +0100

    pmdomain: core: add dummy release function to genpd device

    The genpd device, which is really only used as a handle to lookup
    OPP, but not even registered to the device core otherwise and thus
    lifetime linked to the genpd struct it is contained in, is missing
    a release function. After b8f7bbd1f4ec ("pmdomain: core: Add
    missing put_device()") the device will be cleaned up going through
    the driver core device_release() function, which will warn when no
    release callback is present for the device. Add a dummy release
    function to shut up the warning.

    Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
    Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
    Fixes: b8f7bbd1f4ec ("pmdomain: core: Add missing put_device()")
    Cc: stable@vger.kernel.org
    Message-ID: <20241218184433.1930532-1-l.stach@pengutronix.de>
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Can you please use Link:-tags pointing to lore instead of non-standard
Message-ID:-tags, so we can easily go to preceding discussions?

Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pmdomain: core: add dummy release function to genpd device
  2024-12-31 10:45     ` Geert Uytterhoeven
@ 2025-01-02 20:07       ` Ulf Hansson
  0 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2025-01-02 20:07 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Lucas Stach, linux-pm, kernel, patchwork-lst, Luca Ceresoli,
	Peng Fan

On Tue, 31 Dec 2024 at 11:45, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Ulf,
>
> On Thu, Dec 19, 2024 at 3:49 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > Applied for fixes and by adding a stable tag.
>
> commit f64f610ec6ab59dd0391b03842cea3a4cd8ee34f
> Author: Lucas Stach <l.stach@pengutronix.de>
> Date:   Wed Dec 18 19:44:33 2024 +0100
>
>     pmdomain: core: add dummy release function to genpd device
>
>     The genpd device, which is really only used as a handle to lookup
>     OPP, but not even registered to the device core otherwise and thus
>     lifetime linked to the genpd struct it is contained in, is missing
>     a release function. After b8f7bbd1f4ec ("pmdomain: core: Add
>     missing put_device()") the device will be cleaned up going through
>     the driver core device_release() function, which will warn when no
>     release callback is present for the device. Add a dummy release
>     function to shut up the warning.
>
>     Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
>     Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>     Fixes: b8f7bbd1f4ec ("pmdomain: core: Add missing put_device()")
>     Cc: stable@vger.kernel.org
>     Message-ID: <20241218184433.1930532-1-l.stach@pengutronix.de>
>     Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
>
> Can you please use Link:-tags pointing to lore instead of non-standard
> Message-ID:-tags, so we can easily go to preceding discussions?

Certainly! Thanks for pointing this out!

It seems like my git-hook with a perl-script stopped working, as in
the past I have added those Link-tags when applying a patch.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-02 20:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18 18:44 [PATCH] pmdomain: core: add dummy release function to genpd device Lucas Stach
2024-12-19  8:26 ` Luca Ceresoli
2024-12-19 14:40 ` Ulf Hansson
2024-12-19 14:48   ` Ulf Hansson
2024-12-31 10:45     ` Geert Uytterhoeven
2025-01-02 20:07       ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox