Skip to contentSkip to conversation

Define MODULE_SYSTEM_TABLE for mbp_nvidia_bl.o and applesmc.o

PATCH New Tetsuo Handa 4 participants 7 messages Dec 12, 2008 – Jan 27, 2009 2 messages not in the archive

Subsystems (6)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 3 lines · Henrik Rydberg

Umm... this does not work. At least the name change would have to be accompanied by a corresponding change in scripts/mod/file2alias.c, in order to generate the MODULE_ALIAS list in *.mod.c.

I see. Here is updated one.
----------
Subject: [2.6.28-rc8] Define MODULE_SYSTEM_TABLE for mbp_nvidia_bl.o and applesmc.o

When compiling mbp_nvidia_bl.o and applesmc.o using gcc 3.3.5, the below compilation error occurs.

CC [M] drivers/video/backlight/mbp_nvidia_bl.o drivers/video/backlight/mbp_nvidia_bl.c:114: error: storage size of `__mod_dmi_device_table' isn't known make[1]: *** [drivers/video/backlight/mbp_nvidia_bl.o] Error 1
make: *** [drivers/video/backlight/mbp_nvidia_bl.o] Error 2

CC [M] drivers/hwmon/applesmc.o
drivers/hwmon/applesmc.c:1567: error: storage size of `__mod_dmi_device_table' isn't known make[1]: *** [drivers/hwmon/applesmc.o] Error 1
make: *** [drivers/hwmon/applesmc.o] Error 2

Diffs between 2.6.27.7 and 2.6.28-rc7 are shown below.

  # diff linux-2.6.27.7/drivers/video/backlight/mbp_nvidia_bl.c linux-2.6.28-rc7/drivers/video/backlight/mbp_nvidia_bl.c
  114,116c114
  < MODULE_ALIAS("svnAppleInc.:pnMacBookPro3,1");
  < MODULE_ALIAS("svnAppleInc.:pnMacBookPro3,2");
  < MODULE_ALIAS("svnAppleInc.:pnMacBookPro4,1");
  ---
Quoted 1 line

MODULE_DEVICE_TABLE(dmi, mbp_device_table);

We can see that MODULE_ALIAS is replaced by MODULE_DEVICE_TABLE.

mbp_nvidia_bl.c and applesmc.c are using MODULE_DEVICE_TABLE(dmi, ...); which will extracted to __mod_dmi_device_table, but it seems to me that dmi does not define __mod_dmi_device_table.

I don't know why gcc 4.x doesn't trigger this compilation error.

I don't know whether mbp_nvidia_bl.o and applesmc.o compiled with this patch work or not. Can somebody who has these hardwares try this patch?

---
 drivers/hwmon/applesmc.c                |    2 +-
 drivers/video/backlight/mbp_nvidia_bl.c |    2 +-
 include/linux/module.h                  |    2 ++
 scripts/mod/file2alias.c                |    2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)
drivers/hwmon/applesmc.c +1 -1
@@ -1564,4 +1564,4 @@ module_exit(applesmc_exit);
 MODULE_AUTHOR("Nicolas Boichat");
 MODULE_DESCRIPTION("Apple SMC");
 MODULE_LICENSE("GPL v2");
-MODULE_DEVICE_TABLE(dmi, applesmc_whitelist);
+MODULE_SYSTEM_TABLE(dmi, applesmc_whitelist);
drivers/video/backlight/mbp_nvidia_bl.c +1 -1
@@ -111,4 +111,4 @@ module_exit(mbp_exit);
 MODULE_AUTHOR("Matthew Garrett <[email protected]>");
 MODULE_DESCRIPTION("Nvidia-based Macbook Pro Backlight Driver");
 MODULE_LICENSE("GPL");
