Received: by 10.223.185.116 with SMTP id b49csp2396863wrg; Mon, 12 Feb 2018 08:55:26 -0800 (PST) X-Google-Smtp-Source: AH8x226vZdcCIVMpZbjnXxIRG6F2mD8Fx0Q0CET7QO53r6klcwJ5P6AyaQXPzHN/y8i0SjtjVFco X-Received: by 10.101.86.15 with SMTP id l15mr10023748pgs.340.1518454526129; Mon, 12 Feb 2018 08:55:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518454526; cv=none; d=google.com; s=arc-20160816; b=gdHpi6kPN8fwEvvUnu3Rbc4B1OqYeOY/02M3/kqVMVRP0S8P4IgaOYHDvB0marfTTX ONDYxwbxZdiBoaBNIansGRqZ8CELaZ71TfH0HLwJ/ZCNdc1AiEtdXCW+YTgzYrbM4pQQ 7NuJwa+BV9Y0sbaSxwhRzAsiLX7av+7GzBfeCPma13g4rANvysFiJ+yJVGzR5i28SaMB i7C4l3chuWKMurbzebQbyVPz1ylnOZDH63z4bGl1/G2kh7YNj7OcWLXUiF2nxBIz/l4i XdUDp6plkYDt5NrdinnCmIFGZ37b9zy/SpdT0GBmnR8lpTt/5G3pP3DO6Pa8czjlGQ42 GoTQ== 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=K1ABtF9x0tsy7VVz6WKfgFvHdIzr5CoGy8j0RX+bbNk=; b=N3/380/fK5q3Lr/5lor3nkpc3aa3fNKdWQ68/vvU34XvqDfTsSnSLKyMlJ6lVD0M8G n3EIxmc+LEJOAzoLFIRmAkm7/y2KY6+gxe3EBdIVu+YgDbDAE8OwByxqrtClbcS4fmci IpweBrxic9mX3iAgd7ELabxsZhoRF65ZO7ERzEt6p229s/ovD8gbRc7DXiU6udKOhZ7H UVldb7dMFzEWdeDOBFZeZGRrgBUIf2lki6FzbGzZh7rdoj0dqjtcJskYlnykOxQXGTUL ZmoFTKeDDwQDPll3Fm7eM5WfcbasGT2LiEvJ6X5UAWAW2+eyfUyrbJJBx3mKNpN3qRKS gd7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=ykDZHryR; 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 n79si179191pfa.148.2018.02.12.08.55.10; Mon, 12 Feb 2018 08:55:26 -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=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=ykDZHryR; 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 S1754203AbeBLOYx (ORCPT + 99 others); Mon, 12 Feb 2018 09:24:53 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:50347 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754190AbeBLOYw (ORCPT ); Mon, 12 Feb 2018 09:24:52 -0500 Received: by mail-wm0-f66.google.com with SMTP id f71so9919681wmf.0 for ; Mon, 12 Feb 2018 06:24:51 -0800 (PST) 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=K1ABtF9x0tsy7VVz6WKfgFvHdIzr5CoGy8j0RX+bbNk=; b=ykDZHryREcBMxc7NpafQNqGvTKgWZWb07TaobBHSLWrQLl/ttMqV3SY8h3iiK/ddbX wtTFIszYrBrnjkrSNQEs8kdKgLASCmk4zc22S6GKsLTdksfI1tqiF4DhcYuyYt+1ALse DVUqV349AHDx+XCzsB9guMDih1mN3tLouC28Lgz7rhE6qg6YCBCg2R7QRkauVONCjbXq W0IbxsPtSlQ8XhP1bclZyGC14FZYpZ+TUFQyqHOUTTfM8QEbOMozqK3J4jIahMIbB+wp esQmqc3rXceRq/A0CqCDfsNW6Fb1HJJbnpiTqtM0XkKBC1hqHUbqmOcLEFlRc+jq43wM 7t7g== 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=K1ABtF9x0tsy7VVz6WKfgFvHdIzr5CoGy8j0RX+bbNk=; b=k00QdWT5+B2b9q5pvBfOL1S8LmDr6zvI036oVlXls0axq3sCpddvNoS9sGaakoYTZ0 frWK6aqvwRwHd2pOp/k86eqiUT0s/0bj/7DcVj44rAPliPTyOo0KeF7zEq6qAsujhsDs cS07bhCizks3mMU08dZS/BqHGqcNCUKXxhEIJ0kbCBjiAPAg44Rz33Sa8t4bLHui6k5u aRHChWwFU+BgKPUL6sX+YJYHI9XuEOIB4RmIQSPMtVYAmL84oAZb65NMEtbCZScH94yC iExTe8uK8oEw8QRqejO4Kgzq6ejXe4pWLQ1dckqKH4V1THFEZLdibyN0E/vlz4efarv1 t0BQ== X-Gm-Message-State: APf1xPAY7lcwseAX+dmiYPI2oZb4JPQl5LfejfdPHpe0re9rcJg85tx9 t1bFFCqjw91ME+J1EZG4P5+zRg== X-Received: by 10.28.126.133 with SMTP id z127mr4069360wmc.64.1518445490891; Mon, 12 Feb 2018 06:24:50 -0800 (PST) Received: from brgl-bgdev.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id 30sm5125818wri.48.2018.02.12.06.24.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Feb 2018 06:24:50 -0800 (PST) From: Bartosz Golaszewski To: Russell King Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , Sekhar Nori , Kevin Hilman , David Lechner Subject: [PATCH] clk: don't call __of_clk_get_by_name() unnecessarily from clk_get() Date: Mon, 12 Feb 2018 15:24:39 +0100 Message-Id: <20180212142439.15885-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.16.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.16.1