diff mbox series

[v2,4/4] phy: phy-meson-gxl-usb2: get optional clock by devm_clk_get_optional()

Message ID 9f04a619e8a2cc44f5b1fe299a08f237f069d56d.1554874961.git.chunfeng.yun@mediatek.com (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show
Series [v2,1/4] phy: phy-mtk-tphy: get optional clock by devm_clk_get_optional() | expand

Commit Message

Chunfeng Yun (云春峰) April 10, 2019, 6:13 a.m. UTC
Use devm_clk_get_optional() to get optional clock

Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
v2: add Acked-by Martin Blumenstingl
---
 drivers/phy/amlogic/phy-meson-gxl-usb2.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Jerome Brunet April 10, 2019, 8:18 a.m. UTC | #1
On Wed, 2019-04-10 at 14:13 +0800, Chunfeng Yun wrote:
> Use devm_clk_get_optional() to get optional clock
> 
> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Reviewed-by: Jerome Brunet <jbrunet@baylibre.com>

> ---
> v2: add Acked-by Martin Blumenstingl
> ---
>  drivers/phy/amlogic/phy-meson-gxl-usb2.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/phy/amlogic/phy-meson-gxl-usb2.c b/drivers/phy/amlogic/phy-meson-gxl-usb2.c
> index 148ef0bdb9c1..4cbee412f2b0 100644
> --- a/drivers/phy/amlogic/phy-meson-gxl-usb2.c
> +++ b/drivers/phy/amlogic/phy-meson-gxl-usb2.c
> @@ -261,14 +261,9 @@ static int phy_meson_gxl_usb2_probe(struct platform_device *pdev)
>  	if (IS_ERR(priv->regmap))
>  		return PTR_ERR(priv->regmap);
>  
> -	priv->clk = devm_clk_get(dev, "phy");
> -	if (IS_ERR(priv->clk)) {
> -		ret = PTR_ERR(priv->clk);
> -		if (ret == -ENOENT)
> -			priv->clk = NULL;
> -		else
> -			return ret;
> -	}
> +	priv->clk = devm_clk_get_optional(dev, "phy");
> +	if (IS_ERR(priv->clk))
> +		return PTR_ERR(priv->clk);
>  
>  	priv->reset = devm_reset_control_get_optional_shared(dev, "phy");
>  	if (IS_ERR(priv->reset))
Martin Blumenstingl April 10, 2019, 5:59 p.m. UTC | #2
On Wed, Apr 10, 2019 at 8:13 AM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
>
> Use devm_clk_get_optional() to get optional clock
>
> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
now also:
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
(on my Khadas VIM by manually adjusting meson-gxl.dtsi and dropping
the clocks in usb2_phy0 and usb2_phy1)
Chunfeng Yun (云春峰) April 11, 2019, 1:04 a.m. UTC | #3
On Wed, 2019-04-10 at 19:59 +0200, Martin Blumenstingl wrote:
> On Wed, Apr 10, 2019 at 8:13 AM Chunfeng Yun <chunfeng.yun@mediatek.com> wrote:
> >
> > Use devm_clk_get_optional() to get optional clock
> >
> > Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> now also:
> Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> (on my Khadas VIM by manually adjusting meson-gxl.dtsi and dropping
> the clocks in usb2_phy0 and usb2_phy1)

Thank you:)
diff mbox series

Patch

diff --git a/drivers/phy/amlogic/phy-meson-gxl-usb2.c b/drivers/phy/amlogic/phy-meson-gxl-usb2.c
index 148ef0bdb9c1..4cbee412f2b0 100644
--- a/drivers/phy/amlogic/phy-meson-gxl-usb2.c
+++ b/drivers/phy/amlogic/phy-meson-gxl-usb2.c
@@ -261,14 +261,9 @@  static int phy_meson_gxl_usb2_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->regmap))
 		return PTR_ERR(priv->regmap);
 
-	priv->clk = devm_clk_get(dev, "phy");
-	if (IS_ERR(priv->clk)) {
-		ret = PTR_ERR(priv->clk);
-		if (ret == -ENOENT)
-			priv->clk = NULL;
-		else
-			return ret;
-	}
+	priv->clk = devm_clk_get_optional(dev, "phy");
+	if (IS_ERR(priv->clk))
+		return PTR_ERR(priv->clk);
 
 	priv->reset = devm_reset_control_get_optional_shared(dev, "phy");
 	if (IS_ERR(priv->reset))