From 29b71a1ca74491fab9fed09e9d835d840d042690 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Mon, 23 Jul 2007 14:43:51 +0200 Subject: ACPI: autoload modules - Create ACPI alias interface Modify modpost (file2alias.c) to add acpi*:XYZ0001: alias in modules.alias like: grep acpi /lib/modules/2.6.22-rc4-default/modules.alias alias acpi*:SNY5001:* sony_laptop alias acpi*:SNY6001:* sony_laptop for e.g. the sony_laptop module. This module matches against all ACPI devices with a HID or CID of SNY5001 or SNY6001 Export an uevent and modalias sysfs file containing the string: [MODALIAS=]acpi:PNP0C0C: additional CIDs are concatenated at the end. Signed-off-by: Thomas Renninger Signed-off-by: Kay Sievers Signed-off-by: Len Brown --- scripts/mod/file2alias.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'scripts') diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index f646381dc015..8a09021d8c59 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -290,6 +290,14 @@ static int do_serio_entry(const char *filename, return 1; } +/* looks like: "acpi:ACPI0003 or acpi:PNP0C0B" or "acpi:LNXVIDEO" */ +static int do_acpi_entry(const char *filename, + struct acpi_device_id *id, char *alias) +{ + sprintf(alias, "acpi*:%s:", id->id); + return 1; +} + /* looks like: "pnp:dD" */ static int do_pnp_entry(const char *filename, struct pnp_device_id *id, char *alias) @@ -551,6 +559,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, do_table(symval, sym->st_size, sizeof(struct serio_device_id), "serio", do_serio_entry, mod); + else if (sym_is(symname, "__mod_acpi_device_table")) + do_table(symval, sym->st_size, + sizeof(struct acpi_device_id), "acpi", + do_acpi_entry, mod); else if (sym_is(symname, "__mod_pnp_device_table")) do_table(symval, sym->st_size, sizeof(struct pnp_device_id), "pnp", -- cgit v1.2.3-59-g8ed1b