Skip to contentSkip to conversation

Allow I2C_OMAP to compile as a module.

PATCH In review Atal Shargorodsky 7 participants 19 messages Feb 12, 2009 – Feb 19, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow I2C_OMAP to compile as a module.

This patch allows I2C_OMAP to be compiled as a module.
Only drivers/i2c/busses/i2c-omap.c can be compiled as a module, but not arch/arm/plat-omap/i2c.c , so let the contents of i2c.c to compile into the kernel if either I2C_OMAP was selected to compile in or as a module.

---
 arch/arm/plat-omap/Makefile |    3 +--
 arch/arm/plat-omap/i2c.c    |    4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/plat-omap/Makefile +1 -2
index b3f0e6b..3617bfe 100644
@@ -4,7 +4,7 @@
 
 # Common support
 obj-y := common.o sram.o clock.o devices.o dma.o mux.o gpio.o \
-	 usb.o fb.o io.o
+	 usb.o fb.o io.o i2c.o
 obj-m :=
 obj-n :=
 obj-  :=
@@ -21,7 +21,6 @@ obj-$(CONFIG_OMAP_COMPONENT_VERSION) += component-version.o
 obj-$(CONFIG_OMAP_GPIO_SWITCH) += gpio-switch.o
 obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
 obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
-obj-$(CONFIG_I2C_OMAP) += i2c.o
 
 # OMAP mailbox framework
 obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
arch/arm/plat-omap/i2c.c +4 -0
index 467531e..a98a07f 100644
@@ -35,6 +35,8 @@
 #define OMAP2_I2C_BASE2		0x48072000
 #define OMAP2_I2C_BASE3		0x48060000
 
+#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
+
 static const char name[] = "i2c_omap";
 
 #define I2C_RESOURCE_BUILDER(base, irq)			\
@@ -163,3 +165,5 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
 	omap_i2c_mux_pins(bus_id - 1);
 	return platform_device_register(pdev);
 }
+
+#endif
Signature · 1 line
1.5.4.3
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Thu, 12 Feb 2009 15:10:29 +0100 "Shargorodsky Atal (EXT-Teleca/Helsinki)"…

This patch allows I2C_OMAP to be compiled as a module. Only drivers/i2c/busses/i2c-omap.c can be compiled as a module, but not arch/arm/plat-omap/i2c.c , so let the contents of i2c.c to compile into the kernel if either I2C_OMAP was selected to compile in or as a module.

Quoted 6 lines
---
 arch/arm/plat-omap/Makefile |    3 +--
 arch/arm/plat-omap/i2c.c    |    4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)

Tony,

You can add this to your 2.6.29-rc series since the same build error is in mainline as well if CONFIG_I2C_OMAP=m.

Building modules, stage 2.
GZIP arch/arm/boot/compressed/piggy.gz
MODPOST 6 modules
ERROR: "i2c_register_board_info" [arch/arm/plat-omap/i2c.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
make: *** Waiting for unfinished jobs....

Subject needs a "ARM: OMAP: " prefix, otherwise ok from me.

#2 lore raw
Quoted 29 lines · Jarkko Nikula
Quoted 6 lines · On Thu, 12 Feb 2009 15:10:29 +0100 "Shargorodsky Atal (EXT-Teleca/Helsinki)"…

This patch allows I2C_OMAP to be compiled as a module. Only drivers/i2c/busses/i2c-omap.c can be compiled as a module, but not arch/arm/plat-omap/i2c.c , so let the contents of i2c.c to compile into the kernel if either I2C_OMAP was selected to compile in or as a module.

Quoted 6 lines
---
 arch/arm/plat-omap/Makefile |    3 +--
 arch/arm/plat-omap/i2c.c    |    4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)

Tony,

You can add this to your 2.6.29-rc series since the same build error is in mainline as well if CONFIG_I2C_OMAP=m.

