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

From: Tetsuo Handa
Date: Thu Dec 11 2008 - 22:06:18 EST


Henrik Rydberg wrote:
> 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");
---
> 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?

Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Henrik Rydberg <rydberg@xxxxxxxxxxx>
---
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(-)

--- linux-2.6.28-rc8.orig/drivers/hwmon/applesmc.c
+++ linux-2.6.28-rc8/drivers/hwmon/applesmc.c
@@ -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);
--- linux-2.6.28-rc8.orig/drivers/video/backlight/mbp_nvidia_bl.c
+++ linux-2.6.28-rc8/drivers/video/backlight/mbp_nvidia_bl.c
@@ -111,4 +111,4 @@ module_exit(mbp_exit);
MODULE_AUTHOR("Matthew Garrett <mjg@xxxxxxxxxx>");
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);
--- linux-2.6.28-rc8.orig/include/linux/module.h
+++ linux-2.6.28-rc8/include/linux/module.h
@@ -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.
--- linux-2.6.28-rc8.orig/scripts/mod/file2alias.c
+++ linux-2.6.28-rc8/scripts/mod/file2alias.c
@@ -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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/