All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] of: add a dummy implementation of of_get_property() in of.h
@ 2011-08-05  8:56 ` Axel Lin
  0 siblings, 0 replies; 4+ messages in thread
From: Axel Lin @ 2011-08-05  8:56 UTC (permalink / raw)
  To: linux-kernel
  Cc: Colin Cross, John Bonesio, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms),
	Grant Likely, linux-i2c, devicetree-discuss, Sam Ravnborg sam

Then we can avoid having #ifdef CONFIG_OF splattered around the place
calling of_get_property(), it leads to errors.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
This patch fixes below build error with "make tegra_defconfig;make".

  CC      drivers/i2c/busses/i2c-tegra.o
drivers/i2c/busses/i2c-tegra.c: In function 'tegra_i2c_probe':
drivers/i2c/busses/i2c-tegra.c:615: error: implicit declaration of function 'of_get_property'
drivers/i2c/busses/i2c-tegra.c:616: warning: assignment makes pointer from integer without a cast
make[3]: *** [drivers/i2c/busses/i2c-tegra.o] Error 1
make[2]: *** [drivers/i2c/busses] Error 2
make[1]: *** [drivers/i2c] Error 2
make: *** [drivers] Error 2

Regards,
Axel
 include/linux/of.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index 0085bb0..320cbad 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -256,6 +256,12 @@ static inline int of_property_read_string(struct device_node *np,
 	return -ENOSYS;
 }
 
+static inline const void *of_get_property(const struct device_node *np,
+					  const char *name, int *lenp)
+{
+	return NULL;
+}
+
 #endif /* CONFIG_OF */
 
 static inline int of_property_read_u32(const struct device_node *np,
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RFC][PATCH] of: add a dummy implementation of of_get_property() in of.h
@ 2011-08-05  8:56 ` Axel Lin
  0 siblings, 0 replies; 4+ messages in thread
From: Axel Lin @ 2011-08-05  8:56 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Colin Cross, John Bonesio, Jean Delvare (PC drivers, core),
	Ben Dooks (embedded platforms),
	Grant Likely, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Sam Ravnborg sam

Then we can avoid having #ifdef CONFIG_OF splattered around the place
calling of_get_property(), it leads to errors.

Signed-off-by: Axel Lin <axel.lin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
This patch fixes below build error with "make tegra_defconfig;make".

  CC      drivers/i2c/busses/i2c-tegra.o
drivers/i2c/busses/i2c-tegra.c: In function 'tegra_i2c_probe':
drivers/i2c/busses/i2c-tegra.c:615: error: implicit declaration of function 'of_get_property'
drivers/i2c/busses/i2c-tegra.c:616: warning: assignment makes pointer from integer without a cast
make[3]: *** [drivers/i2c/busses/i2c-tegra.o] Error 1
make[2]: *** [drivers/i2c/busses] Error 2
make[1]: *** [drivers/i2c] Error 2
make: *** [drivers] Error 2

Regards,
Axel
 include/linux/of.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/of.h b/include/linux/of.h
index 0085bb0..320cbad 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -256,6 +256,12 @@ static inline int of_property_read_string(struct device_node *np,
 	return -ENOSYS;
 }
 
+static inline const void *of_get_property(const struct device_node *np,
+					  const char *name, int *lenp)
+{
+	return NULL;
+}
+
 #endif /* CONFIG_OF */
 
 static inline int of_property_read_u32(const struct device_node *np,
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC][PATCH] of: add a dummy implementation of of_get_property() in of.h
  2011-08-05  8:56 ` Axel Lin
@ 2011-08-05  9:05   ` Tobias Klauser
  -1 siblings, 0 replies; 4+ messages in thread
From: Tobias Klauser @ 2011-08-05  9:05 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Colin Cross, John Bonesio,
	Jean Delvare (PC drivers, core), Ben Dooks (embedded platforms),
	Grant Likely, linux-i2c, devicetree-discuss, Sam Ravnborg sam

On 2011-08-05 at 10:56:14 +0200, Axel Lin <axel.lin@gmail.com> wrote:
> Then we can avoid having #ifdef CONFIG_OF splattered around the place
> calling of_get_property(), it leads to errors.

You shouldn't redefine of_get_property in the driver. Rather add a
wrapper function to the driver which will extract the device tree
information in CONFIG_OF is enabled and which will just return -ENODEV
if CONFIG_OF is not set.

Cheers
Tobias

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC][PATCH] of: add a dummy implementation of of_get_property() in of.h
@ 2011-08-05  9:05   ` Tobias Klauser
  0 siblings, 0 replies; 4+ messages in thread
From: Tobias Klauser @ 2011-08-05  9:05 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Colin Cross, John Bonesio,
	Jean Delvare (PC drivers, core), Ben Dooks (embedded platforms),
	Grant Likely, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Sam Ravnborg sam

On 2011-08-05 at 10:56:14 +0200, Axel Lin <axel.lin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Then we can avoid having #ifdef CONFIG_OF splattered around the place
> calling of_get_property(), it leads to errors.

You shouldn't redefine of_get_property in the driver. Rather add a
wrapper function to the driver which will extract the device tree
information in CONFIG_OF is enabled and which will just return -ENODEV
if CONFIG_OF is not set.

Cheers
Tobias

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-05  9:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-05  8:56 [RFC][PATCH] of: add a dummy implementation of of_get_property() in of.h Axel Lin
2011-08-05  8:56 ` Axel Lin
2011-08-05  9:05 ` Tobias Klauser
2011-08-05  9:05   ` Tobias Klauser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.