Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2336390ybb; Sat, 30 Mar 2019 02:31:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+h+rbc+xxL94eAVEv7y2q7h2tIL3C+NIBXyNU4i/KmaZpcd6BF65Nwpp9k9bSw67NvqUj X-Received: by 2002:a17:902:5c5:: with SMTP id f63mr50142986plf.64.1553938284334; Sat, 30 Mar 2019 02:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553938284; cv=none; d=google.com; s=arc-20160816; b=m2v7oV4kckTc6+g70/prCsGD+DMYUu2WDenyz/1dBj66ufKZCe/MIy5ryjNEbpS705 CqYieiId+rErVMd1eKMT+FEHbYJ55S91hPnRnzAvr9VeRC1+KRmclvBiuPXQmj9C1MQ4 3Sl09Bj49mu5rQCm+/MtXZIvX8PLj0mvsPQPYKqeiCHX2RLa09x45rLPqq5U+Wseqh9B NO0Twyns4UKpsRu2YxsadCL8R+YGQcXiQf+LC0/FrTv873uCe/j8hQGn9QEOI7Gu4lFZ DYRKgK3RrCUghbmjDMKF1WfkYfs+/5sOXmuJhHlAUj8VJPCJZh66AbOhxTjaik2A7pUK ULXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=saWwJFX3b4pLraSutLfYCJBCYtN8jMrZ0ybmwK7A3Fc=; b=A23OiKA5WW89YL+eLfsNEd8iKhxdUNn0jBHr3ty3nBhcPI9Tin0NjcZJLTX495NU+Y i5AtAhCv/xTfLWlUPnZkcWZahN049RE7MUeRsxNu+63qbxMPv5fNWHVuFQk5OcxtCa1A ZRec+4+NCz62ocAj4BSyL7MZl0CnNKQaK31Y0SDE+Ohutt/3VZj9Imvm3MXgaRl3egbB JlQO5IgwxDvPK4eQ0pkcPTYPyEFGDpuSWcjbmMEKVSzsk9LN7sB1H2DcJncDIgvvBC0u rAp2igFGDtemq8l46yoDPzd8t1qBmDa8F4PO4M4sGbFUqPSAAif06xoJ3OxwCZnBpaV/ OvbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i13si3837839pgs.33.2019.03.30.02.31.09; Sat, 30 Mar 2019 02:31:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730474AbfC3J2h (ORCPT + 99 others); Sat, 30 Mar 2019 05:28:37 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:9041 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730372AbfC3J2g (ORCPT ); Sat, 30 Mar 2019 05:28:36 -0400 X-UUID: 712d86b331d64b4e9543c03c4b6dce91-20190330 X-UUID: 712d86b331d64b4e9543c03c4b6dce91-20190330 Received: from mtkcas34.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1572047254; Sat, 30 Mar 2019 17:28:31 +0800 Received: from mtkcas09.mediatek.inc (172.21.101.178) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 30 Mar 2019 17:28:29 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sat, 30 Mar 2019 17:28:29 +0800 From: Chunfeng Yun To: Greg Kroah-Hartman CC: Matthias Brugger , Chunfeng Yun , , , , Subject: [PATCH 1/5] usb: xhci-mtk: get optional clock by devm_clk_get_optional() Date: Sat, 30 Mar 2019 17:28:16 +0800 Message-ID: <2ec86ffd7de45dabaa7257019a79f1e80751934c.1553937592.git.chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use devm_clk_get_optional() to get optional clock Signed-off-by: Chunfeng Yun --- 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