Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Michal Simek <michal.simek@amd.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH 04/11] usb: dwc3: imx8mp: simplify with devm_clk_get_enabled
Date: Tue, 27 Aug 2024 01:26:56 +0000	[thread overview]
Message-ID: <20240827012651.j2chqblkjha2vene@synopsys.com> (raw)
In-Reply-To: <20240814-b4-cleanup-h-of-node-put-usb-v1-4-95481b9682bc@linaro.org>

On Wed, Aug 14, 2024, 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@linaro.org>
> ---
>  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
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh

  parent reply	other threads:[~2024-08-27  1:27 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14 10:35 [PATCH 00/11] usb: dwc3: various cleanups Krzysztof Kozlowski
2024-08-14 10:35 ` [PATCH 01/11] usb: dwc3: st: use scoped device node handling to simplify error paths Krzysztof Kozlowski
2024-08-14 15:43   ` Patrice CHOTARD
2024-08-27  1:08   ` Thinh Nguyen
2024-08-14 10:35 ` [PATCH 02/11] usb: dwc3: st: simplify with dev_err_probe Krzysztof Kozlowski
2024-08-14 15:44   ` Patrice CHOTARD
2024-08-27  1:19   ` Thinh Nguyen
2024-08-27  9:35     ` Krzysztof Kozlowski
2024-08-14 10:35 ` [PATCH 03/11] usb: dwc3: st: simplify pdev->dev usage Krzysztof Kozlowski
2024-08-14 15:45   ` Patrice CHOTARD
2024-08-27  1:19   ` Thinh Nguyen
2024-08-14 10:35 ` [PATCH 04/11] usb: dwc3: imx8mp: simplify with devm_clk_get_enabled Krzysztof Kozlowski
2024-08-14 15:45   ` Frank Li
2024-08-27  1:26   ` Thinh Nguyen [this message]
2024-08-14 10:35 ` [PATCH 05/11] usb: dwc3: imx8mp: simplify with dev_err_probe Krzysztof Kozlowski
2024-08-14 15:44   ` Frank Li
2024-08-27  1:27   ` Thinh Nguyen
2024-08-14 10:35 ` [PATCH 06/11] usb: dwc3: imx8mp: use scoped device node handling to simplify error paths Krzysztof Kozlowski
2024-08-14 15:43   ` Frank Li
2024-08-27  1:30   ` Thinh Nguyen
2024-08-14 10:35 ` [PATCH 07/11] usb: dwc3: qcom: " Krzysztof Kozlowski
2024-08-27  1:32   ` Thinh Nguyen
2024-08-14 10:35 ` [PATCH 08/11] usb: dwc3: qcom: simplify with devm_platform_ioremap_resource Krzysztof Kozlowski
2024-08-27  1:34   ` Thinh Nguyen
2024-08-14 10:35 ` [PATCH 09/11] usb: dwc3: rtk: use scoped device node handling to simplify error paths Krzysztof Kozlowski
2024-08-27  1:43   ` Thinh Nguyen
2024-08-14 10:35 ` [PATCH 10/11] usb: dwc3: rtk: return directly and simplify with devm_platform_ioremap_resource Krzysztof Kozlowski
2024-08-27  1:44   ` Thinh Nguyen
2024-08-14 10:35 ` [PATCH 11/11] usb: dwc3: xilinx: simplify with dev_err_probe Krzysztof Kozlowski
2024-08-27  1:45   ` Thinh Nguyen
2024-08-27  1:59 ` [PATCH 00/11] usb: dwc3: various cleanups Thinh Nguyen
2024-08-27  9:36   ` Krzysztof Kozlowski
2024-08-28  2:08     ` Thinh Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240827012651.j2chqblkjha2vene@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox