From patchwork Sat Jun 1 10:45:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 165566 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1969735ili; Sat, 1 Jun 2019 03:46:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxF4LOQ1MrUqMB4Xba2hoFaotn+LjvBlqS4JdceOr3hju3KAiDu2LYXKRtIfFbJ5bYs7DF X-Received: by 2002:aa7:864e:: with SMTP id a14mr16389172pfo.132.1559385966636; Sat, 01 Jun 2019 03:46:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559385966; cv=none; d=google.com; s=arc-20160816; b=o2YJ9WQjJM6IdzY/3YgpUk47Rlcx7h+/hlVjkCjvMR5fxYkJl6DyX5dJ69ShvgD2jP PObAluUujZ3p736G+DjQYyYXNIiFIiPp177qW0ecEBn+JXIcslmuE5ABwSmLrF6AOYEb QVKya1za9uAHk3Z5+EpWhDbHmsm8EbTIqQIwzrkWqfeG8awWQvSMLfdFq4s5w39qj2Xj X0i+OWN3vrb9/Vm5UYeXCCKvAqmjd0wcqeI6G6VfiPvkpFqE0icg6iO0r4kzsnoCKwjk LzESh2mG5C2KN9l9Vh3jYM8T+doao5UZDquldUUYHLfFLNLiLgsWOdimhk7i341RO7a6 pvRA== 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=L7uklZmMbV0m9TN5brUsgpv6/7OEksAfjjG7mTgS2po=; b=kQ01JOlMUYNZP4RrlDo0hy9qBL96Y8HOpDIwqq4sZgX3+AcMNZmSJu58x2Vjtxra9G TmYAv3rLt2X7MMEPgpFnP4XOJWR2Frehy3b3CKGOT6mpeO9LyCUggV20HJ4OlCP45JGC NqTz+k9UJ3WiZ8nxuG3JMvaKHQc0PvCKrfq9y7GSkIzoWSmw94y9agaVl30pK5VB1oVW iGmemRSjabzyBLPoDvj1lCZ5TlH4IIlkH3GOov4QHAUkQv4rl6OJzgAHcXhAdGtU5WTD EKCwGE8SeVyyI4R6YYITYMcrPdMIb6kAVL7p9m5zsVMWpcX75t1tVQKFgfN1+6JokkMT qRkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zUlLODtl; 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; 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 j19si11144868pfd.189.2019.06.01.03.46.06; Sat, 01 Jun 2019 03:46:06 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zUlLODtl; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727221AbfFAKqF (ORCPT + 30 others); Sat, 1 Jun 2019 06:46:05 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:43796 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726089AbfFAKqD (ORCPT ); Sat, 1 Jun 2019 06:46:03 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x51AjxK0017225; Sat, 1 Jun 2019 05:45:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1559385959; bh=L7uklZmMbV0m9TN5brUsgpv6/7OEksAfjjG7mTgS2po=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=zUlLODtlwrtkBzEg1UaoQcBZkx1PSOlplIMd92dinK+oFyttTDAESpgBnPHFimpBn 9wjDPfpSMdqhEwyxVXIuPOapty7euJdaJ8SW9yVNDvOPpoJmNyKb5aCS4oS5gHnjns 19X8ga1D0laiY53jnEZk1paKpC9urIkpDVper4N0= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x51Ajwwt022721 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 1 Jun 2019 05:45:59 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Sat, 1 Jun 2019 05:45:58 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE101.ent.ti.com (157.170.170.31) 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; Sat, 1 Jun 2019 05:45:58 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x51AjvrX127852; Sat, 1 Jun 2019 05:45:58 -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 02/10] net: ethernet: ti: cpts: use devm_get_clk_from_child Date: Sat, 1 Jun 2019 13:45:26 +0300 Message-ID: <20190601104534.25790-3-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190601104534.25790-1-grygorii.strashko@ti.com> References: <20190601104534.25790-1-grygorii.strashko@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- 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); }