Re: [PATCH 1/1] soundwire: use devm_clk_get_enabled() in qcom_swrm_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 20, 2023 at 10:08:45PM +0800, Yuanjun Gong wrote:
> in qcom_swrm_probe(), the return value of function
> clk_prepare_enable() should be checked, since it may fail.
> using devm_clk_get_enabled() instead of devm_clk_get() and
> clk_prepare_enable() can avoid this problem.
> 
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@xxxxxxx>
> ---
>  drivers/soundwire/qcom.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index 7970fdb27ba0..04bc917b7a70 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -1549,14 +1549,12 @@ static int qcom_swrm_probe(struct platform_device *pdev)
>  		goto err_init;
>  	}
>  
> -	ctrl->hclk = devm_clk_get(dev, "iface");
> +	ctrl->hclk = devm_clk_get_enabled(dev, "iface");

This gives the impression that hclk is to be enabled from probe() until
cleanup, but hclk is toggled during suspend/resume. So I'm not entirely
sure this is good practice.

If we choose to use devm_clk_get_enabled() then you need to remove the
clk_disable_unprepare() from qcom_swrm_remove().

If you choose to solve your problem by checking the return value of
clk_prepare_enable(), note that you have one in swrm_runtime_resume() as
well.

Regards,
Bjorn



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux