Received: by 10.223.185.116 with SMTP id b49csp2649656wrg; Mon, 12 Feb 2018 13:20:30 -0800 (PST) X-Google-Smtp-Source: AH8x226OIsOFV1aVlmBrOO69RiiAFgyb6QhE+Wc+SRhjKKy4yYwlP/0wcL5vq53lvHyN8XfXP88+ X-Received: by 10.98.131.139 with SMTP id h133mr12816400pfe.155.1518470430041; Mon, 12 Feb 2018 13:20:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518470430; cv=none; d=google.com; s=arc-20160816; b=vmcZ0M2HSnAb2SDttJ6G03EkqZt7keq/83esB1pVSQLOf04Y1HsjWz0QX7GupdkMgv 54WBqCfiRed7sx7ajL8AfI58dVSxXcUmakbrg+m8gHsULfYU6Ekclp/6lUPg+ohtUzrZ +mCoI+ndWMmkJEm0bLR0jrLDd05LcWHIa2wBfafy5B8MCwOLyDeyzrOSTpoeUcO7ucBe PwOOKIECoFtsjIqWY07TIkLEgeKnRNpiuMepsuEW21OKIN+vFA/O2k5StUt4F9y222eh JuYSq//DmBiQMBy+IGGvbnge6k8q3GBILboAf0tp2+iin6/TAyiQCv44jmvJS2AZKMas MJAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=tNJs/bKGYWaecN0psa2HolQCs0o1M5+2tjGuItVY2/4=; b=vlugRn5g+Q2aC0AM1/h97nSGDBmmYdeCECSbn1C0bS+lgQkz18A1+RMGaIvEVaYcbk AWBpFJVcZUR2vDlcgUgHQ3MAeavNlSjL4RyvDuzXh3AirsNm5ZxLKyCE1BUnUoHuP7Me a+dYk1A6eB9wEMOVTi2WWbxejSfBH53oaju9r7h0Z9RTwW7odg/Vj1M2ZU0L5cImCjL5 HP/jbTptq5erApcw9IJUzWf9OsBBXFtHyDTyWY6lrVMGjI+UX6HCTts8OEQ6bAHaPpaZ Fo69awpSdWdYLMx7yN9qWebze8U9hEf76+7E0FbqqEBngivIkUZ1YFgfTS9gWJp71TcS jHkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=WE2vHmB/; 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 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.20.14; Mon, 12 Feb 2018 13:20:30 -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=@lechnology.com header.s=default header.b=WE2vHmB/; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754128AbeBLVTg (ORCPT + 99 others); Mon, 12 Feb 2018 16:19:36 -0500 Received: from vern.gendns.com ([206.190.152.46]:58189 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754006AbeBLVTf (ORCPT ); Mon, 12 Feb 2018 16:19:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=tNJs/bKGYWaecN0psa2HolQCs0o1M5+2tjGuItVY2/4=; b=WE2vHmB/IwbunDQo9eKoN6748M ixnUuh6DCOj28EC1My/FsIV9QrzjU+5mmUjGf7fWgk2+gHHpg8rs85p9N5LwU9+XzAxsrFFdEbt4n /xC8UxaaPzTjwv/6fs8akmotCSamIdO5p/CdgmsXIlnMRtgdVIWkVkSApROscE7ByM4TtuM9EI48V +b2miLHE4eyj8/rqE96Yiq2Fgp5MhWvGQIq4MLlrFhGaqRJwAMuD2Z6Wgj+uUFzktgjYlYw6enCAv fdaCB8QRBVQiai7qgK+okEh3ByB2f2b1WdUBbW/Y9tHkzyM/aJAQ91mrH/BlrA/7Kx5E9sM/KmyrZ ETroxM7w==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:35440 helo=[192.168.0.134]) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1elLUX-001t0X-Ew; Mon, 12 Feb 2018 16:18:25 -0500 Subject: Re: [PATCH] clk: don't call __of_clk_get_by_name() unnecessarily from clk_get() To: Russell King - ARM Linux Cc: Bartosz Golaszewski , Bartosz Golaszewski , Sekhar Nori , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman References: <20180212142439.15885-1-brgl@bgdev.pl> <36b4b8a0-0254-c6fa-c84f-ceab20c326ad@lechnology.com> <20180212210053.GO9418@n2100.armlinux.org.uk> From: David Lechner Message-ID: <12e2aeb6-d1be-4c62-d48f-4d62b46dfc99@lechnology.com> Date: Mon, 12 Feb 2018 15:19:42 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180212210053.GO9418@n2100.armlinux.org.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/12/2018 03:00 PM, Russell King - ARM Linux wrote: > 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. Oops, I guess I should have looked before I said something. > >> 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. > Looks fine to me too.