Received: by 10.213.65.68 with SMTP id h4csp1612120imn; Mon, 19 Mar 2018 08:43:50 -0700 (PDT) X-Google-Smtp-Source: AG47ELuUGZZ3hleDcLIWW0mObTz85NFsqmj+O+H7Bya8g5R3Vz/86oLWFPXfn++816VHEQh1r94A X-Received: by 10.98.163.68 with SMTP id s65mr3969674pfe.13.1521474230737; Mon, 19 Mar 2018 08:43:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521474230; cv=none; d=google.com; s=arc-20160816; b=EsG3n7tjQvM3JGEhjIQiA8mpL5t53tYJQYV7DF7HYvKVGtp1nhsoTmOFP06aPVD4WT 5puoWzP1tkGAYKHTFF0i/MCvzsHZYBdkw5lNWb8YdEJvLlZMOIoX0wdygtY0+KiIlLxs DeNw+Wd8Ltn8HiGtoExlYzAb2Yzo90NgW8Xjea8hkz5qITZZ7DjfqqvKIAvOSqPgOoSE HunJmEnbthxhMdzjeHT6ZzkzCghc0u5nqRLryW5hXEudML6b8OUV8KuzuJ5x6MOS9Ndy YJhHXeOBbXKmamnwBrAwT9b4SwX9lwWvwHtkcpBALmX7Ad/8yUoae83EDp1AS5+0yMyG giKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=pds1OrSOSa5dUlOqmiN34Kb+x9Eym16NbOgAcfTQ8ek=; b=zVG3x6WAUByvxENdvtNnWmJ2W8SA++9f0SHm1uFHKgLbgKw88qUqUfPS9akPto5Pl7 0uA54ttHcY4yw8A86KCahkSWvNhfJRmBciCCVmFjTJpBJx9LcCgY0n4DYsn2k7recfm7 P3jXYXBh+RUrvs6xelXotHvS5MiWqWF+Igms4e8KQ76H0ljkDG2/YOMRHx506b/OGNsX /B+ryxS/ys34B1sJkGf0JvS5wnmBwggIvUD6BNkp3tTdhsnr6f1lZ8tlfyUYm7sK0UDH BCsTtBoOGy2yDEwq3vsbfPyovijD7I4qws+OFR6iVeXqvub3rB8W8rC5m8HatYfE4enp Sypg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=KbfmxfNi; 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 u74si147977pgc.264.2018.03.19.08.43.35; Mon, 19 Mar 2018 08:43:50 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=KbfmxfNi; 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 S933087AbeCSPmM (ORCPT + 99 others); Mon, 19 Mar 2018 11:42:12 -0400 Received: from mail-ot0-f195.google.com ([74.125.82.195]:46801 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932418AbeCSPmJ (ORCPT ); Mon, 19 Mar 2018 11:42:09 -0400 Received: by mail-ot0-f195.google.com with SMTP id g97-v6so17797236otg.13 for ; Mon, 19 Mar 2018 08:42:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pds1OrSOSa5dUlOqmiN34Kb+x9Eym16NbOgAcfTQ8ek=; b=KbfmxfNiKgc6te7B57wFh/jUqiAiZpdevv6qe7kaMe3bUGuDP64LjwIwwTCmLCtTy3 SqPDNdXWVkwIAEVQcfwdpMyuiBEi7ueCZH5JIHPVZ2+yYU2CpmgRzRUO/buOiDHRvTpc aGrt8hoIn8b4BjNzZzO12gKDO/QzQib73yEmglZD3+nERMsXQFaqM2yzkDjQMSvKuyMW O1yVjJn8TFK7TfMHFBc2gbDbt/rAkw2/wO+5nJrWdV7q+GR/g6zxPRzPqlWM6oMFeNtH d3LcDVZ7AAV8aPWttPkbkW4wSn0Fcio1e7nDZp7sy5a3Kzqn/g/Xve3MFqFHMsWZSnfk 0HVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pds1OrSOSa5dUlOqmiN34Kb+x9Eym16NbOgAcfTQ8ek=; b=W8xOnPvR1b5/LEb8bN1/UXn8338AIdH1Vade6Jh6AsgqPvROnrIrvWRsuT8gEqxoSG Qcceyo2kpc708EGVIPCRHLdTLDn8xdXjk3PItdofjcVMWHUjkwhDs+gWicr6qEkZokTp A37+Azyx/7jH2MUXefw5pAc5Qa8HyP6r+FhgGkWp7zLZSnR0Lr6hFi6mR6twgLWXmMr3 Llt8J/zXzMrcrCcvEL9xwsdl4HxwgKHd/Txjz13hNkpBkQOG5um0AVr0F3uDXpKOeOSt FbGikY8NxmDZnHzI3o5JGg9xB00gIBuyUt9QzRwVpK0vdfBOaQPui65Sl3Oq9hhYMNmQ GYtA== X-Gm-Message-State: AElRT7GYXEitpAUBsD2yFbbV4fkpn4FQ6eEnzApuBdW5r8zvyDezc8sT qJriFv0fb7UKXLJFP4TeQOCuSqkewJHzjrqNAfDTUA== X-Received: by 2002:a9d:5220:: with SMTP id e32-v6mr8502090oth.211.1521474128393; Mon, 19 Mar 2018 08:42:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:1426:0:0:0:0:0 with HTTP; Mon, 19 Mar 2018 08:42:07 -0700 (PDT) In-Reply-To: <20180212210053.GO9418@n2100.armlinux.org.uk> References: <20180212142439.15885-1-brgl@bgdev.pl> <36b4b8a0-0254-c6fa-c84f-ceab20c326ad@lechnology.com> <20180212210053.GO9418@n2100.armlinux.org.uk> From: Bartosz Golaszewski Date: Mon, 19 Mar 2018 16:42:07 +0100 Message-ID: Subject: Re: [PATCH] clk: don't call __of_clk_get_by_name() unnecessarily from clk_get() To: Russell King - ARM Linux Cc: Bartosz Golaszewski , Linux Kernel Mailing List , Linux ARM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-02-12 22:00 GMT+01:00 Russell King - ARM Linux : > 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 Hi Russell, can you pick this patch up for 4.17? Thanks in advance, Bartosz