aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/module.h2
-rw-r--r--scripts/mod/file2alias.c14
2 files changed, 10 insertions, 6 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index eaf60ff9ba94..ad18f6006f86 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -142,7 +142,7 @@ extern const struct gtype##_id __mod_##gtype##_table \
142#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) 142#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
143 143
144#define MODULE_DEVICE_TABLE(type, name) \ 144#define MODULE_DEVICE_TABLE(type, name) \
145 MODULE_GENERIC_TABLE(type##_device, name) 145 MODULE_GENERIC_TABLE(type##__##name##_device, name)
146 146
147/* Version of form [<epoch>:]<version>[-<extra-version>]. 147/* Version of form [<epoch>:]<version>[-<extra-version>].
148 * Or for CVS/RCS ID version, everything but the number is stripped. 148 * Or for CVS/RCS ID version, everything but the number is stripped.
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 25e5cb0aaef6..ce164044f0cc 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -42,7 +42,7 @@ typedef unsigned char __u8;
42 42
43/* This array collects all instances that use the generic do_table */ 43/* This array collects all instances that use the generic do_table */
44struct devtable { 44struct devtable {
45 const char *device_id; /* name of table, __mod_<name>_device_table. */ 45 const char *device_id; /* name of table, __mod_<name>__*_device_table. */
46 unsigned long id_size; 46 unsigned long id_size;
47 void *function; 47 void *function;
48}; 48};
@@ -146,7 +146,8 @@ static void device_id_check(const char *modname, const char *device_id,
146 146
147 if (size % id_size || size < id_size) { 147 if (size % id_size || size < id_size) {
148 fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo " 148 fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo "
149 "of the size of section __mod_%s_device_table=%lu.\n" 149 "of the size of "
150 "section __mod_%s__<identifier>_device_table=%lu.\n"
150 "Fix definition of struct %s_device_id " 151 "Fix definition of struct %s_device_id "
151 "in mod_devicetable.h\n", 152 "in mod_devicetable.h\n",
152 modname, device_id, id_size, device_id, size, device_id); 153 modname, device_id, id_size, device_id, size, device_id);
@@ -1206,7 +1207,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1206{ 1207{
1207 void *symval; 1208 void *symval;
1208 char *zeros = NULL; 1209 char *zeros = NULL;
1209 const char *name; 1210 const char *name, *identifier;
1210 unsigned int namelen; 1211 unsigned int namelen;
1211 1212
1212 /* We're looking for a section relative symbol */ 1213 /* We're looking for a section relative symbol */
@@ -1217,7 +1218,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1217 if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) 1218 if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT)
1218 return; 1219 return;
1219 1220
1220 /* All our symbols are of form <prefix>__mod_XXX_device_table. */ 1221 /* All our symbols are of form <prefix>__mod_<name>__<identifier>_device_table. */
1221 name = strstr(symname, "__mod_"); 1222 name = strstr(symname, "__mod_");
1222 if (!name) 1223 if (!name)
1223 return; 1224 return;
@@ -1227,7 +1228,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1227 return; 1228 return;
1228 if (strcmp(name + namelen - strlen("_device_table"), "_device_table")) 1229 if (strcmp(name + namelen - strlen("_device_table"), "_device_table"))
1229 return; 1230 return;
1230 namelen -= strlen("_device_table"); 1231 identifier = strstr(name, "__");
1232 if (!identifier)
1233 return;
1234 namelen = identifier - name;
1231 1235
1232 /* Handle all-NULL symbols allocated into .bss */ 1236 /* Handle all-NULL symbols allocated into .bss */
1233 if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) { 1237 if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) {