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


Groups > linux.kernel > #1730527

[PATCH 2/2] of: provide inline helper for of_find_device_by_node

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH 2/2] of: provide inline helper for of_find_device_by_node
Date 2017-09-11 22:10 +0200
Message-ID <uoDbR-84z-39@gated-at.bofh.it> (permalink)
References <uoDbR-84z-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The ipmmu-vmsa driver fails in compile-testing on non-OF platforms:

drivers/iommu/ipmmu-vmsa.o: In function `ipmmu_of_xlate':
ipmmu-vmsa.c:(.text+0x740): undefined reference to `of_find_device_by_node'

It would be reasonable to assume that this interface works but
returns failure on non-OF builds, like it does on machines that
have been booted in another way, so this adds another inline
function helper.

Fixes: 7b2d59611fef ("iommu/ipmmu-vmsa: Replace local utlb code with fwspec ids")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/of_platform.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index e0d1946270f3..fb908e598348 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -57,7 +57,14 @@ extern const struct of_device_id of_default_bus_match_table[];
 extern struct platform_device *of_device_alloc(struct device_node *np,
 					 const char *bus_id,
 					 struct device *parent);
+#ifdef CONFIG_OF
 extern struct platform_device *of_find_device_by_node(struct device_node *np);
+#else
+static inline struct platform_device *of_find_device_by_node(struct device_node *np)
+{
+	return NULL;
+}
+#endif
 
 /* Platform devices and busses creation */
 extern struct platform_device *of_platform_device_create(struct device_node *np,
-- 
2.9.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] [RESEND] of: provide of_n_{addr,size}_cells wrappers for !CONFIG_OF Arnd Bergmann <arnd@arndb.de> - 2017-09-11 22:10 +0200
  [PATCH 2/2] of: provide inline helper for of_find_device_by_node Arnd Bergmann <arnd@arndb.de> - 2017-09-11 22:10 +0200
  Re: [PATCH 1/2] [RESEND] of: provide of_n_{addr,size}_cells wrappers  for !CONFIG_OF Rob Herring <robh+dt@kernel.org> - 2017-09-18 23:30 +0200
    Re: [PATCH 1/2] [RESEND] of: provide of_n_{addr,size}_cells wrappers  for !CONFIG_OF Geert Uytterhoeven <geert@linux-m68k.org> - 2017-09-19 09:10 +0200

csiph-web