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

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
1503{1503{
1504 void *symval;1504 void *symval;
1505 char *zeros = NULL;1505 char *zeros = NULL;
1506 const char *name, *identifier;1506 const char *type, *name;
1507 unsigned int namelen;1507 size_t typelen;
1508 1508
1509 /* We're looking for a section relative symbol */1509 /* We're looking for a section relative symbol */
1510 if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections)1510 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
1514 if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT)1514 if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT)
1515 return;1515 return;
1516 1516
1517 /* All our symbols are of form __mod_<name>__<identifier>_device_table. */1517 /* All our symbols are of form __mod_<type>__<name>_device_table. */
1518 if (!strstarts(symname, "__mod_"))1518 if (!strstarts(symname, "__mod_"))
1519 return;1519 return;
1520 name = symname + strlen("__mod_");1520 type = symname + strlen("__mod_");
1521 namelen = strlen(name);1521 typelen = strlen(type);
1522 if (namelen < strlen("_device_table"))1522 if (typelen < strlen("_device_table"))
1523 return;1523 return;
1524 if (strcmp(name + namelen - strlen("_device_table"), "_device_table"))1524 if (strcmp(type + typelen - strlen("_device_table"), "_device_table"))
1525 return;1525 return;
1526 identifier = strstr(name, "__");1526 name = strstr(type, "__");
1527 if (!identifier)1527 if (!name)
1528 return;1528 return;
1529 namelen = identifier - name;1529 typelen = name - type;
1530 1530
1531 /* Handle all-NULL symbols allocated into .bss */1531 /* Handle all-NULL symbols allocated into .bss */
1532 if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) {1532 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
1539 for (int i = 0; i < ARRAY_SIZE(devtable); i++) {1539 for (int i = 0; i < ARRAY_SIZE(devtable); i++) {
1540 const struct devtable *p = &devtable[i];1540 const struct devtable *p = &devtable[i];
1541 1541
1542 if (sym_is(name, namelen, p->device_id)) {1542 if (sym_is(type, typelen, p->device_id)) {
1543 do_table(symval, sym->st_size, p->id_size,1543 do_table(symval, sym->st_size, p->id_size,
1544 p->device_id, p->do_entry, mod);1544 p->device_id, p->do_entry, mod);
1545 break;1545 break;