linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] usb: xhci-mtk: get optional clock by devm_clk_get_optional()
@ 2019-03-30  9:28 Chunfeng Yun
  2019-03-30  9:28 ` [PATCH 2/5] usb: host: xhci-plat: " Chunfeng Yun
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Chunfeng Yun @ 2019-03-30  9:28 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Matthias Brugger, Chunfeng Yun, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek

Use devm_clk_get_optional() to get optional clock

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci-mtk.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 60987c787e44..026fe18972d3 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -206,19 +206,6 @@ static int xhci_mtk_ssusb_config(struct xhci_hcd_mtk *mtk)
 	return xhci_mtk_host_enable(mtk);
 }
 
-/* ignore the error if the clock does not exist */
-static struct clk *optional_clk_get(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 xhci_mtk_clks_get(struct xhci_hcd_mtk *mtk)
 {
 	struct device *dev = mtk->dev;
@@ -229,15 +216,15 @@ static int xhci_mtk_clks_get(struct xhci_hcd_mtk *mtk)
 		return PTR_ERR(mtk->sys_clk);
 	}
 
-	mtk->ref_clk = optional_clk_get(dev, "ref_ck");
+	mtk->ref_clk = devm_clk_get_optional(dev, "ref_ck");
 	if (IS_ERR(mtk->ref_clk))
 		return PTR_ERR(mtk->ref_clk);
 
-	mtk->mcu_clk = optional_clk_get(dev, "mcu_ck");
+	mtk->mcu_clk = devm_clk_get_optional(dev, "mcu_ck");
 	if (IS_ERR(mtk->mcu_clk))
 		return PTR_ERR(mtk->mcu_clk);
 
-	mtk->dma_clk = optional_clk_get(dev, "dma_ck");
+	mtk->dma_clk = devm_clk_get_optional(dev, "dma_ck");
 	return PTR_ERR_OR_ZERO(mtk->dma_clk);
 }
 
-- 
2.20.1


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

end of thread, other threads:[~2019-04-04  7:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-30  9:28 [PATCH 1/5] usb: xhci-mtk: get optional clock by devm_clk_get_optional() Chunfeng Yun
2019-03-30  9:28 ` [PATCH 2/5] usb: host: xhci-plat: " Chunfeng Yun
2019-03-30  9:28 ` [PATCH 3/5] usb: misc: usb3503: " Chunfeng Yun
2019-03-30  9:28 ` [PATCH 4/5] usb: dwc2: " Chunfeng Yun
2019-04-01  8:47   ` Minas Harutyunyan
2019-03-30  9:28 ` [PATCH 5/5] usb: chipidea: msm: " Chunfeng Yun
2019-04-04  7:28   ` Peter Chen

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).