From patchwork Sat Nov 8 18:33:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Francois Moine X-Patchwork-Id: 5261751 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 47289C11AC for ; Sun, 9 Nov 2014 18:45:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B2282012D for ; Sun, 9 Nov 2014 18:45:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7AD3020122 for ; Sun, 9 Nov 2014 18:45:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XnXS1-0003k7-HR; Sun, 09 Nov 2014 18:43:01 +0000 Received: from smtp4-g21.free.fr ([212.27.42.4]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XnXRx-0003ht-5l for linux-arm-kernel@lists.infradead.org; Sun, 09 Nov 2014 18:42:57 +0000 Received: from localhost (unknown [IPv6:2a01:e35:2f5c:9de0:212:bfff:fe1e:9ce4]) by smtp4-g21.free.fr (Postfix) with ESMTP id 7A1524C8025; Sun, 9 Nov 2014 19:40:20 +0100 (CET) X-Mailbox-Line: From 375a82230accf26dfbbb74e6f928243ea8e38b50 Mon Sep 17 00:00:00 2001 Message-Id: <375a82230accf26dfbbb74e6f928243ea8e38b50.1415557680.git.moinejf@free.fr> In-Reply-To: References: From: Jean-Francois Moine Date: Sat, 8 Nov 2014 19:33:22 +0100 Subject: [PATCH 1/2] of: Make const the device node pointers in of_clk_get and of_node_put To: Russell King , Grant Likely X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141109_104257_401704_D76D8175 X-CRM114-Status: GOOD ( 12.32 ) X-Spam-Score: -0.2 (/) Cc: devicetree@vger.kernel.org, Lars-Peter Clausen , linux-kernel@vger.kernel.org, Rob Herring , Mark Brown , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, DATE_IN_PAST_24_48, FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some device nodes are sometimes referenced by const pointers. This patch avoids to cast these pointers when calling the functions of_clk_get() and of_node_put(). Signed-off-by: Jean-Francois Moine --- drivers/clk/clkdev.c | 2 +- drivers/of/dynamic.c | 2 +- include/linux/clk.h | 4 ++-- include/linux/of.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index da4bda8..eaee11e 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -53,7 +53,7 @@ struct clk *of_clk_get_by_clkspec(struct of_phandle_args *clkspec) return clk; } -struct clk *of_clk_get(struct device_node *np, int index) +struct clk *of_clk_get(const struct device_node *np, int index) { struct of_phandle_args clkspec; struct clk *clk; diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index f297891..64eb5ba 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -34,7 +34,7 @@ EXPORT_SYMBOL(of_node_get); * @node: Node to dec refcount, NULL is supported to simplify writing of * callers */ -void of_node_put(struct device_node *node) +void of_node_put(const struct device_node *node) { if (node) kobject_put(&node->kobj); diff --git a/include/linux/clk.h b/include/linux/clk.h index c7f258a..4e077a4 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -425,11 +425,11 @@ struct device_node; struct of_phandle_args; #if defined(CONFIG_OF) && defined(CONFIG_COMMON_CLK) -struct clk *of_clk_get(struct device_node *np, int index); +struct clk *of_clk_get(const struct device_node *np, int index); struct clk *of_clk_get_by_name(struct device_node *np, const char *name); struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec); #else -static inline struct clk *of_clk_get(struct device_node *np, int index) +static inline struct clk *of_clk_get(const struct device_node *np, int index) { return ERR_PTR(-ENOENT); } diff --git a/include/linux/of.h b/include/linux/of.h index 6545e7a..b738681 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -95,14 +95,14 @@ static inline int of_node_is_attached(struct device_node *node) #ifdef CONFIG_OF_DYNAMIC extern struct device_node *of_node_get(struct device_node *node); -extern void of_node_put(struct device_node *node); +extern void of_node_put(const struct device_node *node); #else /* CONFIG_OF_DYNAMIC */ /* Dummy ref counting routines - to be implemented later */ static inline struct device_node *of_node_get(struct device_node *node) { return node; } -static inline void of_node_put(struct device_node *node) { } +static inline void of_node_put(const struct device_node *node) { } #endif /* !CONFIG_OF_DYNAMIC */ #ifdef CONFIG_OF