From patchwork Tue Apr 17 09:50:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10344641 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0DA32601D7 for ; Tue, 17 Apr 2018 09:50:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCBE528A34 for ; Tue, 17 Apr 2018 09:50:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D103D28A2A; Tue, 17 Apr 2018 09:50:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5958C28A2A for ; Tue, 17 Apr 2018 09:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=9jtD6PHmjwY3te8s8SvqqnENgilWQSY9F1iX32Xjpxs=; b=bzD RP64rQmLrbCf7+CXpy5c9J6S7czWMLsCPskmYAvWu1D4jcQztOPAH3G6BSB+D9KtSxX01Vfk0Z3fC sHpn+wF56y2a7wLt0fK6kF1hzVfjDtAIUq8VfMf2ND2+/E3AtJmpA8PIg9lMjiMKOLmUndKAQ99uz 8Tv2pp7/wZx3lSUWrm3nE0O1Q9uT7dr57gnwN0APE1cwRf6we/yynuevakACdPvKIrvzo+ivZBc1S TRLsm+zCbtQ+EkAbXASWK8zeyfAFfkHHg711Dm9em+BBjK8vS+6GYnTp8tR5nGOGHJW3k81Eb2OB5 e11zm82dfHLeA6/oG9t1U/1TC8wFZsA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8NFl-0004ZS-9j; Tue, 17 Apr 2018 09:50:21 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8NFg-0003mf-Ua for linux-arm-kernel@lists.infradead.org; Tue, 17 Apr 2018 09:50:18 +0000 Received: by mail-wr0-x244.google.com with SMTP id q13so30261246wre.3 for ; Tue, 17 Apr 2018 02:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=EuTAWscHORzvVj+xZyCHBoPPDIukJc0PsTT+grLxgL0=; b=a8cGyjaqYOFouJzknIVCr+KwVrVk2cAqcsu/RfJ1BaSORadA7BLFuueZc1ioRDCRa7 bdblqV6GbPTz5W1XrHtc6B+XmOYwveTgiYkbT7TTYuZq+0S5UEvCwP7yJhYB+Q+2cIx2 tIKDeK2Cqiz/DQD0C64Jk8MrIF2OzKNGmPYnWdQFQ7eI/YRXZY9cxFdG7w/Q4wRgYFfb Mh97LoA9zaJWMflFbumhQ7eobAwS4yXbzgo9b0L/bbzAT734l9kO8xet29lnWLm9JxNG o0A68e/EbZXXNWmXa3yFnVKqd3SL7cnfI+n6p/EYgvwj36TTQKb+dJKRMzh9wbZxBuCg AwrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EuTAWscHORzvVj+xZyCHBoPPDIukJc0PsTT+grLxgL0=; b=kWmbkeh8jtuBCxwYYKHXJfSCPYHUbIOJp+LiqaNFCeMWWRtu7xKRcrFrGF6nWWLmg6 edDzaD45KLP3ahnwx86c2foutQRjsDb9B/NfK9Vp2zUnHCiOdsaTCOYm8zxyhy2+FbO9 xqrgQDqq7cyqn3YrmyJQ3jYQ21Yf4K5qiyMR9H6Ms2YyDjxznWHftuHNUS5kp2ZFwOGe 3flhXSiR5sRLUXednwkNFb0K8uOcvvGpVmPB4HUJqJ6P98us60lHewM0iS9VVUlvWdeG zOKC0yHKeofl8V4VBcLp5un0pLgSDJzQQ+KSkv3+2lgz2mor09GrZGiVVFun1RJ/HS9w S9pA== X-Gm-Message-State: ALQs6tDtiH1gfZdNav2t88Rfkn7zs/H+ahSJfvat8q8pvG298zqOEZWX y2NrNzT1cSGaBgqCJYIsyg5xNg== X-Google-Smtp-Source: AIpwx4+XiJioxssomO9X2efGzXM7QLEFF3ZEeE1tFc2Sgmc/UXgBOkn1e+EBO68kxg6kBEmn7JmE9g== X-Received: by 10.28.202.7 with SMTP id a7mr473788wmg.93.1523958604538; Tue, 17 Apr 2018 02:50:04 -0700 (PDT) Received: from brgl-bgdev.home ([2a01:cb1d:af:5b00:e837:b8d5:48c1:571b]) by smtp.gmail.com with ESMTPSA id 39sm24452525wry.89.2018.04.17.02.50.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Apr 2018 02:50:03 -0700 (PDT) From: Bartosz Golaszewski To: Russell King Subject: [RESEND PATCH] clkdev: don't call __of_clk_get_by_name() unnecessarily from clk_get() Date: Tue, 17 Apr 2018 11:50:01 +0200 Message-Id: <20180417095001.8508-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180417_025016_985398_B9BE4234 X-CRM114-Status: GOOD ( 14.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Lechner , Kevin Hilman , Sekhar Nori , linux-kernel@vger.kernel.org, Bartosz Golaszewski , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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;