ACPI autoload (v2) - Create acpi alias interface
Subsystems (3)
PATCH 2/3 ACPI autoload (v2) - Create acpi alias interface
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 <[email protected]>
Signed-off-by Kay Sievers <[email protected]>
--- drivers/acpi/scan.c | 163 ++++++++++++++++++++++++++++------------ drivers/pnp/pnpacpi/core.c | 19 ++-- include/linux/acpi.h | 1 include/linux/mod_devicetable.h | 15 +++ scripts/mod/file2alias.c | 12 ++ 5 files changed, 158 insertions(+), 52 deletions(-)
include/linux/mod_devicetable.h +6 -0
@@ -159,6 +159,12 @@ struct ap_device_id {#define AP_DEVICE_ID_MATCH_DEVICE_TYPE 0x01 +#define ACPI_ID_LEN 9 + +struct acpi_device_id { +__u8 id[ACPI_ID_LEN ]; +kernel_ulong_t driver_data; +};#define PNP_ID_LEN 8#define PNP_MAX_DEVICES 8
scripts/mod/file2alias.c +12 -0
@@ -290,6 +290,14 @@ static int do_serio_entry(const char *fireturn 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 *mdo_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",
drivers/acpi/scan.c +111 -45
217 lines not on this page · raw message
drivers/pnp/pnpacpi/core.c +12 -7
@@ -21,7 +21,10 @@#include <linux/acpi.h> #include <linux/pnp.h> +#include <linux/mod_devicetable.h> #include <acpi/acpi_bus.h> +#include <acpi/actypes.h> +#include "pnpacpi.h" static int num =0 ;
@@ -33,15 +36,17 @@ static int num = 0;* have irqs (PIC, Timer) because we call acpi_register_gsi. * Finaly only devices that have a CRS method need to be in this list. */ -static char __initdata excluded_id_list[] = -"PNP0C09," /* EC */ -"PNP0C0F," /* Link device */ -"PNP0000," /* PIC */ -"PNP0100," /* Timer */ - ; +static __initdata struct acpi_device_id excluded_id_list[] ={ + {"PNP0C09" ,0 },/* EC */ + {"PNP0C0F" ,0 },/* Link device */ + {"PNP0000" ,0 },/* PIC */ + {"PNP0100" ,0 },/* Timer */ + {"" ,0 }, +}; +static inline int is_exclusive_device (struct acpi_device *dev) { -return (!acpi_match_ids (dev, excluded_id_list)); +return (!acpi_match_device_ids (dev, excluded_id_list)); }/*
include/linux/acpi.h +1 -0
@@ -33,6 +33,7 @@#endif #include <linux/list.h> +#include <linux/mod_devicetable.h> #include <acpi/acpi.h> #include <acpi/acpi_bus.h>