Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1325992 > unrolled thread

[PATCH 1/2] of: always define of_node_cmp() and other functions

Started byArnd Bergmann <arnd@arndb.de>
First post2016-02-03 23:10 +0100
Last post2016-02-03 23:10 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/2] of: always define of_node_cmp() and other functions Arnd Bergmann <arnd@arndb.de> - 2016-02-03 23:10 +0100
    [PATCH 2/2] of: provide of_n_{addr,size}_cells wrappers for !CONFIG_OF Arnd Bergmann <arnd@arndb.de> - 2016-02-03 23:10 +0100

#1325992 — [PATCH 1/2] of: always define of_node_cmp() and other functions

FromArnd Bergmann <arnd@arndb.de>
Date2016-02-03 23:10 +0100
Subject[PATCH 1/2] of: always define of_node_cmp() and other functions
Message-ID<qYdMB-7MT-3@gated-at.bofh.it>
The ti-vpe driver started using of_node_cmp(), and it can
be used when CONFIG_OF is disabled, which results in a
build failure:

drivers/media/platform/ti-vpe/cal.c: In function 'of_get_next_port':
drivers/media/platform/ti-vpe/cal.c:1655:12: error: implicit declaration of function 'of_node_cmp' [-Werror=implicit-function-declaration]

There is no reason for this, we can simply move the definition
outside of the #ifdef CONFIG_OF section without any downsides.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/of.h | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index dc6e39696b64..f8d9b558f9bd 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -128,6 +128,23 @@ extern raw_spinlock_t devtree_lock;
 
 #define OF_BAD_ADDR	((u64)-1)
 
+#if defined(CONFIG_SPARC)
+#include <asm/prom.h>
+#endif
+
+/* Default #address and #size cells.  Allow arch asm/prom.h to override */
+#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT)
+#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
+#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
+#endif
+
+/* Default string compare functions, Allow arch asm/prom.h to override */
+#if !defined(of_compat_cmp)
+#define of_compat_cmp(s1, s2, l)	strcasecmp((s1), (s2))
+#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
+#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
+#endif
+
 #ifdef CONFIG_OF
 void of_core_init(void);
 
@@ -211,23 +228,6 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
 	return of_read_number(cell, size);
 }
 
-#if defined(CONFIG_SPARC)
-#include <asm/prom.h>
-#endif
-
-/* Default #address and #size cells.  Allow arch asm/prom.h to override */
-#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT)
-#define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
-#define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
-#endif
-
-/* Default string compare functions, Allow arch asm/prom.h to override */
-#if !defined(of_compat_cmp)
-#define of_compat_cmp(s1, s2, l)	strcasecmp((s1), (s2))
-#define of_prop_cmp(s1, s2)		strcmp((s1), (s2))
-#define of_node_cmp(s1, s2)		strcasecmp((s1), (s2))
-#endif
-
 #define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags)
 #define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags)
 
-- 
2.7.0

[toc] | [next] | [standalone]


#1325998 — [PATCH 2/2] of: provide of_n_{addr,size}_cells wrappers for !CONFIG_OF

FromArnd Bergmann <arnd@arndb.de>
Date2016-02-03 23:10 +0100
Subject[PATCH 2/2] of: provide of_n_{addr,size}_cells wrappers for !CONFIG_OF
Message-ID<qYdMC-7MT-25@gated-at.bofh.it>
In reply to#1325992
The pci-rcar driver is enabled for compile tests, and this has
now shown that the driver cannot build without CONFIG_OF,
following the inclusion of f8f2fe7355fb "PCI: rcar: Use new OF
interrupt mapping when possible":

../drivers/pci/host/pcie-rcar.c: In function 'pci_dma_range_parser_init':
../drivers/pci/host/pcie-rcar.c:856:2: error: implicit declaration of function 'of_n_addr_cells' [-Werror=implicit-function-declaration]
  parser->pna = of_n_addr_cells(node);
  ^
As pointed out by Ben Dooks and Geert Uytterhoeven, this is actually
supposed to build fine, which we can achieve if we make the
declaration of of_irq_parse_and_map_pci conditional on CONFIG_OF
and provide an empty inline function otherwise, as we do for
a lot of other of interfaces.

This lets us build the rcar_pci driver again without CONFIG_OF
for build testing. All platforms using this driver select OF,
so this doesn't change anything for the users.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: devicetree@vger.kernel.org
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Magnus Damm <damm@opensource.se>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ben Dooks <ben.dooks@codethink.co.uk>
Cc: linux-pci@vger.kernel.org
Cc: linux-sh@vger.kernel.org

---
I originally sent the patch in 2014 when things initially broke
and then forgot about while it was applied in my randconfig patch
stack. It's still broken and I think this is hte correct fix.
---
 include/linux/of.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/of.h b/include/linux/of.h
index f8d9b558f9bd..9c941cd3ba58 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -565,6 +565,9 @@ static inline struct device_node *of_get_cpu_node(int cpu,
 	return NULL;
 }
 
+static inline int of_n_addr_cells(struct device_node *np) { return 0; }
+static inline int of_n_size_cells(struct device_node *np) { return 0; }
+
 static inline int of_property_read_u64(const struct device_node *np,
 				       const char *propname, u64 *out_value)
 {
-- 
2.7.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web