mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] memory: fix build when CONFIG_OF && !CONFIG_DDR
@ 2012-09-05 18:29 Stephen Warren
  2012-09-05 18:55 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Warren @ 2012-09-05 18:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Aneesh V
  Cc: Benoit Cousson, Grant Likely, Lokesh Vutla, Santosh Shilimkar,
	linux-kernel, Stephen Warren

From: Stephen Warren <swarren@nvidia.com>

Commit e6b42eb "memory: emif: add device tree support to emif driver"
added drivers/memory/of_memory.c, which references tables defined in
lib/jedec_ddr_data.c. of_memory.c is compiled when CONFIG_OF, whereas
jedec_ddr_data.c is compiled when CONFIG_DDR. This breaks the build
when CONFIG_OF is defined but not CONFIG_DDR:

drivers/built-in.o: In function `of_get_ddr_timings':
drivers/memory/of_memory.c:138: undefined reference to `lpddr2_jedec_timings'
drivers/built-in.o: In function `of_get_min_tck':
drivers/memory/of_memory.c:62: undefined reference to `lpddr2_jedec_min_tck'
make: *** [vmlinux] Error 1

To solve this, only compile of_memory.c when CONFIG_OF && CONFIG_DDR,
otherwise, stub out the functions.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 drivers/memory/Makefile    |    2 ++
 drivers/memory/of_memory.h |    4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
index cd8486b..9cce5d7 100644
--- a/drivers/memory/Makefile
+++ b/drivers/memory/Makefile
@@ -2,7 +2,9 @@
 # Makefile for memory devices
 #
 
+ifeq ($(CONFIG_DDR),y)
 obj-$(CONFIG_OF)		+= of_memory.o
+endif
 obj-$(CONFIG_TI_EMIF)		+= emif.o
 obj-$(CONFIG_TEGRA20_MC)	+= tegra20-mc.o
 obj-$(CONFIG_TEGRA30_MC)	+= tegra30-mc.o
diff --git a/drivers/memory/of_memory.h b/drivers/memory/of_memory.h
index 20b496e..ef2514f 100644
--- a/drivers/memory/of_memory.h
+++ b/drivers/memory/of_memory.h
@@ -12,7 +12,7 @@
 #ifndef __LINUX_MEMORY_OF_REG_H
 #define __LINUX_MEMORY_OF_REG_H
 
-#ifdef CONFIG_OF
+#if defined(CONFIG_OF) && defined(CONFIG_DDR)
 extern const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np,
 		struct device *dev);
 extern const struct lpddr2_timings
@@ -31,6 +31,6 @@ static inline const struct lpddr2_timings
 {
 	return NULL;
 }
-#endif /* CONFIG_OF */
+#endif /* CONFIG_OF && CONFIG_DDR */
 
 #endif /* __LINUX_MEMORY_OF_REG_ */
-- 
1.7.0.4


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

* Re: [PATCH] memory: fix build when CONFIG_OF && !CONFIG_DDR
  2012-09-05 18:29 [PATCH] memory: fix build when CONFIG_OF && !CONFIG_DDR Stephen Warren
@ 2012-09-05 18:55 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2012-09-05 18:55 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Aneesh V, Benoit Cousson, Grant Likely, Lokesh Vutla,
	Santosh Shilimkar, linux-kernel, Stephen Warren

On Wed, Sep 05, 2012 at 12:29:23PM -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> Commit e6b42eb "memory: emif: add device tree support to emif driver"
> added drivers/memory/of_memory.c, which references tables defined in
> lib/jedec_ddr_data.c. of_memory.c is compiled when CONFIG_OF, whereas
> jedec_ddr_data.c is compiled when CONFIG_DDR. This breaks the build
> when CONFIG_OF is defined but not CONFIG_DDR:
> 
> drivers/built-in.o: In function `of_get_ddr_timings':
> drivers/memory/of_memory.c:138: undefined reference to `lpddr2_jedec_timings'
> drivers/built-in.o: In function `of_get_min_tck':
> drivers/memory/of_memory.c:62: undefined reference to `lpddr2_jedec_min_tck'
> make: *** [vmlinux] Error 1
> 
> To solve this, only compile of_memory.c when CONFIG_OF && CONFIG_DDR,
> otherwise, stub out the functions.

Ick, what a mess.  Thanks for the patch, I'll apply it, but surely there
is a "better" solution here?

thanks,

greg k-h

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

end of thread, other threads:[~2012-09-05 18:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-05 18:29 [PATCH] memory: fix build when CONFIG_OF && !CONFIG_DDR Stephen Warren
2012-09-05 18:55 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome