From patchwork Sat Mar 30 09:40:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 10878237 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 17F251390 for ; Sat, 30 Mar 2019 09:40:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3EF2290F2 for ; Sat, 30 Mar 2019 09:40:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E890A29104; Sat, 30 Mar 2019 09:40:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E1C8290F2 for ; Sat, 30 Mar 2019 09:40:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730438AbfC3Jkl (ORCPT ); Sat, 30 Mar 2019 05:40:41 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:11264 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730352AbfC3Jkl (ORCPT ); Sat, 30 Mar 2019 05:40:41 -0400 X-UUID: ddb145fcc7f04df395684655b3a82732-20190330 X-UUID: ddb145fcc7f04df395684655b3a82732-20190330 Received: from mtkcas32.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1398553601; Sat, 30 Mar 2019 17:40:29 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 30 Mar 2019 17:40:28 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sat, 30 Mar 2019 17:40:27 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman CC: Matthias Brugger , Chunfeng Yun , , , Subject: [next PATCH] usb: mtu3: get optional clock by devm_clk_get_optional() Date: Sat, 30 Mar 2019 17:40:18 +0800 Message-ID: <1553938818-9883-1-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use devm_clk_get_optional() to get optional clock Signed-off-by: Chunfeng Yun --- 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 dca8bd864e63..fd0f6c5dfbc1 100644 --- a/drivers/usb/mtu3/mtu3_plat.c +++ b/drivers/usb/mtu3/mtu3_plat.c @@ -211,19 +211,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);