Received: by 10.223.185.116 with SMTP id b49csp2634790wrg; Mon, 12 Feb 2018 13:04:01 -0800 (PST) X-Google-Smtp-Source: AH8x225HWFfomsd1FSKCHS+i1+zXTDQR6A5h2HZ+Z6TxJQmhSIgwx/Y/w+NgIP2n5HHzzudT5ygE X-Received: by 2002:a17:902:8544:: with SMTP id d4-v6mr12090982plo.312.1518469441232; Mon, 12 Feb 2018 13:04:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518469441; cv=none; d=google.com; s=arc-20160816; b=u/RJ1qHRA55iI6Dzl/RgXb+n8eQnRsA5thMaY14PR5tInfGeCTQuTLjJntqFkPFAUy 5ZVqIhm2SsTPjkfqxxH3yMxiWk3xRc55AERo9Ezp4xWzoCKPvU66MPu7srr8bSBulBEO grmieyzZNuBQCLKD6nBXmomp95H5uECzPIewlw3vVa9QYwRc3ApNYKykPwadH1XHoo0T IrqDZEhnDn1Z4jKdoJ7KF0/RGks44dCZxUBZ6OoxhYwmWKNXfuvHwmpw8GDcVLgYduGI J2qB58FLt3ado3pk1eS25uTVZKrr4TVmm8Li1qnGkEPjf9QfG7BKmUN8A9/ew/aXGTLG Ibgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=bk1oRjEEsmhI3w78FliE6zN5CWhzhJF6+vdFzlptXDo=; b=TfjHp9pkBcxxIeNxG2cmwR1YKv+tuFvBV/A0/o26HTouy+rDyFA3ClKyE9bvZvT9Xl Tm+7kcdyTv8oDkYiN/KN/ZXWBJ8j8iLBqqRTCMjzRzndu7LGejWUwRv7+5mLTeY5GJ6B oAPm1fx5eXfcOEn3nISGCZMshUgPcvoNhAPL9Z7V8CYAkX+FSkjYcjtESisD0we7RO4i iApRG6BxyUwRpWFEItGylL8EtXsa15owooNT2PQAn/tf9hCBo0+5PGOkuADGPcjUv/UF w0waL+c23NzivqEMHVDDrfC6AaNSVFEK4OgPr1X6dvmSOb+XHxxGvd4O/z8uLP5ONVte REtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=RpmWFQIz; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c9-v6si789528pli.257.2018.02.12.13.03.46; Mon, 12 Feb 2018 13:04:01 -0800 (PST) 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=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=RpmWFQIz; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754157AbeBLVBG (ORCPT + 99 others); Mon, 12 Feb 2018 16:01:06 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:57622 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753817AbeBLVBF (ORCPT ); Mon, 12 Feb 2018 16:01:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=bk1oRjEEsmhI3w78FliE6zN5CWhzhJF6+vdFzlptXDo=; b=RpmWFQIzT564qN7qjeZzqbrcui6ldhlFa4mRJ3G3Am/rR/97qH4t6vyJzxKKz9QaIXknyYjA8DU44X7Av067/ZKCc+6/XvwdNeLfBIFTBG1+AAslRUrihkCbRYvyTOsB6AHu+Xzhc/Mi9UvRm5sczzL1FnUPJJSswtItoj7I5rg=; Received: from n2100.armlinux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:39403) by pandora.armlinux.org.uk with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1elLDd-00064X-09; Mon, 12 Feb 2018 21:00:57 +0000 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.76) (envelope-from ) id 1elLDZ-0004DO-Mt; Mon, 12 Feb 2018 21:00:53 +0000 Date: Mon, 12 Feb 2018 21:00:53 +0000 From: Russell King - ARM Linux To: David Lechner Cc: Bartosz Golaszewski , Bartosz Golaszewski , Sekhar Nori , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman Subject: Re: [PATCH] clk: don't call __of_clk_get_by_name() unnecessarily from clk_get() Message-ID: <20180212210053.GO9418@n2100.armlinux.org.uk> References: <20180212142439.15885-1-brgl@bgdev.pl> <36b4b8a0-0254-c6fa-c84f-ceab20c326ad@lechnology.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <36b4b8a0-0254-c6fa-c84f-ceab20c326ad@lechnology.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 12, 2018 at 02:51:57PM -0600, David Lechner wrote: > On 02/12/2018 08:24 AM, Bartosz Golaszewski wrote: > >From: Bartosz Golaszewski > > > >The way this function is implemented caused some confusion when > >converting the TI DaVinci platform to using the common clock framework. > > > >Current kernel supports booting DaVinci boards both in device tree as > >well as legacy, board-file mode. In the latter, we always end up > >calling clk_get_sys() as of_node is NULL and __of_clk_get_by_name() > >returns -ENOENT. > > > >It was not obvious at first glance how clk_get(dev, NULL) will work in > >board-file mode since we always call __of_clk_get_by_name(). Let's make > >it clearer by checking if of_node is NULL and skipping right to > >clk_get_sys(). > > > >Cc: Sekhar Nori > >Cc: Kevin Hilman > >Cc: David Lechner > >Signed-off-by: Bartosz Golaszewski > >--- > > drivers/clk/clkdev.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > >diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c > >index 7513411140b6..f394e8964909 100644 > >--- a/drivers/clk/clkdev.c > >+++ b/drivers/clk/clkdev.c > >@@ -199,7 +199,7 @@ struct clk *clk_get(struct device *dev, const char *con_id) > > const char *dev_id = dev ? dev_name(dev) : NULL; > > struct clk *clk; > >- if (dev) { > >+ if (dev && dev->of_node) { > > clk = __of_clk_get_by_name(dev->of_node, dev_id, con_id); > > if (!IS_ERR(clk) || PTR_ERR(clk) == -EPROBE_DEFER) > > return clk; > > > > Shouldn't you be sending this to the linux-clk mailing list and cc'ing > the clock maintainers? No, I'm the maintainer for clkdev, as per MAINTAINERS. > FWIW, it seems pretty clear to me that if we are using a board file > then we should expect clk_get_sys() to be called because there is > no device tree. clk_get() pre-dates DT, and using it has no bearing on whether DT is in use or not. The above change looks correct to me - if the struct device is not a DT device, then we shouldn't be trying to look up the clock in DT. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up