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: 165994 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp9012367ili; Thu, 6 Jun 2019 09:31:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwN9gxQ6kBrZfNnXj5/hjmTkaFMji+43xrq49HNxIKMPhukm8UbchnhV06izimt3pdXsrai X-Received: by 2002:a17:902:2a28:: with SMTP id i37mr49920037plb.52.1559838683118; Thu, 06 Jun 2019 09:31:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559838683; cv=none; d=google.com; s=arc-20160816; b=yf8hmt7BxYR2LbCjs9ODy90+LWOwGcl+XbSIHRtLYZC0J9BSFhEUxf3yAvMOcXzBIM GgZse0Qf+Uu+WBhzJjzEvKiOqCZbau8tY7qV5S7ZJZwB2Lc/0/YJJvKHj9JBvle90926 LUKrgqRgsHFQwd3B4rgVtHGLAedECTFQ5LOK/rs9GzFAq1OC24ueHfNfMJgQm3eQM8aA nVdKxTlVE4dTvOo1zHjy+2bNvw4BGe+qHvPfrAjIcWNk8f7jFei5LgX/fAZ+mlJvZOuh rCRptIAZ74DdyGKvpWCKSpthHO3+JLHcv4I02npIqrZ+EZQy97ayIuohgfdyI0LES9F2 EaIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=PTDnNRZC/L29QrENOY3N0wHK7ufCtG4xEHtYz7D28GU=; b=ORPxa5ZgWUrsQJKi0M6+CrTBsV0wa54g0NMETiFDDpkD8q1ZqZe6v9iIoAfI0XugC8 IsjeASuTHfjfPgH+1Ix2++rZMgOUG/kKbDL8AN1fSNEV6uOTRvBrd53raz0EEOtOZsOh a0eIobOfk7B71GxVMIenDPduD5NJhbwYjcfkp5jqTAiLlP1XS24TeGujEv1rV6VkJLmG GRDesD6fAOMAJsM57VZ7uiIxyOVuN8AdnOCoQF3WC0urlN+OJTgJyoc3zrBcaQvr5GRj mIskpBEB2A5Btnazv2GFqom+j4o0QX6JNBwuZCHEqvlhx9nF9aSBp5nlAdeDu+2U5IGy XVxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=dy3uhPNu; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id h11si2356250pgq.170.2019.06.06.09.31.22; Thu, 06 Jun 2019 09:31:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=dy3uhPNu; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 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 S1729720AbfFFQbW (ORCPT + 8 others); Thu, 6 Jun 2019 12:31:22 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:50170 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726719AbfFFQbW (ORCPT ); Thu, 6 Jun 2019 12:31:22 -0400 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 CC: Sekhar Nori , Murali Karicheri , Wingman Kwok , , , , , Grygorii Strashko 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 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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(-) -- 2.17.1 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); }