History

modpost: rename variables in handle_moddevtable()

This commit renames the variables in handle_moddevtable() as follows: name -> type namelen -> typelen identifier -> name These changes align with the definition in include/linux/module.h: extern typeof(name) __mod_##type##__##name##_device_table

Masahiro Yamada committed 1 year ago

Commit 9a8ace81 parent 9d980381 file · +11 −11Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/mod/file2alias.c+11−11
@@ -1503,8 +1503,8 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, · 1502 unmodified lines
15031503 {
15041504 void *symval;
15051505 char *zeros = NULL;
1506− const char *name, *identifier;
1507− unsigned int namelen;
1506+ const char *type, *name;
1507+ size_t typelen;
15081508
15091509 /* We're looking for a section relative symbol */
15101510 if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections)
@@ -1514,19 +1514,19 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, · 3 unmodified lines
15141514 if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT)
15151515 return;
15161516
1517− /* All our symbols are of form __mod_<name>__<identifier>_device_table. */
1517+ /* All our symbols are of form __mod_<type>__<name>_device_table. */
15181518 if (!strstarts(symname, "__mod_"))
15191519 return;
1520− name = symname + strlen("__mod_");
1521− namelen = strlen(name);
1522− if (namelen < strlen("_device_table"))
1520+ type = symname + strlen("__mod_");
1521+ typelen = strlen(type);
1522+ if (typelen < strlen("_device_table"))
15231523 return;
1524− if (strcmp(name + namelen - strlen("_device_table"), "_device_table"))
1524+ if (strcmp(type + typelen - strlen("_device_table"), "_device_table"))
15251525 return;
1526− identifier = strstr(name, "__");
1527− if (!identifier)
1526+ name = strstr(type, "__");
1527+ if (!name)
15281528 return;
1529− namelen = identifier - name;
1529+ typelen = name - type;
15301530
15311531 /* Handle all-NULL symbols allocated into .bss */
15321532 if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) {
@@ -1539,7 +1539,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, · 6 unmodified lines
15391539 for (int i = 0; i < ARRAY_SIZE(devtable); i++) {
15401540 const struct devtable *p = &devtable[i];
15411541
1542− if (sym_is(name, namelen, p->device_id)) {
1542+ if (sym_is(type, typelen, p->device_id)) {
15431543 do_table(symval, sym->st_size, p->id_size,
15441544 p->device_id, p->do_entry, mod);
15451545 break;