This commit renames the alias symbol, __mod_<type>__<name>_device_table to __mod_device_table__<type>__<name>. This change simplifies the code slightly, as there is no longer a need to check both the prefix and suffix.
Showing the changes to scripts (1 of 2 files). Show all
Unified · Split
| @@ -123,7 +123,7 @@ typedef struct { · 122 unmodified lines | |||
| 123 | #include "../../include/linux/mod_devicetable.h" | 123 | #include "../../include/linux/mod_devicetable.h" |
| 124 | 124 | ||
| 125 | struct devtable { | 125 | struct devtable { |
| 126 | const char *device_id; /* name of table, __mod_<name>__*_device_table. */ | 126 | const char *device_id; |
| 127 | unsigned long id_size; | 127 | unsigned long id_size; |
| 128 | void (*do_entry)(struct module *mod, void *symval); | 128 | void (*do_entry)(struct module *mod, void *symval); |
| 129 | }; | 129 | }; |
| @@ -190,7 +190,7 @@ static void device_id_check(const char *modname, const char *device_id, · 60 unmodified lines | |||
| 190 | int i; | 190 | int i; |
| 191 | 191 | ||
| 192 | if (size % id_size || size < id_size) { | 192 | if (size % id_size || size < id_size) { |
| 193 | fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo of the size of section __mod_%s__<identifier>_device_table=%lu.\n" | 193 | fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo of the size of section __mod_device_table__%s__<identifier>=%lu.\n" |
| 194 | "Fix definition of struct %s_device_id in mod_devicetable.h\n", | 194 | "Fix definition of struct %s_device_id in mod_devicetable.h\n", |
| 195 | modname, device_id, id_size, device_id, size, device_id); | 195 | modname, device_id, id_size, device_id, size, device_id); |
| 196 | } | 196 | } |
| @@ -1505,6 +1505,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, · 1308 unmodified lines | |||
| 1505 | char *zeros = NULL; | 1505 | char *zeros = NULL; |
| 1506 | const char *type, *name; | 1506 | const char *type, *name; |
| 1507 | size_t typelen; | 1507 | size_t typelen; |
| 1508 | static const char *prefix = "__mod_device_table__"; | ||
| 1508 | 1509 | ||
| 1509 | /* We're looking for a section relative symbol */ | 1510 | /* We're looking for a section relative symbol */ |
| 1510 | if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections) | 1511 | if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections) |
| @@ -1514,15 +1515,11 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, · 3 unmodified lines | |||
| 1514 | if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) | 1515 | if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) |
| 1515 | return; | 1516 | return; |
| 1516 | 1517 | ||
| 1517 | /* All our symbols are of form __mod_<type>__<name>_device_table. */ | 1518 | /* All our symbols are of form __mod_device_table__<type>__<name>. */ |
| 1518 | if (!strstarts(symname, "__mod_")) | 1519 | if (!strstarts(symname, prefix)) |
| 1519 | return; | ||
| 1520 | type = symname + strlen("__mod_"); | ||
| 1521 | typelen = strlen(type); | ||
| 1522 | if (typelen < strlen("_device_table")) | ||
| 1523 | return; | ||
| 1524 | if (strcmp(type + typelen - strlen("_device_table"), "_device_table")) | ||
| 1525 | return; | 1520 | return; |
| 1521 | type = symname + strlen(prefix); | ||
| 1522 | |||
| 1526 | name = strstr(type, "__"); | 1523 | name = strstr(type, "__"); |
| 1527 | if (!name) | 1524 | if (!name) |
| 1528 | return; | 1525 | return; |