[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZrzRDdeyaVzZJ7NP@lizhi-Precision-Tower-5810>
Date: Wed, 14 Aug 2024 11:45:17 -0400
From: Frank Li <Frank.li@....com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc: Patrice Chotard <patrice.chotard@...s.st.com>,
Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>,
Michal Simek <michal.simek@....com>,
linux-arm-kernel@...ts.infradead.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, imx@...ts.linux.dev,
linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH 04/11] usb: dwc3: imx8mp: simplify with
devm_clk_get_enabled
On Wed, Aug 14, 2024 at 12:35:40PM +0200, Krzysztof Kozlowski wrote:
> Use devm_clk_get_enabled() to drop clock preparing and handling from
> error and remove paths. This makes the code a bit simpler.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Reviewed-by: Frank Li <Frank.Li@....com>
> ---
> drivers/usb/dwc3/dwc3-imx8mp.c | 32 +++++---------------------------
> 1 file changed, 5 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c
> index 392fa1232788..8c91e595d3b9 100644
> --- a/drivers/usb/dwc3/dwc3-imx8mp.c
> +++ b/drivers/usb/dwc3/dwc3-imx8mp.c
> @@ -178,37 +178,23 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
> return PTR_ERR(dwc3_imx->glue_base);
> }
>
> - dwc3_imx->hsio_clk = devm_clk_get(dev, "hsio");
> + dwc3_imx->hsio_clk = devm_clk_get_enabled(dev, "hsio");
> if (IS_ERR(dwc3_imx->hsio_clk)) {
> err = PTR_ERR(dwc3_imx->hsio_clk);
> dev_err(dev, "Failed to get hsio clk, err=%d\n", err);
> return err;
> }
>
> - err = clk_prepare_enable(dwc3_imx->hsio_clk);
> - if (err) {
> - dev_err(dev, "Failed to enable hsio clk, err=%d\n", err);
> - return err;
> - }
> -
> - dwc3_imx->suspend_clk = devm_clk_get(dev, "suspend");
> + dwc3_imx->suspend_clk = devm_clk_get_enabled(dev, "suspend");
> if (IS_ERR(dwc3_imx->suspend_clk)) {
> err = PTR_ERR(dwc3_imx->suspend_clk);
> dev_err(dev, "Failed to get suspend clk, err=%d\n", err);
> - goto disable_hsio_clk;
> - }
> -
> - err = clk_prepare_enable(dwc3_imx->suspend_clk);
> - if (err) {
> - dev_err(dev, "Failed to enable suspend clk, err=%d\n", err);
> - goto disable_hsio_clk;
> + return err;
> }
>
> irq = platform_get_irq(pdev, 0);
> - if (irq < 0) {
> - err = irq;
> - goto disable_clks;
> - }
> + if (irq < 0)
> + return irq;
> dwc3_imx->irq = irq;
>
> imx8mp_configure_glue(dwc3_imx);
> @@ -259,25 +245,17 @@ static int dwc3_imx8mp_probe(struct platform_device *pdev)
> disable_rpm:
> pm_runtime_disable(dev);
> pm_runtime_put_noidle(dev);
> -disable_clks:
> - clk_disable_unprepare(dwc3_imx->suspend_clk);
> -disable_hsio_clk:
> - clk_disable_unprepare(dwc3_imx->hsio_clk);
>
> return err;
> }
>
> static void dwc3_imx8mp_remove(struct platform_device *pdev)
> {
> - struct dwc3_imx8mp *dwc3_imx = platform_get_drvdata(pdev);
> struct device *dev = &pdev->dev;
>
> pm_runtime_get_sync(dev);
> of_platform_depopulate(dev);
>
> - clk_disable_unprepare(dwc3_imx->suspend_clk);
> - clk_disable_unprepare(dwc3_imx->hsio_clk);
> -
> pm_runtime_disable(dev);
> pm_runtime_put_noidle(dev);
> }
>
> --
> 2.43.0
>
Powered by blists - more mailing lists