From patchwork Mon Feb 12 14:24:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10214437 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 7302760153 for ; Mon, 12 Feb 2018 21:00:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69D4F28C70 for ; Mon, 12 Feb 2018 21:00:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E1DE28CC4; Mon, 12 Feb 2018 21:00:47 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E94A328C8D for ; Mon, 12 Feb 2018 21:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=casper.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=7XS1EMysq/FWijCBr08Z7T8VLB6KklWl3mmh9SLpyc0=; b=UGuTgu7PYM31qFGoYv+Bv9Z4Q6 hZdKRfpPzZBvL0OuIEWzBV09X9sPzlu/1bl9zx21RT31wjAVYKUSJqsFNnuPFuXyHGzEYDs+R00Ej 0Xo0aWc2uC4RknWHqg9IMQjqiBWpeFJxzqJvkyOYVMeJ1uUedIyjvxU7NnksFSSFlsZEIaZHNpLbC 7Nr42/KmsfQg0P7GY7FynEUktCLrLIFUWG/PuzRUL/fd/bIbRaryzr4zKA16NiA3tzgJVnqHDgTeD x1J31JBnMuOjWB4K8lQ0/Iw6E4ad3M7HqssCyGgtkZIrr42lJCAURX+NosAvRgMaEpZFmV2b21kIs cwI17zvg==; Received: from [198.137.202.133] (helo=bombadil.infradead.org) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1elLDQ-0006Bj-Hh; Mon, 12 Feb 2018 21:00:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=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=7XS1EMysq/FWijCBr08Z7T8VLB6KklWl3mmh9SLpyc0=; b=D24dQIMGejru4L/1qB/R2GMjyT QMsmXoUbua2lHx/cxZlT/1xeITXq2dI45b+CUGf+1h0UiZzTlVL7TJrja4EHQnCaZ9w5q6bYJcV4e TGiJf8Gk/ZSZPGfOp245WL3mOJ8nuqEo3xJTuzxaaVhHwF+AmeJzZ2iLzAPxUSVO4VksvLHccvzfz +YbysYoFXbMgeJL9BCRaj1qwv93YlhOiF9nDhcs+r1ptjG9la4zmUvIggd8MWTjfG0WObZs2n8CPG xtEqXnzuScGxLEaOwlmBIpmCbMrdjJeioWhUBj9Vp54EegSOJ3sX2NKWZQa0exCi7V+bxdDkx3Xnb 0wtKPJ7g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1elF2b-00075f-Q1; Mon, 12 Feb 2018 14:25:09 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1elF2W-0005qP-KZ for linux-arm-kernel@lists.infradead.org; Mon, 12 Feb 2018 14:25:07 +0000 Received: by mail-wm0-x244.google.com with SMTP id j21so9020926wmh.1 for ; Mon, 12 Feb 2018 06:24:52 -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=lSjKDINkCZrxS9wyUFeAfSUZDHRTYFh4MOxrBxqYED8ZjebsAkT1rNiNwq8VQW/18K y8Hq0HolfgA5Xn5d0WUulCYOwDxWbp3A4pZp8raCe9csPfGHILNz/NB6K9dtrcJIzb+r a4iYrJX+zdquhoZU0uTO+3M/zFsdHjq+n6t2/EdtlSgfHlwaG+qg/Znu6ZWbIMqj+vaB uW8AXQM0yrUXY8a5acLB+sbWF6PhTEHsTcJ0zHpL/22FyvcdRVULDCHOWrPRPacfiCDP bF9PyQRCEmZhPrXCNeu8MnU+ECtndPm2pJGVEP9PH3+hJrfZ0xg2/gAGd+wEQgd1CsTm W2UQ== X-Gm-Message-State: APf1xPBza1zRF65i3EHNQJ1t16e1i53nfFRmGjwSxTFokl55m5yGMttk eC1usxcSXGzblHk4VMEDB0oeEQ== X-Google-Smtp-Source: AH8x227flDL6/mwmWODZmbTvNlTlIaKQEgqdfu4dlqVGfHU0JrHxGvxJv4CkKxpCO5qFgKeWUt5bIA== 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 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 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;