Building modules, stage 2.
GZIP arch/arm/boot/compressed/piggy.gz
MODPOST 6 modules
ERROR: "i2c_register_board_info" [arch/arm/plat-omap/i2c.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
make: *** Waiting for unfinished jobs....

Quoted 3 lines

Subject needs a "ARM: OMAP: " prefix, otherwise ok from me.

Sounds like a fix, except I posted a shorter version of the patch that should do the trick (untested). Attached here too for reference.

Tony

arch/arm/plat-omap/Makefile +4 -1
@@ -21,7 +21,10 @@ obj-$(CONFIG_OMAP_COMPONENT_VERSION) += component-version.o
 obj-$(CONFIG_OMAP_GPIO_SWITCH) += gpio-switch.o
 obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
 obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+
+ifneq ($(CONFIG_I2C_OMAP),)
+	obj-$(CONFIG_I2C_OMAP)		+= i2c.o
+endif
 
 # OMAP mailbox framework
 obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
#3 lore raw
Quoted 7 lines · On Fri, 13 Feb 2009 14:21:00 -0800 Tony Lindgren <[email protected]> wrote:
Quoted 3 lines

Subject needs a "ARM: OMAP: " prefix, otherwise ok from me.

Sounds like a fix, except I posted a shorter version of the patch that should do the trick (untested). Attached here too for reference.

Tony's version does not fix the issue since obj-$(CONFIG_I2C_OMAP) below still tries to compile arch/arm/plat-omap/i2c.c as a module.

-obj-$(CONFIG_I2C_OMAP) += i2c.o
+
+ifneq ($(CONFIG_I2C_OMAP),)
+ obj-$(CONFIG_I2C_OMAP) += i2c.o
+endif

Problem was that drivers/i2c/busses/i2c-omap.c can be module but arch/arm/plat-omap/i2c.c cannot since it is for early board initialization code.

Signature · 1 line
Jarkko
#4 lore raw

arch/arm/plat-omap/Makefile obj-$(CONFIG_OMAP_COMPONENT_VERSION) += component-version.o · line 27

Quoted 9 lines · On Sun, 15 Feb 2009 21:35:59 +0200 Jarkko Nikula <[email protected]> wrote:

Tony's version does not fix the issue since obj-$(CONFIG_I2C_OMAP) below still tries to compile arch/arm/plat-omap/i2c.c as a module.

arch/arm/plat-omap/Makefile +4 -1
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+
+ifneq ($(CONFIG_I2C_OMAP),)
+	obj-$(CONFIG_I2C_OMAP)		+= i2c.o
+endif

And build works if obj-y rule is used instead

-obj-$(CONFIG_I2C_OMAP) += i2c.o
+
+ifneq ($(CONFIG_I2C_OMAP),)
+ obj-y += i2c.o
+endif

Good. Patch can be made to touch only single file and add only three new lines.

Signature · 1 line
Jarkko
#5 lore raw

Hello,

Quoted 18 lines · ext Jarkko Nikula

arch/arm/plat-omap/Makefile obj-$(CONFIG_OMAP_COMPONENT_VERSION) += component-version.o · line 27

Quoted 9 lines · Jarkko Nikula

Tony's version does not fix the issue since obj-$(CONFIG_I2C_OMAP) below still tries to compile arch/arm/plat-omap/i2c.c as a module.

arch/arm/plat-omap/Makefile +4 -1
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+
+ifneq ($(CONFIG_I2C_OMAP),)
+     obj-$(CONFIG_I2C_OMAP)          += i2c.o
+endif

And build works if obj-y rule is used instead

arch/arm/plat-omap/Makefile +4 -1
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+
+ifneq ($(CONFIG_I2C_OMAP),)
+       obj-y   += i2c.o
+endif
Quoted 2 lines

Good. Patch can be made to touch only single file and add only three new lines.

Taking example from fs/Makefile (nfsd):

-obj-$(CONFIG_I2C_OMAP) += i2c.o
+i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
+obj-y += $(i2c-omap-m) $(i2c-omap-y)

Also arch/arm/plat-omap/include/mach/common.h should be updated to check for CONFIG_I2C_OMAP_MODULE.

A.

#6 lore raw
Quoted 30 lines · Aaro Koskinen

Hello,

Quoted 18 lines · ext Jarkko Nikula

arch/arm/plat-omap/Makefile obj-$(CONFIG_OMAP_COMPONENT_VERSION) += component-version.o · line 27

Quoted 9 lines · Jarkko Nikula

Tony's version does not fix the issue since obj-$(CONFIG_I2C_OMAP) below still tries to compile arch/arm/plat-omap/i2c.c as a module.

arch/arm/plat-omap/Makefile +4 -1
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+
+ifneq ($(CONFIG_I2C_OMAP),)
+     obj-$(CONFIG_I2C_OMAP)          += i2c.o
+endif

And build works if obj-y rule is used instead

arch/arm/plat-omap/Makefile +4 -1
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+
+ifneq ($(CONFIG_I2C_OMAP),)
+       obj-y   += i2c.o
+endif
Quoted 2 lines

Good. Patch can be made to touch only single file and add only three new lines.

Taking example from fs/Makefile (nfsd):

(quoted diff) +2 -1
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
+obj-y += $(i2c-omap-m) $(i2c-omap-y)
Quoted 2 lines

Also arch/arm/plat-omap/include/mach/common.h should be updated to check for CONFIG_I2C_OMAP_MODULE.

That seems cleaner to me.

Tony

#7 lore raw
In reply to Aaro Koskinen

Review

Quoted 6 lines · On Mon, 16 Feb 2009 18:40:12 +0200 Aaro Koskinen <[email protected]>…

Taking example from fs/Makefile (nfsd):

(quoted diff) +2 -1
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
+obj-y += $(i2c-omap-m) $(i2c-omap-y)

This is getting shorter and shorter :-)

