From patchwork Tue Dec 22 07:05:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 346606 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp5095759jai; Mon, 21 Dec 2020 23:07:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJx78izOfJnBVWlk6XMNHFNXp6elUxwNMegRgEutDyXQqTsZs+mSfoqAPsXYtslARa7u7VYU X-Received: by 2002:a17:907:c29:: with SMTP id ga41mr11855676ejc.28.1608620871756; Mon, 21 Dec 2020 23:07:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608620871; cv=none; d=google.com; s=arc-20160816; b=q9rOfi2I59JMLVKCUsNdCUPjMa3YFnWLaXVyQ3UROXJ4dWV37U4MF3BGezTBbbSfRz pSSttn64XA9ATJ5M5kUG+VHBWKFfBVIgZuZg7gNDFxB6KZmQxX8+F0t9pFbY/ze9e6Sb 87uuC6i8z4Niwdwp3osSFwvlfoM0ahqmN0Yy6Q/O8sr3ThHPlWTen7b3clkJc2+WKtvn 8ab7KM0IKDMYcwy1x35pUgWMig4s0tQKjDziAsT0N0OUdOEV74DZL8pNPGMHAlxGYwXT Fiby9r6innoVJ8h3whx72tzLsl4jwo8je8ESKEkH+uFQScDGD+MWx4cl51qv1o2m8NJ3 i2ag== 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=+nl8LicT//augqm13+dqzPO4Zt/8O9Pq6Zxz1AFAlx0=; b=Hh/o0c7iKSfhH1iC+IblA59qbSoVaFzxCHQ6tJDVfT7DCbGTl0v4ECwWTb6GbEFqX5 mVbhzOJ+L9UnJQDKaQtjP4gRuQIm42IPdtuEiDCn9tHDXZP+NBQTxGsEuOK8YD87lDgp 1skAVY3MIo2Cdm9qeg+k+rQ4s2VWgh2kDEA+zxezgBA/f4SF4eVRPgz8avEgTiZNMJDn NgSEuT42drezC36KtG6wvWyJMbmSxzmFKcOBVxHJh5ltVudG8aVvxNox3Kdv8+YL1ooa dLHg/gykFN2Bt8Uuc5L5LJw1rK5CTaHvhFpuYpFYACCNvjh4BCukjfVXDslgeJVqoj3s +9wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=FCyNlspi; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 h4si1408831edf.490.2020.12.21.23.07.51; Mon, 21 Dec 2020 23:07:51 -0800 (PST) Received-SPF: pass (google.com: domain of devicetree-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=FCyNlspi; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S1726274AbgLVHGk (ORCPT + 7 others); Tue, 22 Dec 2020 02:06:40 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:53958 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726246AbgLVHGk (ORCPT ); Tue, 22 Dec 2020 02:06:40 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0BM75q5b064209; Tue, 22 Dec 2020 01:05:52 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1608620752; bh=+nl8LicT//augqm13+dqzPO4Zt/8O9Pq6Zxz1AFAlx0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=FCyNlspiaiecTPXXKhCqzUiTYG7F3pAupprbPJIGE8NiBpaaFn42DKOO7rZ2LzeKl yINXDv/qWE8EVv0O665zJqv1mCX0B1IBdWeTz8KJQrw5K73lLvCf+PV70gN7/nVBTw jxWgRzLjOJGF6EcKpgsi0+bdu4WIR5GVpFh/buCk= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0BM75qUn011420 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Dec 2020 01:05:52 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 22 Dec 2020 01:05:52 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE110.ent.ti.com (10.64.6.31) 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; Tue, 22 Dec 2020 01:05:52 -0600 Received: from a0393678-ssd.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0BM75N7G050344; Tue, 22 Dec 2020 01:05:48 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Swapnil Jakhade , , , CC: Nishanth Menon , Philipp Zabel Subject: [PATCH v2 07/14] phy: cadence: cadence-sierra: Move all reset_control_get*() to a separate function Date: Tue, 22 Dec 2020 12:35:13 +0530 Message-ID: <20201222070520.28132-8-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201222070520.28132-1-kishon@ti.com> References: <20201222070520.28132-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org No functional change. Group devm_reset_control_get() and devm_reset_control_get_optional() to a separate function. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/cadence/phy-cadence-sierra.c | 36 ++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index 7bf1b4c7774a..935f165404e4 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -509,6 +509,28 @@ static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp, return 0; } +static int cdns_sierra_phy_get_resets(struct cdns_sierra_phy *sp, + struct device *dev) +{ + struct reset_control *rst; + + rst = devm_reset_control_get(dev, "sierra_reset"); + if (IS_ERR(rst)) { + dev_err(dev, "failed to get reset\n"); + return PTR_ERR(rst); + } + sp->phy_rst = rst; + + rst = devm_reset_control_get_optional(dev, "sierra_apb"); + if (IS_ERR(rst)) { + dev_err(dev, "failed to get apb reset\n"); + return PTR_ERR(rst); + } + sp->apb_rst = rst; + + return 0; +} + static int cdns_sierra_phy_probe(struct platform_device *pdev) { struct cdns_sierra_phy *sp; @@ -559,17 +581,9 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) if (ret) return ret; - sp->phy_rst = devm_reset_control_get(dev, "sierra_reset"); - if (IS_ERR(sp->phy_rst)) { - dev_err(dev, "failed to get reset\n"); - return PTR_ERR(sp->phy_rst); - } - - sp->apb_rst = devm_reset_control_get_optional(dev, "sierra_apb"); - if (IS_ERR(sp->apb_rst)) { - dev_err(dev, "failed to get apb reset\n"); - return PTR_ERR(sp->apb_rst); - } + ret = cdns_sierra_phy_get_resets(sp, dev); + if (ret) + return ret; ret = clk_prepare_enable(sp->clk); if (ret)