Skip to contentSkip to conversation

module: fix mutiple defined issue

PATCH In review Inki Dae 3 participants 5 messages Apr 29, 2013 Module support

lore
Share & tools
lore

Inki Dae

author
#0 lore raw

PATCH 1/1 module: fix mutiple defined issue

This patch fixes mutiple defined issue to MODULE_DEVICE_TABLE

The issue could be induced when some framework which includes two more sub drivers, is built as one moudle because those sub drivers could have their own MODULE_DEVICE_TABLE.

And 'struct of_device_id' isn't needed to be determined by type argument because the definition of 'of_device_id' should be fixed. So this patch makes 'of_devce_id' definition to be fixed and only its instance name to be defined by type.

---
 include/linux/module.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/module.h +1 -1
index 46f1ea0..ac5d79f 100644
@@ -84,7 +84,7 @@ void trim_init_extable(struct module *m);
 
 #ifdef MODULE
 #define MODULE_GENERIC_TABLE(gtype,name)			\
-extern const struct gtype##_id __mod_##gtype##_table		\
+extern const struct of_device_id __mod_##gtype##_table		\
   __attribute__ ((unused, alias(__stringify(name))))
 
 #else  /* !MODULE */
Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 1 line · Inki Dae

This patch fixes mutiple defined issue to MODULE_DEVICE_TABLE

s/mutiple/multiple/, still this sentence doesn't sound right. What is the error message you see?

Quoted 2 lines

The issue could be induced when some framework which includes two more sub drivers, is built as one moudle because those sub drivers

s/moudle/module/

Quoted 6 lines

could have their own MODULE_DEVICE_TABLE.

And 'struct of_device_id' isn't needed to be determined by type argument because the definition of 'of_device_id' should be fixed. So this patch makes 'of_devce_id' definition to be fixed and only its instance name to be defined by type.

include/linux/isapnp.h uses:
#define ISAPNP_CARD_TABLE(name) \
MODULE_GENERIC_TABLE(isapnp_card, name)

and you changed the table's type with your patch. Ditto for all users of

	MODULE_DEVICE_TABLE(i2c, ...);
	MODULE_DEVICE_TABLE(acpi, ...);
	MODULE_DEVICE_TABLE(platform, ...);
	MODULE_DEVICE_TABLE(pci, ...);
	MODULE_DEVICE_TABLE(sdio, ...);

So I'm pretty sure your patch is wrong and I expect it makes most defconfigs fail to compile.

Best regards
Uwe

Quoted 28 lines
---
 include/linux/module.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/module.h +1 -1
index 46f1ea0..ac5d79f 100644
@@ -84,7 +84,7 @@ void trim_init_extable(struct module *m);
 
 #ifdef MODULE
 #define MODULE_GENERIC_TABLE(gtype,name)			\
-extern const struct gtype##_id __mod_##gtype##_table		\
+extern const struct of_device_id __mod_##gtype##_table		\
   __attribute__ ((unused, alias(__stringify(name))))
 
 #else  /* !MODULE */
Signature · 7 lines
1.7.5.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
author
#2 lore raw

Hi,

Quoted 30 lines

-----Original Message-----
From: [email protected] [mailto:linux-kernel- [email protected]] On Behalf Of Uwe Kleine-Konig
Sent: Monday, April 29, 2013 4:35 PM
To: Inki Dae
Cc: [email protected]; [email protected]; dri- [email protected]; [email protected]
Subject: Re: [PATCH] module: fix mutiple defined issue

Quoted 1 line · Inki Dae

This patch fixes mutiple defined issue to MODULE_DEVICE_TABLE

s/mutiple/multiple/, still this sentence doesn't sound right. What is the error message you see?

Quoted 2 lines

The issue could be induced when some framework which includes two more sub drivers, is built as one moudle because those sub drivers

s/moudle/module/

Quoted 6 lines

could have their own MODULE_DEVICE_TABLE.

And 'struct of_device_id' isn't needed to be determined by type argument because the definition of 'of_device_id' should be fixed. So this patch makes 'of_devce_id' definition to be fixed and only its instance name to be defined by type.

include/linux/isapnp.h uses:
#define ISAPNP_CARD_TABLE(name) \
MODULE_GENERIC_TABLE(isapnp_card, name)

and you changed the table's type with your patch. Ditto for all users of

