summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2024-11-20 08:56:47 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2024-11-28 08:46:02 +0900
commit600dbaf1e2f0c0b70b2d3e7513a161b884e7718f (patch)
tree62ba69333570bf4b4221ff69cc1fbd0d2e757c10 /scripts
parenta5d8d417e62ab3823a06e1bc08634d737d810e59 (diff)
modpost: convert do_pnp_device_entry() to a generic handler
do_pnp_device_entry() no longer needs to iterate over the pnp_device_id array. Convert it to a generic ->do_entry() handler. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mod/file2alias.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 00bb3f8f0647..cacfa0de634b 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -627,27 +627,16 @@ static void do_acpi_entry(struct module *mod, void *symval)
}
/* looks like: "pnp:dD" */
-static void do_pnp_device_entry(void *symval, unsigned long size,
- struct module *mod)
+static void do_pnp_device_entry(struct module *mod, void *symval)
{
- const unsigned long id_size = SIZE_pnp_device_id;
- const unsigned int count = (size / id_size)-1;
- unsigned int i;
-
- device_id_check(mod->name, "pnp", size, id_size, symval);
-
- for (i = 0; i < count; i++) {
- DEF_FIELD_ADDR(symval + i*id_size, pnp_device_id, id);
- char acpi_id[sizeof(*id)];
- int j;
-
- module_alias_printf(mod, false, "pnp:d%s*", *id);
+ DEF_FIELD_ADDR(symval, pnp_device_id, id);
+ char acpi_id[sizeof(*id)];
- /* fix broken pnp bus lowercasing */
- for (j = 0; j < sizeof(acpi_id); j++)
- acpi_id[j] = toupper((*id)[j]);
- module_alias_printf(mod, false, "acpi*:%s:*", acpi_id);
- }
+ /* fix broken pnp bus lowercasing */
+ for (unsigned int i = 0; i < sizeof(acpi_id); i++)
+ acpi_id[i] = toupper((*id)[i]);
+ module_alias_printf(mod, false, "pnp:d%s*", *id);
+ module_alias_printf(mod, false, "acpi*:%s:*", acpi_id);
}
/* looks like: "pnp:dD" for every device of the card */
@@ -1531,6 +1520,7 @@ static const struct devtable devtable[] = {
{"cdx", SIZE_cdx_device_id, do_cdx_entry},
{"vchiq", SIZE_vchiq_device_id, do_vchiq_entry},
{"coreboot", SIZE_coreboot_device_id, do_coreboot_entry},
+ {"pnp", SIZE_pnp_device_id, do_pnp_device_entry},
{"pnp_card", SIZE_pnp_card_device_id, do_pnp_card_entry},
};
@@ -1580,8 +1570,6 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
do_usb_table(symval, sym->st_size, mod);
else if (sym_is(name, namelen, "of"))
do_of_table(symval, sym->st_size, mod);
- else if (sym_is(name, namelen, "pnp"))
- do_pnp_device_entry(symval, sym->st_size, mod);
else {
int i;