Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4062896imm; Mon, 25 Jun 2018 09:06:06 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKMT6BZ5dpk2qaEiYJbyQz9Oiqfd6K/OdNoTX8MxcQuJGg30qdezH/TAEaYoC2yRbeEJQLF X-Received: by 2002:a65:6619:: with SMTP id w25-v6mr11169011pgv.195.1529942766606; Mon, 25 Jun 2018 09:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529942766; cv=none; d=google.com; s=arc-20160816; b=M6pUziGJpcLN75nIl/YFPcBEuga/SEpyqE98KOm9FyOyTTIhtOzR8CZQVy0NNmfrsn K7cy8meIO7I0/gFdSvxmUzjvtzpZUiUQW9MUHqP7y3gy00j1kV9DhR+BGN4BjTYPjPQa 9yHDyjvKrD/f31un6UGCfoxf5iCJRUtKqGhm/sH7eYo7vkKZiHG9f9OlCBRritVYnWmE ctXDWs1vLcVhhVpJI8y/4MxqpfzwbUnCiERaKF0Mk2XnO7629yOD+37Ov22hgD8se09v sQ6SvcYKWf+IMGRoR6wCqHuxBggF9wDtMby9ENKKuES3B3SFXsNFrfg3CVRZoPGXMnJX 7tXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=wLQxL/zx/Q7mTIfCcZPNsKkINeXIDYAB2hfhFPbxlTQ=; b=ACV3QB47Z4e+fqp6gjhHFqwuGsj+QTuNUQkpBEYboSigKvOPqYbHAUV+flaDP02sb6 YlVLjlnX3XMA5xZ7NFuyNfGbhG5/2/hOiPlrj7FqDCROrDARHNP8Bb/9BNtiD/emTO3u eSigwjLd0cYDv3DZSSbliF0JCVSEEsXqLI2FEM0Dbzuw/4XWvGPCBxKbjZxRMd8Fl97C 2maHauiB62IbML+dn9mmQctoX+L7IFESGQkT9/jrQ3/KYqJzZ1omH36k8FHYGDiroFra vHyuGq2+i5GWe76zgjYIwsYvd7TD22AHbBQdueO+jkYPr8e+/GN6RtqSvSp3cDkPixPL i/sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=Di6sjhIb; 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 j5-v6si14990825pfb.244.2018.06.25.09.05.51; Mon, 25 Jun 2018 09:06: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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=Di6sjhIb; 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 S1755281AbeFYQEs (ORCPT + 99 others); Mon, 25 Jun 2018 12:04:48 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34987 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754012AbeFYQEo (ORCPT ); Mon, 25 Jun 2018 12:04:44 -0400 Received: by mail-wm0-f67.google.com with SMTP id z137-v6so4921424wmc.0 for ; Mon, 25 Jun 2018 09:04:44 -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=wLQxL/zx/Q7mTIfCcZPNsKkINeXIDYAB2hfhFPbxlTQ=; b=Di6sjhIbR2leN9OgBAyVM5g6m1qdJazKx0DqcpmVb52EqPJrBtoEhpo5OYz/Uxlv84 VuvUiAwPLALDkrCd72SfeWCP6i5MbbJieJOIUq/N4HGr/MdjAdz+mFs3gjBEIzLDCIPO MLRkDYKOBsbZyP5oK5BRGeiwK6Ln3r/E8IZfLDEpjcfgTxCi0/FywGqStuH4557/qF18 8tezZ+cvPl5e4vnm5MCKQQ8v/yjsOfBzRqVuTo/WQs9Z3Wbgon/uXeFRDNu0JERvHa4C gilsmlgU/ht2tUBZU/C0qB5jdFL1cOkMW5Jcpfvp1mMYVyxynX5FovIiOw82GZYzUrZj 5WKg== 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=wLQxL/zx/Q7mTIfCcZPNsKkINeXIDYAB2hfhFPbxlTQ=; b=AP2NUkx+85VSWAO4b++2SMGEshIDS5+lU1+LOdqPGKdtWWncZ/ifU7tCCJC2xAYo6b dnwrEsoOWqS8sshVoGBWpT2E2ZIk7rBO2FPq35sYRjoSODk45UU+cygsPv8GO6J8c753 wwM+xV2kl7W3tYr1knoCxifHA7zM6oRHXhhRsvEsfSLAgBQjkaG4lzhf3oJ3ik+R4NmH 2/1SC8dlHXuvZENRLjYMWfRK1ZG7pEJ+qEgi0h75vonAcZdQHnx9yCciNrQPnhErw2Uf 6C/gA6pvSM3xkm09JAU3xh9thsILv5Umd96bRdzmMKTasx74wqjNFK50dlZ9Yn01c8nh nxIA== X-Gm-Message-State: APt69E30yqIbIITVDLj/A51CMFGpfXKc9+pDcl8gtzhcnz3cLmdl8PV9 iJLJm0k7JLI+ZtZBxx8DGYpILbGyrJY= X-Received: by 2002:a1c:e8c6:: with SMTP id f67-v6mr1433377wmi.25.1529942683741; Mon, 25 Jun 2018 09:04:43 -0700 (PDT) Received: from brgl-bgdev.home ([2a01:cb1d:af:5b00:e837:b8d5:48c1:571b]) by smtp.gmail.com with ESMTPSA id e63-v6sm14091370wma.46.2018.06.25.09.04.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 09:04:43 -0700 (PDT) From: Bartosz Golaszewski To: Russell King , Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , Sekhar Nori , Kevin Hilman , David Lechner Subject: [RESEND (again) PATCH] clkdev: don't call __of_clk_get_by_name() unnecessarily from clk_get() Date: Mon, 25 Jun 2018 18:04:40 +0200 Message-Id: <20180625160440.10537-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.17.1