mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] PM / devfreq: mtk-cci: refactor error handling of probe and remove
       [not found] <20230503092742.19404-1-jia-wei.chang@mediatek.com>
@ 2023-05-03 11:40 ` AngeloGioacchino Del Regno
  2023-05-04  3:00   ` Jia-wei Chang (張佳偉)
  0 siblings, 1 reply; 2+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-05-03 11:40 UTC (permalink / raw)
  To: jia-wei.chang, MyungJoo Ham, Kyungmin Park, Chanwoo Choi,
	Matthias Brugger, Johnson Wang
  Cc: linux-arm-kernel, linux-mediatek, linux-kernel,
	Project_Global_Chrome_Upstream_Group, hsinyi

Il 03/05/23 11:27, jia-wei.chang ha scritto:
> From: Jia-Wei Chang <jia-wei.chang@mediatek.com>
> 
> To refactor the regulator/clk handlers so it can follow the way of "Free
> the Last Thing Style".
> 
> Signed-off-by: Jia-Wei Chang <jia-wei.chang@mediatek.com>
> Fixes: 86d231b1db1b ("PM / devfreq: mediatek: Introduce MediaTek CCI devfreq driver")
> ---
>   drivers/devfreq/mtk-cci-devfreq.c | 47 ++++++++++++++++++-------------
>   1 file changed, 28 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/devfreq/mtk-cci-devfreq.c b/drivers/devfreq/mtk-cci-devfreq.c
> index e5458ada5197..d2f743774147 100644
> --- a/drivers/devfreq/mtk-cci-devfreq.c
> +++ b/drivers/devfreq/mtk-cci-devfreq.c
> @@ -294,14 +294,14 @@ static int mtk_ccifreq_probe(struct platform_device *pdev)
>   	if (IS_ERR(drv->sram_reg)) {
>   		ret = PTR_ERR(drv->sram_reg);
>   		if (ret == -EPROBE_DEFER)
> -			goto out_free_resources;
> +			goto out_disable_proc_reg;
>   
>   		drv->sram_reg = NULL;
>   	} else {
>   		ret = regulator_enable(drv->sram_reg);
>   		if (ret) {
>   			dev_err(dev, "failed to enable sram regulator\n");
> -			goto out_free_resources;
> +			goto out_disable_proc_reg;
>   		}
>   	}
>   
> @@ -316,12 +316,16 @@ static int mtk_ccifreq_probe(struct platform_device *pdev)
>   
>   	ret = clk_prepare_enable(drv->cci_clk);
>   	if (ret)
> -		goto out_free_resources;
> +		goto out_disable_sram_reg;
> +
> +	ret = clk_prepare_enable(drv->inter_clk);

Adding a clk_prepare_enable() call for a clock must be done in a separate commit.
Besides, there shouldn't be any need to do that, as when you call clk_set_parent()
(done in mtk_ccifreq_target()) on a clock that has flag CLK_OPS_PARENT_ENABLE, the
clk core will automatically call clk_core_prepare_enable() on the new parent.

If you're facing a bug for which the parent is not getting enabled, the solution
is to add CLK_OPS_PARENT_ENABLE to the interested clock.

Regards,
Angelo


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

* Re: [PATCH] PM / devfreq: mtk-cci: refactor error handling of probe and remove
  2023-05-03 11:40 ` [PATCH] PM / devfreq: mtk-cci: refactor error handling of probe and remove AngeloGioacchino Del Regno
@ 2023-05-04  3:00   ` Jia-wei Chang (張佳偉)
  0 siblings, 0 replies; 2+ messages in thread
From: Jia-wei Chang (張佳偉) @ 2023-05-04  3:00 UTC (permalink / raw)
  To: matthias.bgg, Johnson Wang (王聖鑫),
	angelogioacchino.delregno, kyungmin.park, myungjoo.ham,
	cw00.choi
  Cc: linux-arm-kernel, linux-kernel, linux-mediatek, hsinyi,
	Project_Global_Chrome_Upstream_Group

On Wed, 2023-05-03 at 13:40 +0200, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Il 03/05/23 11:27, jia-wei.chang ha scritto:
> > From: Jia-Wei Chang <jia-wei.chang@mediatek.com>
> > 
> > To refactor the regulator/clk handlers so it can follow the way of
> > "Free
> > the Last Thing Style".
> > 
> > Signed-off-by: Jia-Wei Chang <jia-wei.chang@mediatek.com>
> > Fixes: 86d231b1db1b ("PM / devfreq: mediatek: Introduce MediaTek
> > CCI devfreq driver")
> > ---
> >   drivers/devfreq/mtk-cci-devfreq.c | 47 ++++++++++++++++++------
> > -------
> >   1 file changed, 28 insertions(+), 19 deletions(-)
> > 
> > diff --git a/drivers/devfreq/mtk-cci-devfreq.c
> > b/drivers/devfreq/mtk-cci-devfreq.c
> > index e5458ada5197..d2f743774147 100644
> > --- a/drivers/devfreq/mtk-cci-devfreq.c
> > +++ b/drivers/devfreq/mtk-cci-devfreq.c
> > @@ -294,14 +294,14 @@ static int mtk_ccifreq_probe(struct
> > platform_device *pdev)
> >       if (IS_ERR(drv->sram_reg)) {
> >               ret = PTR_ERR(drv->sram_reg);
> >               if (ret == -EPROBE_DEFER)
> > -                     goto out_free_resources;
> > +                     goto out_disable_proc_reg;
> > 
> >               drv->sram_reg = NULL;
> >       } else {
> >               ret = regulator_enable(drv->sram_reg);
> >               if (ret) {
> >                       dev_err(dev, "failed to enable sram
> > regulator\n");
> > -                     goto out_free_resources;
> > +                     goto out_disable_proc_reg;
> >               }
> >       }
> > 
> > @@ -316,12 +316,16 @@ static int mtk_ccifreq_probe(struct
> > platform_device *pdev)
> > 
> >       ret = clk_prepare_enable(drv->cci_clk);
> >       if (ret)
> > -             goto out_free_resources;
> > +             goto out_disable_sram_reg;
> > +
> > +     ret = clk_prepare_enable(drv->inter_clk);
> 
> Adding a clk_prepare_enable() call for a clock must be done in a
> separate commit.
> Besides, there shouldn't be any need to do that, as when you call
> clk_set_parent()
> (done in mtk_ccifreq_target()) on a clock that has flag
> CLK_OPS_PARENT_ENABLE, the
> clk core will automatically call clk_core_prepare_enable() on the new
> parent.
> 
> If you're facing a bug for which the parent is not getting enabled,
> the solution
> is to add CLK_OPS_PARENT_ENABLE to the interested clock.
> 
> Regards,
> Angelo
> 

Hi Angelo Sir,

Thanks for your suggestion.
I will send a new patch to remove clk_prepare_enable() call on the
parent clock, since it is not directly related to this commit purpose.

As you suggested, clock parent enable will be handled by flag if
necessary.


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

end of thread, other threads:[~2023-05-04  3:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230503092742.19404-1-jia-wei.chang@mediatek.com>
2023-05-03 11:40 ` [PATCH] PM / devfreq: mtk-cci: refactor error handling of probe and remove AngeloGioacchino Del Regno
2023-05-04  3:00   ` Jia-wei Chang (張佳偉)

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

all inboxes | Powered by JetHome®