Quoted 3 lines

Also arch/arm/plat-omap/include/mach/common.h should be updated to check for CONFIG_I2C_OMAP_MODULE.

Good catch, that's true!

Jarkko

#8 lore raw
Quoted 11 lines · Jarkko Nikula

Review

Quoted 6 lines · On Mon, 16 Feb 2009 18:40:12 +0200 Aaro Koskinen <[email protected]>…

Taking example from fs/Makefile (nfsd):

(quoted diff) +2 -1
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
+obj-y += $(i2c-omap-m) $(i2c-omap-y)

This is getting shorter and shorter :-)

Quoted 4 lines
Quoted 3 lines

Also arch/arm/plat-omap/include/mach/common.h should be updated to check for CONFIG_I2C_OMAP_MODULE.

Good catch, that's true!

Aaro, can you please send a proper patch with Signed-off-by and I'll add it to omap-fixes?

Thanks

Tony

#9 lore raw
Quoted 2 lines · Tony Lindgren

Aaro, can you please send a proper patch with Signed-off-by and I'll add it to omap-fixes?

Tony: what's the purpose of omap-fixes and the difference between master and omap-2.6.28? if I want a "stable" kernel which branch should I use?

Thanks.

-otto

#10 lore raw
Quoted 7 lines · Otto Solares
Quoted 2 lines · Tony Lindgren

Aaro, can you please send a proper patch with Signed-off-by and I'll add it to omap-fixes?

Tony: what's the purpose of omap-fixes and the difference between master and omap-2.6.28? if I want a "stable" kernel which branch should I use?

Here's the quick rundown:

- master branch is current linux-omap against recent mainline kernel

- omap-fixes is the branch for fixes going to mainline during -rc cycle

- omap-upstream is a branch of generic omap patches going to mainline during the next merge window

- omap1-upstream is a branch of omap1 patches going to mainline during the next merge cycle

- omap2-upstream is a branch of omap2 patches going to mainline during the next merge cycle

- omap3-upstream is a branch of omap3 patches going to mainline during the next merge cycle

- omap-next branch is what gets pulled into linux-next and gets merged to the mainline the next merge window

The omap-2.6.28 branch is there because there were few bugs and I thought we might want to tag v2.6.28-omap2. Mostly getting the MMC working for omap1 as far as I remember.

For "stable" you should use the whatever omap tag we have against the recent mainline kernel, so yeah, it would be the omap-2.6.28 branch right now.

Regards,

Tony

#11 lore raw

PATCH 1/1 ARM: OMAP: Allow I2C bus driver to be compiled as a module

In reply to Tony Lindgren

Fixes a linker error when OMAP I2C bus driver is compiled as a module:

