linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4] phy: qualcomm: phy-qcom-apq8064-sata: Convert to devm_clk_get_enabled()
@ 2024-08-22  8:44 Yangtao Li
  2024-08-29  8:08 ` Dmitry Baryshkov
  2024-08-29 17:49 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Yangtao Li @ 2024-08-22  8:44 UTC (permalink / raw)
  To: vkoul, kishon, krzk, alim.akhtar, frank.li, konrad.dybcio,
	liubo03, robh, yuvaraj.cd, ks.giri, vasanth.a
  Cc: linux-arm-msm, linux-phy, linux-kernel, linux-arm-kernel,
	linux-samsung-soc

Convert devm_clk_get(), clk_prepare_enable() to a single
call to devm_clk_get_enabled(), as this is exactly
what this function does.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 drivers/phy/qualcomm/phy-qcom-apq8064-sata.c | 22 ++++----------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c b/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c
index 3642a5d4f2f3..18c0dbd8e707 100644
--- a/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c
+++ b/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c
@@ -68,7 +68,6 @@
 
 struct qcom_apq8064_sata_phy {
 	void __iomem *mmio;
-	struct clk *cfg_clk;
 	struct device *dev;
 };
 
@@ -203,7 +202,7 @@ static int qcom_apq8064_sata_phy_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct phy_provider *phy_provider;
 	struct phy *generic_phy;
-	int ret;
+	struct clk *cfg_clk;
 
 	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
 	if (!phy)
@@ -223,19 +222,14 @@ static int qcom_apq8064_sata_phy_probe(struct platform_device *pdev)
 	phy_set_drvdata(generic_phy, phy);
 	platform_set_drvdata(pdev, phy);
 
-	phy->cfg_clk = devm_clk_get(dev, "cfg");
-	if (IS_ERR(phy->cfg_clk)) {
+	cfg_clk = devm_clk_get_enabled(dev, "cfg");
+	if (IS_ERR(cfg_clk)) {
 		dev_err(dev, "Failed to get sata cfg clock\n");
-		return PTR_ERR(phy->cfg_clk);
+		return PTR_ERR(cfg_clk);
 	}
 
-	ret = clk_prepare_enable(phy->cfg_clk);
-	if (ret)
-		return ret;
-
 	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
 	if (IS_ERR(phy_provider)) {
-		clk_disable_unprepare(phy->cfg_clk);
 		dev_err(dev, "%s: failed to register phy\n", __func__);
 		return PTR_ERR(phy_provider);
 	}
@@ -243,13 +237,6 @@ static int qcom_apq8064_sata_phy_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static void qcom_apq8064_sata_phy_remove(struct platform_device *pdev)
-{
-	struct qcom_apq8064_sata_phy *phy = platform_get_drvdata(pdev);
-
-	clk_disable_unprepare(phy->cfg_clk);
-}
-
 static const struct of_device_id qcom_apq8064_sata_phy_of_match[] = {
 	{ .compatible = "qcom,apq8064-sata-phy" },
 	{ },
@@ -258,7 +245,6 @@ MODULE_DEVICE_TABLE(of, qcom_apq8064_sata_phy_of_match);
 
 static struct platform_driver qcom_apq8064_sata_phy_driver = {
 	.probe	= qcom_apq8064_sata_phy_probe,
-	.remove_new = qcom_apq8064_sata_phy_remove,
 	.driver = {
 		.name	= "qcom-apq8064-sata-phy",
 		.of_match_table	= qcom_apq8064_sata_phy_of_match,
-- 
2.39.0



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

* Re: [PATCH 2/4] phy: qualcomm: phy-qcom-apq8064-sata: Convert to devm_clk_get_enabled()
  2024-08-22  8:44 [PATCH 2/4] phy: qualcomm: phy-qcom-apq8064-sata: Convert to devm_clk_get_enabled() Yangtao Li
@ 2024-08-29  8:08 ` Dmitry Baryshkov
  2024-08-29 17:49 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2024-08-29  8:08 UTC (permalink / raw)
  To: Yangtao Li
  Cc: vkoul, kishon, krzk, alim.akhtar, konrad.dybcio, liubo03, robh,
	yuvaraj.cd, ks.giri, vasanth.a, linux-arm-msm, linux-phy,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

On Thu, Aug 22, 2024 at 02:44:00AM GMT, Yangtao Li wrote:
> Convert devm_clk_get(), clk_prepare_enable() to a single
> call to devm_clk_get_enabled(), as this is exactly
> what this function does.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  drivers/phy/qualcomm/phy-qcom-apq8064-sata.c | 22 ++++----------------
>  1 file changed, 4 insertions(+), 18 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>


