From patchwork Thu Jun 6 16:30:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 10980041 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 744B26C5 for ; Thu, 6 Jun 2019 16:31:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 630C8201CB for ; Thu, 6 Jun 2019 16:31:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6124428A6D; Thu, 6 Jun 2019 16:31:43 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 48B56201CB for ; Thu, 6 Jun 2019 16:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mfLxbmQoOyvpgnrJDIs4+G8MyLLhVlOlBWx/gOq23ew=; b=DyX1pccMFji5bH HS7f8WlKQaQ45GN5nqKUnLAoZdtAVE3QsNsn/P+7zEYjZyCF+BQ3Nl5uXvCGxFqAEcd+l+TpIGTQX Nv6KRkK2XlU4dkUTVg1acBgPgq+LA6wANy2H7BW2gPYoT5g+d4lchq3SYTi1R8OEpduIO4crtQsX8 i9f7zvKpy2OdwQ9t+eOUSDXFJgjQvKHuNrlAUu8wtv/6uitIWA65xX4pTHiCpHdoyz3c8XXZG6ZxW 91b83bJPY9DDeLbbZrJldH/f758n2xFx07gGk1PUcN8gLYu1gQ2QGX1snttN/3j/mSX0shEjuodnC 8gqzfaBn+F6gMr/pm2JA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hYvId-0007Wg-M5; Thu, 06 Jun 2019 16:31:35 +0000 Received: from fllv0015.ext.ti.com ([198.47.19.141]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hYvIJ-00074o-3H for linux-arm-kernel@lists.infradead.org; Thu, 06 Jun 2019 16:31:21 +0000 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x56GVCGC108085; Thu, 6 Jun 2019 11:31:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1559838672; bh=PTDnNRZC/L29QrENOY3N0wHK7ufCtG4xEHtYz7D28GU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dy3uhPNutNtocFNc+XovZubyTFV0Oe0+Gxcej6/pkXaRGa10nJDGjqoVCX8+YQHKW 5g1qVB3HV7YmiGYrzbg9/z2rLUi+IGAItNNzGDb+dZI8TGC8LqbEDYXRe/LpMGPP6+ hV6MFjdIQT8Y/yFwVJAuwuLvGRpqbNxPw/8BSPlM= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x56GVCFW006661 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 6 Jun 2019 11:31:12 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 6 Jun 2019 11:31:12 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 6 Jun 2019 11:31:12 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x56GVB1g052560; Thu, 6 Jun 2019 11:31:12 -0500 From: Grygorii Strashko To: "David S. Miller" , Santosh Shilimkar , Richard Cochran , Rob Herring Subject: [PATCH net-next v2 02/10] net: ethernet: ti: cpts: use devm_get_clk_from_child Date: Thu, 6 Jun 2019 19:30:39 +0300 Message-ID: <20190606163047.31199-3-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190606163047.31199-1-grygorii.strashko@ti.com> References: <20190606163047.31199-1-grygorii.strashko@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190606_093116_336551_AE176A5D X-CRM114-Status: GOOD ( 12.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Grygorii Strashko , Wingman Kwok , netdev@vger.kernel.org, Sekhar Nori , linux-kernel@vger.kernel.org, Murali Karicheri , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use devm_get_clk_from_child() instead of devm_clk_get() and this way allow to group CPTS DT properties in sub-node for better code readability and maintenance. Roll-back to devm_clk_get() if devm_get_clk_from_child() fails for backward compatibility. Signed-off-by: Grygorii Strashko Acked-by: Richard Cochran --- drivers/net/ethernet/ti/cpts.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index e257018ada71..0e79f9743c19 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c @@ -572,9 +572,14 @@ struct cpts *cpts_create(struct device *dev, void __iomem *regs, if (ret) return ERR_PTR(ret); - cpts->refclk = devm_clk_get(dev, "cpts"); + cpts->refclk = devm_get_clk_from_child(dev, node, "cpts"); + if (IS_ERR(cpts->refclk)) + /* try get clk from dev node for compatibility */ + cpts->refclk = devm_clk_get(dev, "cpts"); + if (IS_ERR(cpts->refclk)) { - dev_err(dev, "Failed to get cpts refclk\n"); + dev_err(dev, "Failed to get cpts refclk %ld\n", + PTR_ERR(cpts->refclk)); return ERR_CAST(cpts->refclk); }