-MODULE_DEVICE_TABLE(dmi, mbp_device_table);
+MODULE_SYSTEM_TABLE(dmi, mbp_device_table);
include/linux/module.h +2 -0
@@ -139,6 +139,8 @@ extern struct module __this_module;
 
 #define MODULE_DEVICE_TABLE(type,name)		\
   MODULE_GENERIC_TABLE(type##_device,name)
+#define MODULE_SYSTEM_TABLE(type,name)		\
+  MODULE_GENERIC_TABLE(type##_system,name)
 
 /* Version of form [<epoch>:]<version>[-<extra-version>].
    Or for CVS/RCS ID version, everything but the number is stripped.
scripts/mod/file2alias.c +1 -1
@@ -831,7 +831,7 @@ void handle_moddevtable(struct module *m
 		do_table(symval, sym->st_size,
 			 sizeof(struct i2c_device_id), "i2c",
 			 do_i2c_entry, mod);
-	else if (sym_is(symname, "__mod_dmi_device_table"))
+	else if (sym_is(symname, "__mod_dmi_system_table"))
 		do_table(symval, sym->st_size,
 			 sizeof(struct dmi_system_id), "dmi",
 			 do_dmi_entry, mod);
#3 lore raw

drivers/hwmon/applesmc.c module_exit(applesmc_exit); · line 1567

Quoted 2 lines
drivers/hwmon/applesmc.c +1 -1
-MODULE_DEVICE_TABLE(dmi, applesmc_whitelist);
+MODULE_SYSTEM_TABLE(dmi, applesmc_whitelist);

I sent patch which does "#define dmi_device_id dmi_system_id" and thus avoids yet another wrapper.

#4 lore raw

Re: [patch 18/19] Define MODULE_SYSTEM_TABLE for mbp_nvidia_bl.oand applesmc.o

Quoted 6 lines · Alexey Dobriyan

drivers/hwmon/applesmc.c module_exit(applesmc_exit); · line 1567

Quoted 2 lines
drivers/hwmon/applesmc.c +1 -1
-MODULE_DEVICE_TABLE(dmi, applesmc_whitelist);
+MODULE_SYSTEM_TABLE(dmi, applesmc_whitelist);

I sent patch which does "#define dmi_device_id dmi_system_id" and thus avoids yet another wrapper.

I see. I'll try your patch after it is merged (2.6.28-rc8-gitX or 2.6.28-rc9 ?).

Thanks.

#5 lore raw
Quoted 8 lines · Tetsuo Handa
Quoted 6 lines · Alexey Dobriyan

drivers/hwmon/applesmc.c module_exit(applesmc_exit); · line 1567

Quoted 2 lines
drivers/hwmon/applesmc.c +1 -1
-MODULE_DEVICE_TABLE(dmi, applesmc_whitelist);
+MODULE_SYSTEM_TABLE(dmi, applesmc_whitelist);

I sent patch which does "#define dmi_device_id dmi_system_id" and thus avoids yet another wrapper.

I see. I'll try your patch after it is merged (2.6.28-rc8-gitX or 2.6.28-rc9 ?).

It's 2.6.28-rc9 now, but your patch is not applied yet. Did somebody catch the "#define dmi_device_id dmi_system_id" patch?

Thanks.

#6 lore raw
In reply to Alexey Dobriyan
Quoted 5 lines · On Fri, 12 Dec 2008 07:25:03 +0300 Alexey Dobriyan <[email protected]> wrote:

drivers/hwmon/applesmc.c module_exit(applesmc_exit); · line 1567

Quoted 2 lines
drivers/hwmon/applesmc.c +1 -1
-MODULE_DEVICE_TABLE(dmi, applesmc_whitelist);
+MODULE_SYSTEM_TABLE(dmi, applesmc_whitelist);

I sent patch which does "#define dmi_device_id dmi_system_id" and thus avoids yet another wrapper.

What was the fate of this patch?

If it's still needed, please resend.

#7 lore raw
Quoted 10 lines · Andrew Morton
Quoted 4 lines · On Fri, 12 Dec 2008 07:25:03 +0300 Alexey Dobriyan <[email protected]> wrote:

drivers/hwmon/applesmc.c module_exit(applesmc_exit); · line 1567

Quoted 2 lines
drivers/hwmon/applesmc.c +1 -1
-MODULE_DEVICE_TABLE(dmi, applesmc_whitelist);
+MODULE_SYSTEM_TABLE(dmi, applesmc_whitelist);

I sent patch which does "#define dmi_device_id dmi_system_id" and thus avoids yet another wrapper.

What was the fate of this patch?

If it's still needed, please resend.

I'll send David's minipatch to you shortly, for piece of mind.

Thanks,
Henrik

#8 lore raw

PATCH 1/1 include/linux/mod_devicetable.h: fix compilation problem induced by MODULE_DEVICE_TABLE(dmi, ...)

In reply to Andrew Morton

From: Alexey Dobriyan <[email protected]>

Bugzilla 12483:

Kernel build fails with gcc3 (not gcc4), because MODULE_DEVICE_TABLE(dmi, ...) expands to extern const struct dmi_device_id __mod_dmi_device_table, and struct dmi_device_id doesn't exist.

Steps to reproduce:
Build kernel 2.6.28 or 2.6.29-rc2 on x86 with gcc 3.

This patch remedies the problem.

---
 include/linux/mod_devicetable.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/mod_devicetable.h +1 -0
index 97b91d1..aec76e6 100644
@@ -443,6 +443,7 @@ struct dmi_system_id {
 	struct dmi_strmatch matches[4];
 	void *driver_data;
 };
+#define dmi_device_id dmi_system_id
 #endif
 
 #define DMI_MATCH(a, b)	{ a, b }
Signature · 1 line
1.5.6.3