lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHCN7xKG6gUTXKehusRP+pyGXLfR2tmMW0ofmT3LTmryj2r9TQ@mail.gmail.com>
Date: Tue, 14 Jan 2025 05:26:19 -0600
From: Adam Ford <aford173@...il.com>
To: xiaopeitux@...mail.com
Cc: vkoul@...nel.org, linux-phy@...ts.infradead.org, 
	linux-kernel@...r.kernel.org, Pei Xiao <xiaopei01@...inos.cn>
Subject: Re: [RFC] phy: freescale: fsl-samsung-hdmi: Use helper function devm_clk_get_enabled()

On Mon, Jan 13, 2025 at 1:08 AM <xiaopeitux@...mail.com> wrote:
>
> From: Pei Xiao <xiaopei01@...inos.cn>
>
> Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared
> and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be
> replaced by devm_clk_get_enabled() when driver enables the clocks for the
> whole lifetime of the device. Moreover, it is no longer necessary to
> unprepare and disable the clocks explicitly.
>
> Fixes: 6ad082bee902 ("phy: freescale: add Samsung HDMI PHY")

I would argue that it is not a fix, but an improvement.  I don't think
anything was technically broken before, but Vinod may have a different
opinion.

> Signed-off-by: Pei Xiao <xiaopei01@...inos.cn>

Tested-by: Adam Ford <aford173@...il.com> # imx8mp-beacon

> ---
>  drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 17 ++---------------
>  1 file changed, 2 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> index 1a079075de67..170eac317b16 100644
> --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c
> @@ -667,7 +667,7 @@ static int fsl_samsung_hdmi_phy_probe(struct platform_device *pdev)
>         if (IS_ERR(phy->regs))
>                 return PTR_ERR(phy->regs);
>
> -       phy->apbclk = devm_clk_get(phy->dev, "apb");
> +       phy->apbclk = devm_clk_get_enabled(phy->dev, "apb");
>         if (IS_ERR(phy->apbclk))
>                 return dev_err_probe(phy->dev, PTR_ERR(phy->apbclk),
>                                      "failed to get apb clk\n");
> @@ -677,29 +677,16 @@ static int fsl_samsung_hdmi_phy_probe(struct platform_device *pdev)
>                 return dev_err_probe(phy->dev, PTR_ERR(phy->refclk),
>                                      "failed to get ref clk\n");
>
> -       ret = clk_prepare_enable(phy->apbclk);
> -       if (ret) {
> -               dev_err(phy->dev, "failed to enable apbclk\n");
> -               return ret;
> -       }
> -
>         pm_runtime_get_noresume(phy->dev);
>         pm_runtime_set_active(phy->dev);
>         pm_runtime_enable(phy->dev);
>
>         ret = phy_clk_register(phy);
> -       if (ret) {
> +       if (ret)
>                 dev_err(&pdev->dev, "register clk failed\n");
> -               goto register_clk_failed;
> -       }
>
>         pm_runtime_put(phy->dev);
>
> -       return 0;
> -
> -register_clk_failed:
> -       clk_disable_unprepare(phy->apbclk);
> -
>         return ret;
>  }
>
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