Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp6471579pxu; Thu, 24 Dec 2020 03:20:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQ4G9shIoGwAQ6eOYXbK/HFRdoNJr77zYZlV/q5qgvFehjkg+kLMqOSNB9JgW7V+GCfjp7 X-Received: by 2002:a05:6402:1748:: with SMTP id v8mr28720173edx.136.1608808814363; Thu, 24 Dec 2020 03:20:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608808814; cv=none; d=google.com; s=arc-20160816; b=dxBPdH7J5ERp4JJNrAHD7xA1tkZ19voOaJd15XdMGmk0EQaP5AqdE86w1lK2he9WU+ t19w3mI/E7y7XtAZJdDbXTB8Rd+cErQvWQa81sOjWoN+JpzKwNzea6uNBJRbBcAv9t/V aT+cTTeqEiFPydexTBtdx8hulg0SMskGY31mi+uOWjTnL/53pE7QT4TUtDmDaWNLM3RI PiDOtUEyl1wDbwLiZy5b52KgbVudjpbqXS5tseHxVECVENsgZl1XwNyRTRFZB4W77GZ6 HmwgQdOEp/HVCIO5E9bc4uwW/CMq+4E5NsV5nHq4UCdBQIjUP4ETfZy0sK4pHZQVZjVJ Ap5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=1m1jaw1QKhWt1my5TiZgSyHmcvod41lJIai7xVZR3M8=; b=RdCHRsz8PA/WlRNrunuwFaeJCgKEI8JqxtxDbK/JxY0cI+uS4C9iIWPRrN4Mquftq5 X8MYT2Nm3+RpD+8Dc5mlTMhWi51oXGQopr/+jaCEPbC+n9AA1hvrlJ4Cm0pN/cAkD2o7 8ME786iGIqgd3wf1Z+mHLOYam4F+iupEKETbSHOhGAp29WiRRf53n7kx0I7Sqcahy4Cs u7XcPrGAI4uiOMuDW02z471JPFqgVcNrIHHDvjKy+08HrvlGpmWPjoipZhjhehOd5H7v WTZ6Cz0oIV58G8xtMs0eWvyEJfl0Nd8K22pwN1OzRLHS2CPcPNyP65sz+GW6wFziCAdf /qXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cEibqEjQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m14si10083137ejj.422.2020.12.24.03.19.52; Thu, 24 Dec 2020 03:20:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cEibqEjQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728779AbgLXLSv (ORCPT + 99 others); Thu, 24 Dec 2020 06:18:51 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:35640 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728114AbgLXLSu (ORCPT ); Thu, 24 Dec 2020 06:18:50 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0BOBH9Uw076183; Thu, 24 Dec 2020 05:17:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1608808629; bh=1m1jaw1QKhWt1my5TiZgSyHmcvod41lJIai7xVZR3M8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=cEibqEjQraJ7+w4VekW7WSpX5ZurAcvq2zKqU+iCU89UhhQabxm9qsK3PEq99J9w+ 722vlx6Hk7u1c2JBpoP6yXkLKoywGMWKNLLjm1af/N/p7G6aF6LnU6oU9P2gzQigCQ I+lJTH9gy8xSb6cNscQj4uVnMfm4MNBQrGGnhFOY= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0BOBH9gU098731 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 24 Dec 2020 05:17:09 -0600 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Thu, 24 Dec 2020 05:17:08 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Thu, 24 Dec 2020 05:17:08 -0600 Received: from a0393678-ssd.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0BOBGWGC116630; Thu, 24 Dec 2020 05:17:05 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Nishanth Menon , Philipp Zabel CC: , , Subject: [PATCH v3 06/15] phy: cadence: cadence-sierra: Move all clk_get_*() to a separate function Date: Thu, 24 Dec 2020 16:46:18 +0530 Message-ID: <20201224111627.32590-7-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201224111627.32590-1-kishon@ti.com> References: <20201224111627.32590-1-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No functional change. Group all devm_clk_get_optional() to a separate function. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 57 +++++++++++++++--------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index f7ba0ed416bc..7bf1b4c7774a 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -477,6 +477,38 @@ static int cdns_regmap_init_blocks(struct cdns_sierra_phy *sp, return 0; } +static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, + struct device *dev) +{ + struct clk *clk; + int ret; + + clk = devm_clk_get_optional(dev, "phy_clk"); + if (IS_ERR(clk)) { + dev_err(dev, "failed to get clock phy_clk\n"); + return PTR_ERR(clk); + } + sp->clk = clk; + + clk = devm_clk_get_optional(dev, "cmn_refclk_dig_div"); + if (IS_ERR(clk)) { + dev_err(dev, "cmn_refclk_dig_div clock not found\n"); + ret = PTR_ERR(clk); + return ret; + } + sp->cmn_refclk_dig_div = clk; + + clk = devm_clk_get_optional(dev, "cmn_refclk1_dig_div"); + if (IS_ERR(clk)) { + dev_err(dev, "cmn_refclk1_dig_div clock not found\n"); + ret = PTR_ERR(clk); + return ret; + } + sp->cmn_refclk1_dig_div = clk; + + return 0; +} + static int cdns_sierra_phy_probe(struct platform_device *pdev) { struct cdns_sierra_phy *sp; @@ -487,7 +519,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) unsigned int id_value; int i, ret, node = 0; void __iomem *base; - struct clk *clk; struct device_node *dn = dev->of_node, *child; if (of_get_child_count(dn) == 0) @@ -524,11 +555,9 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) platform_set_drvdata(pdev, sp); - sp->clk = devm_clk_get_optional(dev, "phy_clk"); - if (IS_ERR(sp->clk)) { - dev_err(dev, "failed to get clock phy_clk\n"); - return PTR_ERR(sp->clk); - } + ret = cdns_sierra_phy_get_clocks(sp, dev); + if (ret) + return ret; sp->phy_rst = devm_reset_control_get(dev, "sierra_reset"); if (IS_ERR(sp->phy_rst)) { @@ -542,22 +571,6 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) return PTR_ERR(sp->apb_rst); } - clk = devm_clk_get_optional(dev, "cmn_refclk_dig_div"); - if (IS_ERR(clk)) { - dev_err(dev, "cmn_refclk_dig_div clock not found\n"); - ret = PTR_ERR(clk); - return ret; - } - sp->cmn_refclk_dig_div = clk; - - clk = devm_clk_get_optional(dev, "cmn_refclk1_dig_div"); - if (IS_ERR(clk)) { - dev_err(dev, "cmn_refclk1_dig_div clock not found\n"); - ret = PTR_ERR(clk); - return ret; - } - sp->cmn_refclk1_dig_div = clk; - ret = clk_prepare_enable(sp->clk); if (ret) return ret; -- 2.17.1