ERROR: "i2c_register_board_info" [arch/arm/plat-omap/i2c.ko] undefined!

The I2C utility functions used for board initialization should be always built-in.

---
 arch/arm/plat-omap/Makefile              |    3 ++-
 arch/arm/plat-omap/include/mach/common.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/plat-omap/Makefile +2 -1
index b3f0e6b..3ebc09e 100644
@@ -21,7 +21,8 @@ obj-$(CONFIG_OMAP_COMPONENT_VERSION) += component-version.o
 obj-$(CONFIG_OMAP_GPIO_SWITCH) += gpio-switch.o
 obj-$(CONFIG_OMAP_DEBUG_DEVICES) += debug-devices.o
 obj-$(CONFIG_OMAP_DEBUG_LEDS) += debug-leds.o
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
+obj-y += $(i2c-omap-m) $(i2c-omap-y)
 
 # OMAP mailbox framework
 obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o
arch/arm/plat-omap/include/mach/common.h +1 -1
index af4105f..8c1b965 100644
@@ -33,7 +33,7 @@ struct sys_timer;
 
 extern void omap_map_common_io(void);
 extern struct sys_timer omap_timer;
-#ifdef CONFIG_I2C_OMAP
+#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
 extern int omap_register_i2c_bus(int bus_id, u32 clkrate,
 				 struct i2c_board_info const *info,
 				 unsigned len);
Signature · 1 line
1.5.4.3
Acked-by on v1 1/1
#12 lore raw

Re: [PATCH] ARM: OMAP: Allow I2C bus driver to be compiled as a module

Quoted 5 lines · On Wed, 18 Feb 2009 11:22:18 +0200 Aaro Koskinen <[email protected]>…

Fixes a linker error when OMAP I2C bus driver is compiled as a module:

ERROR: "i2c_register_board_info" [arch/arm/plat-omap/i2c.ko]
undefined!

Quoted 9 lines

The I2C utility functions used for board initialization should be always built-in.

---
 arch/arm/plat-omap/Makefile              |    3 ++-
 arch/arm/plat-omap/include/mach/common.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
#13 lore raw

Re: [PATCH] ARM: OMAP: Allow I2C bus driver to be compiled as a module

Quoted 11 lines · Jarkko Nikula
Quoted 8 lines · On Wed, 18 Feb 2009 11:22:18 +0200 Aaro Koskinen <[email protected]>…

Fixes a linker error when OMAP I2C bus driver is compiled as a module:

ERROR: "i2c_register_board_info" [arch/arm/plat-omap/i2c.ko]
undefined!

The I2C utility functions used for board initialization should be always built-in.

Quoted 7 lines
Quoted 6 lines
---
 arch/arm/plat-omap/Makefile              |    3 ++-
 arch/arm/plat-omap/include/mach/common.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Applying to linux-omap and omap-fixes.

Tony

#14 lore raw

Re: [PATCH] ARM: OMAP: Allow I2C bus driver to be compiled as a module

Quoted 18 lines · Tony Lindgren
Quoted 17 lines · Jarkko Nikula
Quoted 14 lines · On Wed, 18 Feb 2009 11:22:18 +0200 Aaro Koskinen <[email protected]>…

Fixes a linker error when OMAP I2C bus driver is compiled as a module:

ERROR: "i2c_register_board_info" [arch/arm/plat-omap/i2c.ko]
undefined!

The I2C utility functions used for board initialization should be always built-in.

---
 arch/arm/plat-omap/Makefile              |    3 ++-
 arch/arm/plat-omap/include/mach/common.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
Quoted 3 lines
Quoted 1 line

Applying to linux-omap and omap-fixes.

Just curious: what about omap-2.6.28?

-otto

#15 lore raw

Re: [PATCH] ARM: OMAP: Allow I2C bus driver to be compiled as a module

Quoted 19 lines · Otto Solares
Quoted 18 lines · Tony Lindgren
Quoted 17 lines · Jarkko Nikula
Quoted 14 lines · On Wed, 18 Feb 2009 11:22:18 +0200 Aaro Koskinen <[email protected]>…

Fixes a linker error when OMAP I2C bus driver is compiled as a module:

