* [PATCH] ASoC: ti: Fix runtime PM imbalance in omap2_mcbsp_set_clks_src
@ 2020-05-25 7:22 Dinghao Liu
2020-05-25 8:37 ` Peter Ujfalusi
0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2020-05-25 7:22 UTC (permalink / raw)
To: dinghao.liu, kjlu
Cc: Peter Ujfalusi, Jarkko Nikula, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-omap,
linux-kernel
When clk_set_parent() returns an error code, a pairing
runtime PM usage counter increment is needed to keep the
counter balanced.
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
sound/soc/ti/omap-mcbsp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c
index 3d41ca2238d4..84b4de9b670c 100644
--- a/sound/soc/ti/omap-mcbsp.c
+++ b/sound/soc/ti/omap-mcbsp.c
@@ -80,6 +80,7 @@ static int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id)
if (r) {
dev_err(mcbsp->dev, "CLKS: could not clk_set_parent() to %s\n",
src);
+ pm_runtime_get_sync(mcbsp->dev);
clk_put(fck_src);
return r;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: ti: Fix runtime PM imbalance in omap2_mcbsp_set_clks_src
2020-05-25 7:22 [PATCH] ASoC: ti: Fix runtime PM imbalance in omap2_mcbsp_set_clks_src Dinghao Liu
@ 2020-05-25 8:37 ` Peter Ujfalusi
2020-05-25 8:48 ` dinghao.liu
0 siblings, 1 reply; 3+ messages in thread
From: Peter Ujfalusi @ 2020-05-25 8:37 UTC (permalink / raw)
To: Dinghao Liu, kjlu
Cc: Jarkko Nikula, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, alsa-devel, linux-omap, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]
On 25/05/2020 10.22, Dinghao Liu wrote:
> When clk_set_parent() returns an error code, a pairing
> runtime PM usage counter increment is needed to keep the
> counter balanced.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
> sound/soc/ti/omap-mcbsp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c
> index 3d41ca2238d4..84b4de9b670c 100644
> --- a/sound/soc/ti/omap-mcbsp.c
> +++ b/sound/soc/ti/omap-mcbsp.c
> @@ -80,6 +80,7 @@ static int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id)
> if (r) {
> dev_err(mcbsp->dev, "CLKS: could not clk_set_parent() to %s\n",
> src);
> + pm_runtime_get_sync(mcbsp->dev);
> clk_put(fck_src);
> return r;
> }
I think it would be cleaner in this way:
pm_runtime_put_sync(mcbsp->dev);
r = clk_set_parent(mcbsp->fclk, fck_src);
if (r)
dev_err(mcbsp->dev, "CLKS: could not clk_set_parent() to %s\n",
src);
pm_runtime_get_sync(mcbsp->dev);
clk_put(fck_src);
return r;
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 1783 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [PATCH] ASoC: ti: Fix runtime PM imbalance in omap2_mcbsp_set_clks_src
2020-05-25 8:37 ` Peter Ujfalusi
@ 2020-05-25 8:48 ` dinghao.liu
0 siblings, 0 replies; 3+ messages in thread
From: dinghao.liu @ 2020-05-25 8:48 UTC (permalink / raw)
To: Peter Ujfalusi
Cc: kjlu, Jarkko Nikula, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, alsa-devel, linux-omap, linux-kernel
>
>
> On 25/05/2020 10.22, Dinghao Liu wrote:
> > When clk_set_parent() returns an error code, a pairing
> > runtime PM usage counter increment is needed to keep the
> > counter balanced.
> >
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> > ---
> > sound/soc/ti/omap-mcbsp.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c
> > index 3d41ca2238d4..84b4de9b670c 100644
> > --- a/sound/soc/ti/omap-mcbsp.c
> > +++ b/sound/soc/ti/omap-mcbsp.c
> > @@ -80,6 +80,7 @@ static int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id)
> > if (r) {
> > dev_err(mcbsp->dev, "CLKS: could not clk_set_parent() to %s\n",
> > src);
> > + pm_runtime_get_sync(mcbsp->dev);
>
> > clk_put(fck_src);
> > return r;
> > }
>
> I think it would be cleaner in this way:
>
> pm_runtime_put_sync(mcbsp->dev);
>
> r = clk_set_parent(mcbsp->fclk, fck_src);
> if (r)
> dev_err(mcbsp->dev, "CLKS: could not clk_set_parent() to %s\n",
> src);
>
> pm_runtime_get_sync(mcbsp->dev);
> clk_put(fck_src);
>
> return r;
>
> - Péter
>
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Thank you for your advice! This is better and I will fix this
in the next version of patch.
Regards,
Dinghao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-25 8:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-25 7:22 [PATCH] ASoC: ti: Fix runtime PM imbalance in omap2_mcbsp_set_clks_src Dinghao Liu
2020-05-25 8:37 ` Peter Ujfalusi
2020-05-25 8:48 ` dinghao.liu
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).