-- 
With best wishes
Dmitry


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

* Re: [PATCH 2/4] phy: qualcomm: phy-qcom-apq8064-sata: Convert to devm_clk_get_enabled()
  2024-08-22  8:44 [PATCH 2/4] phy: qualcomm: phy-qcom-apq8064-sata: Convert to devm_clk_get_enabled() Yangtao Li
  2024-08-29  8:08 ` Dmitry Baryshkov
@ 2024-08-29 17:49 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2024-08-29 17:49 UTC (permalink / raw)
  To: Yangtao Li
  Cc: kishon, krzk, alim.akhtar, konrad.dybcio, liubo03, robh,
	yuvaraj.cd, ks.giri, vasanth.a, linux-arm-msm, linux-phy,
	linux-kernel, linux-arm-kernel, linux-samsung-soc

On 22-08-24, 02:44, Yangtao Li wrote:
> Convert devm_clk_get(), clk_prepare_enable() to a single
> call to devm_clk_get_enabled(), as this is exactly
> what this function does.

Can you please resend this as a single thread. Threading is broken in
this series, I see 2, 3 patches, no idea where 1, 4 are...

> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  drivers/phy/qualcomm/phy-qcom-apq8064-sata.c | 22 ++++----------------
>  1 file changed, 4 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c b/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c
> index 3642a5d4f2f3..18c0dbd8e707 100644
> --- a/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c
> +++ b/drivers/phy/qualcomm/phy-qcom-apq8064-sata.c
> @@ -68,7 +68,6 @@
>  
>  struct qcom_apq8064_sata_phy {
>  	void __iomem *mmio;
> -	struct clk *cfg_clk;
>  	struct device *dev;
>  };
>  
> @@ -203,7 +202,7 @@ static int qcom_apq8064_sata_phy_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct phy_provider *phy_provider;
>  	struct phy *generic_phy;
> -	int ret;
> +	struct clk *cfg_clk;
>  
>  	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
>  	if (!phy)
> @@ -223,19 +222,14 @@ static int qcom_apq8064_sata_phy_probe(struct platform_device *pdev)
>  	phy_set_drvdata(generic_phy, phy);
>  	platform_set_drvdata(pdev, phy);
>  
> -	phy->cfg_clk = devm_clk_get(dev, "cfg");
> -	if (IS_ERR(phy->cfg_clk)) {
> +	cfg_clk = devm_clk_get_enabled(dev, "cfg");
> +	if (IS_ERR(cfg_clk)) {
>  		dev_err(dev, "Failed to get sata cfg clock\n");
> -		return PTR_ERR(phy->cfg_clk);
> +		return PTR_ERR(cfg_clk);
>  	}
>  
> -	ret = clk_prepare_enable(phy->cfg_clk);
> -	if (ret)
> -		return ret;
> -
>  	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
>  	if (IS_ERR(phy_provider)) {
> -		clk_disable_unprepare(phy->cfg_clk);
>  		dev_err(dev, "%s: failed to register phy\n", __func__);
>  		return PTR_ERR(phy_provider);
>  	}
> @@ -243,13 +237,6 @@ static int qcom_apq8064_sata_phy_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static void qcom_apq8064_sata_phy_remove(struct platform_device *pdev)
> -{
> -	struct qcom_apq8064_sata_phy *phy = platform_get_drvdata(pdev);
> -
> -	clk_disable_unprepare(phy->cfg_clk);
> -}
> -
>  static const struct of_device_id qcom_apq8064_sata_phy_of_match[] = {
>  	{ .compatible = "qcom,apq8064-sata-phy" },
>  	{ },
> @@ -258,7 +245,6 @@ MODULE_DEVICE_TABLE(of, qcom_apq8064_sata_phy_of_match);
>  
>  static struct platform_driver qcom_apq8064_sata_phy_driver = {
>  	.probe	= qcom_apq8064_sata_phy_probe,
> -	.remove_new = qcom_apq8064_sata_phy_remove,
>  	.driver = {
>  		.name	= "qcom-apq8064-sata-phy",
>  		.of_match_table	= qcom_apq8064_sata_phy_of_match,
> -- 
> 2.39.0

-- 
~Vinod


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

end of thread, other threads:[~2024-08-29 17:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22  8:44 [PATCH 2/4] phy: qualcomm: phy-qcom-apq8064-sata: Convert to devm_clk_get_enabled() Yangtao Li
2024-08-29  8:08 ` Dmitry Baryshkov
2024-08-29 17:49 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).