ERROR: "i2c_register_board_info" [arch/arm/plat-omap/i2c.ko]
undefined!

The I2C utility functions used for board initialization should be always built-in.

---
 arch/arm/plat-omap/Makefile              |    3 ++-
 arch/arm/plat-omap/include/mach/common.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Applying to linux-omap and omap-fixes.

Just curious: what about omap-2.6.28?

Heh, OK pushed there too :) I think we should close that branch soon as 2.6.29 is fast approaching..

Tony

#16 lore raw

Re: [PATCH] ARM: OMAP: Allow I2C bus driver to be compiled as a module

Quoted 20 lines · Tony Lindgren
Quoted 19 lines · Otto Solares
Quoted 18 lines · Tony Lindgren
Quoted 17 lines · Jarkko Nikula
Quoted 14 lines · On Wed, 18 Feb 2009 11:22:18 +0200 Aaro Koskinen <[email protected]>…

Fixes a linker error when OMAP I2C bus driver is compiled as a module:

ERROR: "i2c_register_board_info" [arch/arm/plat-omap/i2c.ko]
undefined!

The I2C utility functions used for board initialization should be always built-in.

---
 arch/arm/plat-omap/Makefile              |    3 ++-
 arch/arm/plat-omap/include/mach/common.h |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Applying to linux-omap and omap-fixes.

Just curious: what about omap-2.6.28?

Heh, OK pushed there too :) I think we should close that branch soon as 2.6.29 is fast approaching..

It would be nice to have some bugfixing branch for stable kernels IMO ;)

-otto

#17 lore raw
In reply to Jarkko Nikula
Quoted 20 lines · Jarkko Nikula

arch/arm/plat-omap/Makefile obj-$(CONFIG_OMAP_COMPONENT_VERSION) += component-version.o · line 27

Quoted 9 lines · On Sun, 15 Feb 2009 21:35:59 +0200 Jarkko Nikula <[email protected]> wrote:

Tony's version does not fix the issue since obj-$(CONFIG_I2C_OMAP) below still tries to compile arch/arm/plat-omap/i2c.c as a module.

arch/arm/plat-omap/Makefile +4 -1
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+
+ifneq ($(CONFIG_I2C_OMAP),)
+	obj-$(CONFIG_I2C_OMAP)		+= i2c.o
+endif

And build works if obj-y rule is used instead

arch/arm/plat-omap/Makefile +4 -1
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+
+ifneq ($(CONFIG_I2C_OMAP),)
+	obj-y	+= i2c.o
+endif
Quoted 2 lines

Good. Patch can be made to touch only single file and add only three new lines.

Ah sorry for the typo :)

Tony

#18 lore raw
In reply to Jarkko Nikula

Hi,

Quoted 19 lines · Jarkko Nikula
Quoted 7 lines · On Fri, 13 Feb 2009 14:21:00 -0800 Tony Lindgren <[email protected]> wrote:
Quoted 3 lines

Subject needs a "ARM: OMAP: " prefix, otherwise ok from me.

Sounds like a fix, except I posted a shorter version of the patch that should do the trick (untested). Attached here too for reference.

Tony's version does not fix the issue since obj-$(CONFIG_I2C_OMAP) below still tries to compile arch/arm/plat-omap/i2c.c as a module.

arch/arm/plat-omap/Makefile +4 -1
-obj-$(CONFIG_I2C_OMAP) += i2c.o
+
+ifneq ($(CONFIG_I2C_OMAP),)
+	obj-$(CONFIG_I2C_OMAP)		+= i2c.o
+endif
Quoted 3 lines

Problem was that drivers/i2c/busses/i2c-omap.c can be module but arch/arm/plat-omap/i2c.c cannot since it is for early board initialization code.

why don't you:

-obj-$(CONFIG_I2C_OMAP) += i2c.o
+obj-y += i2c.o

It's quite possible that we will need i2c anyways in most boards. And for the ones who won't need, it's just a few extra bytes to kernel image. I guess it should be ok to always build i2c utilities.

Signature · 5 lines
Best Regards,

Felipe Balbi
http://blog.felipebalbi.com
[email protected]