Quoted 9 lines
	MODULE_DEVICE_TABLE(i2c, ...);
	MODULE_DEVICE_TABLE(acpi, ...);
	MODULE_DEVICE_TABLE(platform, ...);
	MODULE_DEVICE_TABLE(pci, ...);
	MODULE_DEVICE_TABLE(sdio, ...);

So I'm pretty sure your patch is wrong and I expect it makes most defconfigs fail to compile.

It might be my big mistake. Maybe xxx_device_id object was created device tree internally. Right? Will check it out again. So please ignore it.

Thanks,
Inki Dae

Quoted 40 lines

Best regards
Uwe

Quoted 23 lines
---
 include/linux/module.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/module.h +1 -2
index 46f1ea0..ac5d79f 100644
@@ -84,7 +84,7 @@ void trim_init_extable(struct module *m);
 
 #ifdef MODULE
 #define MODULE_GENERIC_TABLE(gtype,name)			\
-extern const struct gtype##_id __mod_##gtype##_table		\
+extern const struct of_device_id __mod_##gtype##_table		\
   __attribute__ ((unused, alias(__stringify(name))))
 
 #else  /* !MODULE */
--

1.7.5.4

Quoted 5 lines

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
In reply to Inki Dae
Quoted 21 lines · Inki Dae

This patch fixes mutiple defined issue to MODULE_DEVICE_TABLE

The issue could be induced when some framework which includes two more sub drivers, is built as one moudle because those sub drivers could have their own MODULE_DEVICE_TABLE.

And 'struct of_device_id' isn't needed to be determined by type argument because the definition of 'of_device_id' should be fixed. So this patch makes 'of_devce_id' definition to be fixed and only its instance name to be defined by type.

---
 include/linux/module.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/module.h +0 -0
index 46f1ea0..ac5d79f 100644

include/linux/module.h void trim_init_extable(struct module *m); · line 90

Quoted 8 lines
include/linux/module.h +1 -1
@@ -84,7 +84,7 @@ void trim_init_extable(struct module *m);
 
 #ifdef MODULE
 #define MODULE_GENERIC_TABLE(gtype,name)			\
-extern const struct gtype##_id __mod_##gtype##_table		\
+extern const struct of_device_id __mod_##gtype##_table		\
   __attribute__ ((unused, alias(__stringify(name))))
 
 #else  /* !MODULE */

This patch (a) looks wrong (why would a generic device table be limited to of_device_id when it could be ISAPNP or something else?) and (b) how does changing the type fix the "multiple defined issue" ? (c) include the errors that you're fixing in the commit log.

author
#4 lore raw
Quoted 40 lines

-----Original Message-----
From: [email protected] [mailto:linux-kernel- [email protected]] On Behalf Of Russell King - ARM Linux
Sent: Monday, April 29, 2013 6:52 PM
To: Inki Dae
Cc: [email protected]; [email protected]; dri- [email protected]; [email protected]
Subject: Re: [PATCH] module: fix mutiple defined issue

Quoted 28 lines · Inki Dae

This patch fixes mutiple defined issue to MODULE_DEVICE_TABLE

The issue could be induced when some framework which includes two more sub drivers, is built as one moudle because those sub drivers could have their own MODULE_DEVICE_TABLE.

And 'struct of_device_id' isn't needed to be determined by type argument because the definition of 'of_device_id' should be fixed. So this patch makes 'of_devce_id' definition to be fixed and only its instance name to be defined by type.

---
 include/linux/module.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/module.h +1 -1
index 46f1ea0..ac5d79f 100644
@@ -84,7 +84,7 @@ void trim_init_extable(struct module *m);
 
 #ifdef MODULE
 #define MODULE_GENERIC_TABLE(gtype,name)			\
-extern const struct gtype##_id __mod_##gtype##_table		\
+extern const struct of_device_id __mod_##gtype##_table		\
   __attribute__ ((unused, alias(__stringify(name))))
 
Quoted 6 lines

include/linux/module.h void trim_init_extable(struct module *m); · line 90

Quoted 1 line
include/linux/module.h +0 -0
 #else  /* !MODULE */

This patch (a) looks wrong (why would a generic device table be limited to of_device_id when it could be ISAPNP or something else?) and (b) how does changing the type fix the "multiple defined issue" ? (c) include the errors that you're fixing in the commit log.

There was my misunderstanding. So please ignore my patch. Some headers in include/linux/ have some kind of device_id structure such as of_device_id, platform_device_id, i2c_device_id, and so on. And these structures should be used properly. This was my missing point.

Thanks,
Inki Dae

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/