diff mbox series

[v2,6/6] usb: mtu3: get optional clock by devm_clk_get_optional()

Message ID 147496a43bb93120bbd00a39668612c96e369691.1554877692.git.chunfeng.yun@mediatek.com (mailing list archive)
State Superseded
Commit 1567d661b90ff670b61bf0b8461afd2dac4a4b7c
Headers show
Series [v2,1/6] usb: xhci-mtk: get optional clock by devm_clk_get_optional() | expand

Commit Message

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

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2: new patch, merged into this series from
    https://patchwork.kernel.org/patch/10878235/
---
 drivers/usb/mtu3/mtu3_plat.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

Comments

Matthias Brugger April 12, 2019, 7:06 p.m. UTC | #1
On 10/04/2019 08:47, Chunfeng Yun wrote:
> Use devm_clk_get_optional() to get optional clock
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

> ---
> v2: new patch, merged into this series from
>     https://patchwork.kernel.org/patch/10878235/
> ---
>  drivers/usb/mtu3/mtu3_plat.c | 19 +++----------------
>  1 file changed, 3 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> index e086630e41a9..745a1da5c9c0 100644
> --- a/drivers/usb/mtu3/mtu3_plat.c
> +++ b/drivers/usb/mtu3/mtu3_plat.c
> @@ -210,19 +210,6 @@ static void ssusb_ip_sw_reset(struct ssusb_mtk *ssusb)
>  	mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
>  }
>  
> -/* ignore the error if the clock does not exist */
> -static struct clk *get_optional_clk(struct device *dev, const char *id)
> -{
> -	struct clk *opt_clk;
> -
> -	opt_clk = devm_clk_get(dev, id);
> -	/* ignore error number except EPROBE_DEFER */
> -	if (IS_ERR(opt_clk) && (PTR_ERR(opt_clk) != -EPROBE_DEFER))
> -		opt_clk = NULL;
> -
> -	return opt_clk;
> -}
> -
>  static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
>  {
>  	struct device_node *node = pdev->dev.of_node;
> @@ -245,15 +232,15 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
>  		return PTR_ERR(ssusb->sys_clk);
>  	}
>  
> -	ssusb->ref_clk = get_optional_clk(dev, "ref_ck");
> +	ssusb->ref_clk = devm_clk_get_optional(dev, "ref_ck");
>  	if (IS_ERR(ssusb->ref_clk))
>  		return PTR_ERR(ssusb->ref_clk);
>  
> -	ssusb->mcu_clk = get_optional_clk(dev, "mcu_ck");
> +	ssusb->mcu_clk = devm_clk_get_optional(dev, "mcu_ck");
>  	if (IS_ERR(ssusb->mcu_clk))
>  		return PTR_ERR(ssusb->mcu_clk);
>  
> -	ssusb->dma_clk = get_optional_clk(dev, "dma_ck");
> +	ssusb->dma_clk = devm_clk_get_optional(dev, "dma_ck");
>  	if (IS_ERR(ssusb->dma_clk))
>  		return PTR_ERR(ssusb->dma_clk);
>  
>
diff mbox series

Patch

diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index e086630e41a9..745a1da5c9c0 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -210,19 +210,6 @@  static void ssusb_ip_sw_reset(struct ssusb_mtk *ssusb)
 	mtu3_setbits(ssusb->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN);
 }
 
-/* ignore the error if the clock does not exist */
-static struct clk *get_optional_clk(struct device *dev, const char *id)
-{
-	struct clk *opt_clk;
-
-	opt_clk = devm_clk_get(dev, id);
-	/* ignore error number except EPROBE_DEFER */
-	if (IS_ERR(opt_clk) && (PTR_ERR(opt_clk) != -EPROBE_DEFER))
-		opt_clk = NULL;
-
-	return opt_clk;
-}
-
 static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
 {
 	struct device_node *node = pdev->dev.of_node;
@@ -245,15 +232,15 @@  static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
 		return PTR_ERR(ssusb->sys_clk);
 	}
 
-	ssusb->ref_clk = get_optional_clk(dev, "ref_ck");
+	ssusb->ref_clk = devm_clk_get_optional(dev, "ref_ck");
 	if (IS_ERR(ssusb->ref_clk))
 		return PTR_ERR(ssusb->ref_clk);
 
-	ssusb->mcu_clk = get_optional_clk(dev, "mcu_ck");
+	ssusb->mcu_clk = devm_clk_get_optional(dev, "mcu_ck");
 	if (IS_ERR(ssusb->mcu_clk))
 		return PTR_ERR(ssusb->mcu_clk);
 
-	ssusb->dma_clk = get_optional_clk(dev, "dma_ck");
+	ssusb->dma_clk = devm_clk_get_optional(dev, "dma_ck");
 	if (IS_ERR(ssusb->dma_clk))
 		return PTR_ERR(ssusb->dma_clk);