From patchwork Fri Nov 14 11:03:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 5304971 Return-Path: X-Original-To: patchwork-linux-fbdev@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 2C66BC11AC for ; Fri, 14 Nov 2014 11:04:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B93D2015D for ; Fri, 14 Nov 2014 11:04:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9725820154 for ; Fri, 14 Nov 2014 11:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965174AbaKNLEB (ORCPT ); Fri, 14 Nov 2014 06:04:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55581 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964896AbaKNLEA (ORCPT ); Fri, 14 Nov 2014 06:04:00 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAEB3Nnn020846 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 14 Nov 2014 06:03:23 -0500 Received: from shalem.localdomain.com (vpn1-7-79.ams2.redhat.com [10.36.7.79]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAEB3HZr016438; Fri, 14 Nov 2014 06:03:20 -0500 From: Hans de Goede To: Tomi Valkeinen Cc: Stephen Warren , Jean-Christophe Plagniol-Villard , Grant Likely , Rob Herring , Luc Verhaegen , Maxime Ripard , David Herrmann , Geert Uytterhoeven , linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree , linux-sunxi@googlegroups.com, Hans de Goede Subject: [PATCH v5 2/5] of.h: Keep extern declaration of of_* variables when !CONFIG_OF Date: Fri, 14 Nov 2014 12:03:13 +0100 Message-Id: <1415962996-31712-2-git-send-email-hdegoede@redhat.com> In-Reply-To: <1415962996-31712-1-git-send-email-hdegoede@redhat.com> References: <1415962996-31712-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Keep the extern declaration of of_allnodes and friends, when building without of support, this way code using them can be written like this: if (IS_ENABLED(CONFIG_OF_PLATFORM) && of_chosen) { for_each_child_of_node(of_chosen, np) ... } And rely on the compiler optimizing it away, avoiding the need for #ifdef-ery. Signed-off-by: Hans de Goede --- include/linux/of.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/of.h b/include/linux/of.h index 6545e7a..f83ca9d 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -105,8 +105,6 @@ static inline struct device_node *of_node_get(struct device_node *node) static inline void of_node_put(struct device_node *node) { } #endif /* !CONFIG_OF_DYNAMIC */ -#ifdef CONFIG_OF - /* Pointer for first entry in chain of all nodes. */ extern struct device_node *of_allnodes; extern struct device_node *of_chosen; @@ -114,6 +112,7 @@ extern struct device_node *of_aliases; extern struct device_node *of_stdout; extern raw_spinlock_t devtree_lock; +#ifdef CONFIG_OF static inline bool of_have_populated_dt(void) { return of_allnodes != NULL;