* [PATCH] clk: tegra: clk-tegra124-dfll-fcpu: don't use devm functions for regulator
@ 2021-06-24 8:47 Alexandru Ardelean
2021-06-24 11:57 ` Thierry Reding
2021-06-25 23:23 ` Stephen Boyd
0 siblings, 2 replies; 4+ messages in thread
From: Alexandru Ardelean @ 2021-06-24 8:47 UTC (permalink / raw)
To: linux-clk, linux-kernel, linux-tegra
Cc: pdeschrijver, pgaikwad, mturquette, sboyd, thierry.reding,
jonathanh, Alexandru Ardelean
The purpose of the device-managed functions is to bind the life-time of an
object to that of a parent device object.
This is not the case for the 'vdd-cpu' regulator in this driver. A
reference is obtained via devm_regulator_get() and immediately released
with devm_regulator_put().
In this case, the usage of devm_ functions is slightly excessive, as the
un-managed versions of these functions is a little cleaner (and slightly
more economical in terms of allocation).
This change converts the devm_regulator_{get,put}() to
regulator_{get,put}() in the get_alignment_from_regulator() function of
this driver.
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
---
drivers/clk/tegra/clk-tegra124-dfll-fcpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c
index 2ac2679d696d..5e339ad0a97c 100644
--- a/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c
+++ b/drivers/clk/tegra/clk-tegra124-dfll-fcpu.c
@@ -537,7 +537,7 @@ static void get_alignment_from_dt(struct device *dev,
static int get_alignment_from_regulator(struct device *dev,
struct rail_alignment *align)
{
- struct regulator *reg = devm_regulator_get(dev, "vdd-cpu");
+ struct regulator *reg = regulator_get(dev, "vdd-cpu");
if (IS_ERR(reg))
return PTR_ERR(reg);
@@ -545,7 +545,7 @@ static int get_alignment_from_regulator(struct device *dev,
align->offset_uv = regulator_list_voltage(reg, 0);
align->step_uv = regulator_get_linear_step(reg);
- devm_regulator_put(reg);
+ regulator_put(reg);
return 0;
}
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] clk: tegra: clk-tegra124-dfll-fcpu: don't use devm functions for regulator
2021-06-24 8:47 [PATCH] clk: tegra: clk-tegra124-dfll-fcpu: don't use devm functions for regulator Alexandru Ardelean
@ 2021-06-24 11:57 ` Thierry Reding
2021-06-25 23:23 ` Stephen Boyd
2021-06-25 23:23 ` Stephen Boyd
1 sibling, 1 reply; 4+ messages in thread
From: Thierry Reding @ 2021-06-24 11:57 UTC (permalink / raw)
To: Alexandru Ardelean, mturquette, sboyd
Cc: linux-clk, linux-kernel, linux-tegra, pdeschrijver, pgaikwad, jonathanh
[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]
On Thu, Jun 24, 2021 at 11:47:37AM +0300, Alexandru Ardelean wrote:
> The purpose of the device-managed functions is to bind the life-time of an
> object to that of a parent device object.
>
> This is not the case for the 'vdd-cpu' regulator in this driver. A
> reference is obtained via devm_regulator_get() and immediately released
> with devm_regulator_put().
>
> In this case, the usage of devm_ functions is slightly excessive, as the
> un-managed versions of these functions is a little cleaner (and slightly
> more economical in terms of allocation).
>
> This change converts the devm_regulator_{get,put}() to
> regulator_{get,put}() in the get_alignment_from_regulator() function of
> this driver.
>
> Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
> ---
> drivers/clk/tegra/clk-tegra124-dfll-fcpu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Indeed, this seems unnecessary:
Reviewed-by: Thierry Reding <treding@nvidia.com>
Mike, Stephen: do you want to pick this up directly or would you prefer
if I collected this into a clk branch for the next cycle?
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clk: tegra: clk-tegra124-dfll-fcpu: don't use devm functions for regulator
2021-06-24 11:57 ` Thierry Reding
@ 2021-06-25 23:23 ` Stephen Boyd
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2021-06-25 23:23 UTC (permalink / raw)
To: Alexandru Ardelean, Thierry Reding, mturquette
Cc: linux-clk, linux-kernel, linux-tegra, pdeschrijver, pgaikwad, jonathanh
Quoting Thierry Reding (2021-06-24 04:57:08)
> On Thu, Jun 24, 2021 at 11:47:37AM +0300, Alexandru Ardelean wrote:
> > The purpose of the device-managed functions is to bind the life-time of an
> > object to that of a parent device object.
> >
> > This is not the case for the 'vdd-cpu' regulator in this driver. A
> > reference is obtained via devm_regulator_get() and immediately released
> > with devm_regulator_put().
> >
> > In this case, the usage of devm_ functions is slightly excessive, as the
> > un-managed versions of these functions is a little cleaner (and slightly
> > more economical in terms of allocation).
> >
> > This change converts the devm_regulator_{get,put}() to
> > regulator_{get,put}() in the get_alignment_from_regulator() function of
> > this driver.
> >
> > Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
> > ---
> > drivers/clk/tegra/clk-tegra124-dfll-fcpu.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Indeed, this seems unnecessary:
>
> Reviewed-by: Thierry Reding <treding@nvidia.com>
>
> Mike, Stephen: do you want to pick this up directly or would you prefer
> if I collected this into a clk branch for the next cycle?
>
No worries. I got it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clk: tegra: clk-tegra124-dfll-fcpu: don't use devm functions for regulator
2021-06-24 8:47 [PATCH] clk: tegra: clk-tegra124-dfll-fcpu: don't use devm functions for regulator Alexandru Ardelean
2021-06-24 11:57 ` Thierry Reding
@ 2021-06-25 23:23 ` Stephen Boyd
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2021-06-25 23:23 UTC (permalink / raw)
To: Alexandru Ardelean, linux-clk, linux-kernel, linux-tegra
Cc: pdeschrijver, pgaikwad, mturquette, thierry.reding, jonathanh,
Alexandru Ardelean
Quoting Alexandru Ardelean (2021-06-24 01:47:37)
> The purpose of the device-managed functions is to bind the life-time of an
> object to that of a parent device object.
>
> This is not the case for the 'vdd-cpu' regulator in this driver. A
> reference is obtained via devm_regulator_get() and immediately released
> with devm_regulator_put().
>
> In this case, the usage of devm_ functions is slightly excessive, as the
> un-managed versions of these functions is a little cleaner (and slightly
> more economical in terms of allocation).
>
> This change converts the devm_regulator_{get,put}() to
> regulator_{get,put}() in the get_alignment_from_regulator() function of
> this driver.
>
> Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-25 23:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 8:47 [PATCH] clk: tegra: clk-tegra124-dfll-fcpu: don't use devm functions for regulator Alexandru Ardelean
2021-06-24 11:57 ` Thierry Reding
2021-06-25 23:23 ` Stephen Boyd
2021-06-25 23:23 ` Stephen Boyd
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.