Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761703AbXFQU0e (ORCPT ); Sun, 17 Jun 2007 16:26:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1761569AbXFQU0X (ORCPT ); Sun, 17 Jun 2007 16:26:23 -0400 Received: from ns2.suse.de ([195.135.220.15]:35051 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761062AbXFQU0S (ORCPT ); Sun, 17 Jun 2007 16:26:18 -0400 Subject: [PATCH 3/3] ACPI autoloading - Create __mod_acpi_device_table symbol for all acpi drivers. From: Thomas Renninger Reply-To: trenn@suse.de To: Len Brown Cc: linux-kernel , linux-acpi , Henrique de Moraes Holschuh Content-Type: multipart/mixed; boundary="=-7blMUuGpWSInmnTy5PaX" Date: Sun, 17 Jun 2007 22:24:23 +0200 Message-Id: <1182111863.4204.6.camel@noname> Mime-Version: 1.0 X-Mailer: Evolution 2.6.0 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 44615 Lines: 1328 --=-7blMUuGpWSInmnTy5PaX Content-Type: text/plain Content-Transfer-Encoding: 7bit Create __mod_acpi_device_table symbol for all acpi drivers. modpost is going to use this one to create modules.alias Hopefully thinkpad module still works. IMO this one should get restructured and make use of acpi_bus_register_driver and try to avoid to test for HIDs/CIDs for its own. Signed-off-by: Thomas Renninger --- drivers/acpi/ac.c | 9 +++++++-- drivers/acpi/acpi_memhotplug.c | 8 +++++++- drivers/acpi/asus_acpi.c | 11 ++++++++--- drivers/acpi/battery.c | 10 ++++++++-- drivers/acpi/button.c | 10 +++++++++- drivers/acpi/container.c | 10 +++++++++- drivers/acpi/ec.c | 15 +++++++++++++-- drivers/acpi/fan.c | 8 +++++++- drivers/acpi/pci_link.c | 9 +++++++-- drivers/acpi/pci_root.c | 9 +++++++-- drivers/acpi/power.c | 8 +++++++- drivers/acpi/processor_core.c | 8 +++++++- drivers/acpi/sbs.c | 9 +++++++-- drivers/acpi/thermal.c | 8 +++++++- drivers/acpi/video.c | 8 +++++++- drivers/char/hpet.c | 8 +++++++- drivers/input/misc/atlas_btns.c | 9 +++++++-- drivers/misc/asus-laptop.c | 9 +++++++-- drivers/misc/sony-laptop.c | 21 +++++++++++++++++++-- drivers/misc/thinkpad_acpi.c | 31 +++++++++++++++++++++++++++---- drivers/misc/thinkpad_acpi.h | 2 +- 21 files changed, 185 insertions(+), 35 deletions(-) Index: linux-2.6.22-rc4/drivers/acpi/button.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/button.c +++ linux-2.6.22-rc4/drivers/acpi/button.c @@ -66,6 +66,14 @@ MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION("ACPI Button Driver"); MODULE_LICENSE("GPL"); +static const struct acpi_device_id button_device_ids[] = { + {ACPI_BUTTON_HID_LID, 0}, + {ACPI_BUTTON_HID_SLEEP, 0}, + {ACPI_BUTTON_HID_POWER, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, button_device_ids); + static int acpi_button_add(struct acpi_device *device); static int acpi_button_remove(struct acpi_device *device, int type); static int acpi_button_info_open_fs(struct inode *inode, struct file *file); @@ -74,7 +82,7 @@ static int acpi_button_state_open_fs(str static struct acpi_driver acpi_button_driver = { .name = "button", .class = ACPI_BUTTON_CLASS, - .ids = "button_power,button_sleep,PNP0C0D,PNP0C0C,PNP0C0E", + .ids = button_device_ids, .ops = { .add = acpi_button_add, .remove = acpi_button_remove, Index: linux-2.6.22-rc4/drivers/acpi/asus_acpi.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/asus_acpi.c +++ linux-2.6.22-rc4/drivers/acpi/asus_acpi.c @@ -56,7 +56,6 @@ #define ACPI_HOTK_NAME "Asus Laptop ACPI Extras Driver" #define ACPI_HOTK_CLASS "hotkey" #define ACPI_HOTK_DEVICE_NAME "Hotkey" -#define ACPI_HOTK_HID "ATK0100" /* * Some events we use, same for all Asus @@ -426,14 +425,20 @@ static struct acpi_table_header *asus_in static struct asus_hotk *hotk; /* - * The hotkey driver declaration + * The hotkey driver and autoloading declaration */ static int asus_hotk_add(struct acpi_device *device); static int asus_hotk_remove(struct acpi_device *device, int type); +static const struct acpi_device_id asus_device_ids[] = { + {"ATK0100", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, asus_device_ids); + static struct acpi_driver asus_hotk_driver = { .name = "asus_acpi", .class = ACPI_HOTK_CLASS, - .ids = ACPI_HOTK_HID, + .ids = asus_device_ids, .ops = { .add = asus_hotk_add, .remove = asus_hotk_remove, Index: linux-2.6.22-rc4/drivers/acpi/fan.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/fan.c +++ linux-2.6.22-rc4/drivers/acpi/fan.c @@ -50,10 +50,16 @@ static int acpi_fan_remove(struct acpi_d static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state); static int acpi_fan_resume(struct acpi_device *device); +static const struct acpi_device_id fan_device_ids[] = { + {"PNP0C0B", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, fan_device_ids); + static struct acpi_driver acpi_fan_driver = { .name = "fan", .class = ACPI_FAN_CLASS, - .ids = "PNP0C0B", + .ids = fan_device_ids, .ops = { .add = acpi_fan_add, .remove = acpi_fan_remove, Index: linux-2.6.22-rc4/drivers/acpi/container.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/container.c +++ linux-2.6.22-rc4/drivers/acpi/container.c @@ -52,10 +52,18 @@ MODULE_LICENSE("GPL"); static int acpi_container_add(struct acpi_device *device); static int acpi_container_remove(struct acpi_device *device, int type); +static const struct acpi_device_id container_device_ids[] = { + {"ACPI0004", 0}, + {"PNP0A05", 0}, + {"PNP0A06", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, container_device_ids); + static struct acpi_driver acpi_container_driver = { .name = "container", .class = ACPI_CONTAINER_CLASS, - .ids = "ACPI0004,PNP0A05,PNP0A06", + .ids = container_device_ids, .ops = { .add = acpi_container_add, .remove = acpi_container_remove, Index: linux-2.6.22-rc4/drivers/acpi/sbs.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/sbs.c +++ linux-2.6.22-rc4/drivers/acpi/sbs.c @@ -38,7 +38,6 @@ #define ACPI_SBS_CLASS "sbs" #define ACPI_AC_CLASS "ac_adapter" #define ACPI_BATTERY_CLASS "battery" -#define ACPI_SBS_HID "ACPI0002" #define ACPI_SBS_DEVICE_NAME "Smart Battery System" #define ACPI_SBS_FILE_INFO "info" #define ACPI_SBS_FILE_STATE "state" @@ -124,10 +123,16 @@ static int acpi_sbs_add(struct acpi_devi static int acpi_sbs_remove(struct acpi_device *device, int type); static int acpi_sbs_resume(struct acpi_device *device); +static const struct acpi_device_id sbs_device_ids[] = { + {"ACPI0002", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, sbs_device_ids); + static struct acpi_driver acpi_sbs_driver = { .name = "sbs", .class = ACPI_SBS_CLASS, - .ids = ACPI_SBS_HID, + .ids = sbs_device_ids, .ops = { .add = acpi_sbs_add, .remove = acpi_sbs_remove, Index: linux-2.6.22-rc4/drivers/acpi/battery.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/battery.c +++ linux-2.6.22-rc4/drivers/acpi/battery.c @@ -41,7 +41,6 @@ #define ACPI_BATTERY_COMPONENT 0x00040000 #define ACPI_BATTERY_CLASS "battery" -#define ACPI_BATTERY_HID "PNP0C0A" #define ACPI_BATTERY_DEVICE_NAME "Battery" #define ACPI_BATTERY_FILE_INFO "info" #define ACPI_BATTERY_FILE_STATUS "state" @@ -65,10 +64,16 @@ static int acpi_battery_add(struct acpi_ static int acpi_battery_remove(struct acpi_device *device, int type); static int acpi_battery_resume(struct acpi_device *device); +static const struct acpi_device_id battery_device_ids[] = { + {"PNP0C0A", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, battery_device_ids); + static struct acpi_driver acpi_battery_driver = { .name = "battery", .class = ACPI_BATTERY_CLASS, - .ids = ACPI_BATTERY_HID, + .ids = battery_device_ids, .ops = { .add = acpi_battery_add, .resume = acpi_battery_resume, Index: linux-2.6.22-rc4/drivers/acpi/thermal.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/thermal.c +++ linux-2.6.22-rc4/drivers/acpi/thermal.c @@ -92,10 +92,16 @@ static int acpi_thermal_polling_open_fs( static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, size_t, loff_t *); +static const struct acpi_device_id thermal_device_ids[] = { + {ACPI_THERMAL_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, thermal_device_ids); + static struct acpi_driver acpi_thermal_driver = { .name = "thermal", .class = ACPI_THERMAL_CLASS, - .ids = ACPI_THERMAL_HID, + .ids = thermal_device_ids, .ops = { .add = acpi_thermal_add, .remove = acpi_thermal_remove, Index: linux-2.6.22-rc4/drivers/acpi/ac.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/ac.c +++ linux-2.6.22-rc4/drivers/acpi/ac.c @@ -34,7 +34,6 @@ #define ACPI_AC_COMPONENT 0x00020000 #define ACPI_AC_CLASS "ac_adapter" -#define ACPI_AC_HID "ACPI0003" #define ACPI_AC_DEVICE_NAME "AC Adapter" #define ACPI_AC_FILE_STATE "state" #define ACPI_AC_NOTIFY_STATUS 0x80 @@ -56,10 +55,16 @@ static int acpi_ac_add(struct acpi_devic static int acpi_ac_remove(struct acpi_device *device, int type); static int acpi_ac_open_fs(struct inode *inode, struct file *file); +const static struct acpi_device_id ac_device_ids[] = { + {"ACPI0003", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, ac_device_ids); + static struct acpi_driver acpi_ac_driver = { .name = "ac", .class = ACPI_AC_CLASS, - .ids = ACPI_AC_HID, + .ids = ac_device_ids, .ops = { .add = acpi_ac_add, .remove = acpi_ac_remove, Index: linux-2.6.22-rc4/drivers/acpi/pci_link.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/pci_link.c +++ linux-2.6.22-rc4/drivers/acpi/pci_link.c @@ -46,7 +46,6 @@ #define _COMPONENT ACPI_PCI_COMPONENT ACPI_MODULE_NAME("pci_link"); #define ACPI_PCI_LINK_CLASS "pci_irq_routing" -#define ACPI_PCI_LINK_HID "PNP0C0F" #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" #define ACPI_PCI_LINK_FILE_INFO "info" #define ACPI_PCI_LINK_FILE_STATUS "state" @@ -54,10 +53,16 @@ ACPI_MODULE_NAME("pci_link"); static int acpi_pci_link_add(struct acpi_device *device); static int acpi_pci_link_remove(struct acpi_device *device, int type); +static struct acpi_device_id link_device_ids[] = { + {"PNP0C0F", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, link_device_ids); + static struct acpi_driver acpi_pci_link_driver = { .name = "pci_link", .class = ACPI_PCI_LINK_CLASS, - .ids = ACPI_PCI_LINK_HID, + .ids = link_device_ids, .ops = { .add = acpi_pci_link_add, .remove = acpi_pci_link_remove, Index: linux-2.6.22-rc4/drivers/acpi/pci_root.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/pci_root.c +++ linux-2.6.22-rc4/drivers/acpi/pci_root.c @@ -38,16 +38,21 @@ #define _COMPONENT ACPI_PCI_COMPONENT ACPI_MODULE_NAME("pci_root"); #define ACPI_PCI_ROOT_CLASS "pci_bridge" -#define ACPI_PCI_ROOT_HID "PNP0A03" #define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge" static int acpi_pci_root_add(struct acpi_device *device); static int acpi_pci_root_remove(struct acpi_device *device, int type); static int acpi_pci_root_start(struct acpi_device *device); +static struct acpi_device_id root_device_ids[] = { + {"PNP0A03", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, root_device_ids); + static struct acpi_driver acpi_pci_root_driver = { .name = "pci_root", .class = ACPI_PCI_ROOT_CLASS, - .ids = ACPI_PCI_ROOT_HID, + .ids = root_device_ids, .ops = { .add = acpi_pci_root_add, .remove = acpi_pci_root_remove, Index: linux-2.6.22-rc4/drivers/acpi/power.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/power.c +++ linux-2.6.22-rc4/drivers/acpi/power.c @@ -59,10 +59,16 @@ static int acpi_power_remove(struct acpi static int acpi_power_resume(struct acpi_device *device); static int acpi_power_open_fs(struct inode *inode, struct file *file); +static struct acpi_device_id power_device_ids[] = { + {ACPI_POWER_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, power_device_ids); + static struct acpi_driver acpi_power_driver = { .name = "power", .class = ACPI_POWER_CLASS, - .ids = ACPI_POWER_HID, + .ids = power_device_ids, .ops = { .add = acpi_power_add, .remove = acpi_power_remove, Index: linux-2.6.22-rc4/drivers/acpi/acpi_memhotplug.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/acpi_memhotplug.c +++ linux-2.6.22-rc4/drivers/acpi/acpi_memhotplug.c @@ -53,10 +53,16 @@ static int acpi_memory_device_add(struct static int acpi_memory_device_remove(struct acpi_device *device, int type); static int acpi_memory_device_start(struct acpi_device *device); +static const struct acpi_device_id memory_device_ids[] = { + {ACPI_MEMORY_DEVICE_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, memory_device_ids); + static struct acpi_driver acpi_memory_device_driver = { .name = "acpi_memhotplug", .class = ACPI_MEMORY_DEVICE_CLASS, - .ids = ACPI_MEMORY_DEVICE_HID, + .ids = memory_device_ids, .ops = { .add = acpi_memory_device_add, .remove = acpi_memory_device_remove, Index: linux-2.6.22-rc4/drivers/acpi/processor_core.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/processor_core.c +++ linux-2.6.22-rc4/drivers/acpi/processor_core.c @@ -85,10 +85,16 @@ static void acpi_processor_notify(acpi_h static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); static int acpi_processor_handle_eject(struct acpi_processor *pr); +static const struct acpi_device_id processor_device_ids[] = { + {ACPI_PROCESSOR_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, processor_device_ids); + static struct acpi_driver acpi_processor_driver = { .name = "processor", .class = ACPI_PROCESSOR_CLASS, - .ids = ACPI_PROCESSOR_HID, + .ids = processor_device_ids, .ops = { .add = acpi_processor_add, .remove = acpi_processor_remove, Index: linux-2.6.22-rc4/drivers/acpi/video.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/video.c +++ linux-2.6.22-rc4/drivers/acpi/video.c @@ -73,10 +73,16 @@ MODULE_LICENSE("GPL"); static int acpi_video_bus_add(struct acpi_device *device); static int acpi_video_bus_remove(struct acpi_device *device, int type); +static const struct acpi_device_id video_device_ids[] = { + {ACPI_VIDEO_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, video_device_ids); + static struct acpi_driver acpi_video_bus = { .name = "video", .class = ACPI_VIDEO_CLASS, - .ids = ACPI_VIDEO_HID, + .ids = video_device_ids, .ops = { .add = acpi_video_bus_add, .remove = acpi_video_bus_remove, Index: linux-2.6.22-rc4/drivers/char/hpet.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/char/hpet.c +++ linux-2.6.22-rc4/drivers/char/hpet.c @@ -999,9 +999,15 @@ static int hpet_acpi_remove(struct acpi_ return -EINVAL; } +static const struct acpi_device_id hpet_device_ids[] = { + {"PNP0103", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, hpet_device_ids); + static struct acpi_driver hpet_acpi_driver = { .name = "hpet", - .ids = "PNP0103", + .ids = hpet_device_ids, .ops = { .add = hpet_acpi_add, .remove = hpet_acpi_remove, Index: linux-2.6.22-rc4/drivers/input/misc/atlas_btns.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/input/misc/atlas_btns.c +++ linux-2.6.22-rc4/drivers/input/misc/atlas_btns.c @@ -31,7 +31,6 @@ #define ACPI_ATLAS_NAME "Atlas ACPI" #define ACPI_ATLAS_CLASS "Atlas" -#define ACPI_ATLAS_BUTTON_HID "ASIM0000" static struct input_dev *input_dev; @@ -130,10 +129,16 @@ static int atlas_acpi_button_remove(stru return status; } +static const struct acpi_device_id atlas_device_ids[] = { + {"ASIM0000", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, atlas_device_ids); + static struct acpi_driver atlas_acpi_driver = { .name = ACPI_ATLAS_NAME, .class = ACPI_ATLAS_CLASS, - .ids = ACPI_ATLAS_BUTTON_HID, + .ids = atlas_device_ids, .ops = { .add = atlas_acpi_button_add, .remove = atlas_acpi_button_remove, Index: linux-2.6.22-rc4/drivers/misc/asus-laptop.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/misc/asus-laptop.c +++ linux-2.6.22-rc4/drivers/misc/asus-laptop.c @@ -53,7 +53,6 @@ #define ASUS_HOTK_NAME "Asus Laptop Support" #define ASUS_HOTK_CLASS "hotkey" #define ASUS_HOTK_DEVICE_NAME "Hotkey" -#define ASUS_HOTK_HID "ATK0100" #define ASUS_HOTK_FILE "asus-laptop" #define ASUS_HOTK_PREFIX "\\_SB.ATKD." @@ -197,12 +196,18 @@ static struct asus_hotk *hotk; /* * The hotkey driver declaration */ +static const struct acpi_device_id asus_device_ids[] = { + {"ATK0100", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, asus_device_ids); + static int asus_hotk_add(struct acpi_device *device); static int asus_hotk_remove(struct acpi_device *device, int type); static struct acpi_driver asus_hotk_driver = { .name = ASUS_HOTK_NAME, .class = ASUS_HOTK_CLASS, - .ids = ASUS_HOTK_HID, + .ids = asus_device_ids, .ops = { .add = asus_hotk_add, .remove = asus_hotk_remove, Index: linux-2.6.22-rc4/drivers/acpi/ec.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/ec.c +++ linux-2.6.22-rc4/drivers/acpi/ec.c @@ -43,7 +43,6 @@ ACPI_MODULE_NAME("ec"); #define ACPI_EC_COMPONENT 0x00100000 #define ACPI_EC_CLASS "embedded_controller" -#define ACPI_EC_HID "PNP0C09" #define ACPI_EC_DEVICE_NAME "Embedded Controller" #define ACPI_EC_FILE_INFO "info" #undef PREFIX @@ -80,10 +79,22 @@ static int acpi_ec_start(struct acpi_dev static int acpi_ec_stop(struct acpi_device *device, int type); static int acpi_ec_add(struct acpi_device *device); +/* + ec never can be a module..., anyway let's keep the autoloading + things here, this line does not hurt. +*/ + +static const struct acpi_device_id ec_device_ids[] = { + {"PNP0C09", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, ec_device_ids); + + static struct acpi_driver acpi_ec_driver = { .name = "ec", .class = ACPI_EC_CLASS, - .ids = ACPI_EC_HID, + .ids = ec_device_ids, .ops = { .add = acpi_ec_add, .remove = acpi_ec_remove, Index: linux-2.6.22-rc4/drivers/misc/thinkpad_acpi.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/misc/thinkpad_acpi.c +++ linux-2.6.22-rc4/drivers/misc/thinkpad_acpi.c @@ -388,12 +388,13 @@ static int __init register_tpacpi_subdri sprintf(ibm->acpi->driver->name, "%s_%s", IBM_NAME, ibm->name); ibm->acpi->driver->ids = ibm->acpi->hid; + ibm->acpi->driver->ops.add = &tpacpi_device_add; rc = acpi_bus_register_driver(ibm->acpi->driver); if (rc < 0) { printk(IBM_ERR "acpi_bus_register_driver(%s) failed: %d\n", - ibm->acpi->hid, rc); + ibm->name, rc); kfree(ibm->acpi->driver); ibm->acpi->driver = NULL; } else if (!rc) @@ -1000,8 +1001,24 @@ errexit: return res; } +static const struct acpi_device_id ibm_device_ids[] = { + {IBM_HKEY_HID, 0}, + {IBM_PCI_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, ibm_device_ids); + +static const struct acpi_device_id ibm_htk_device_ids[] = { + {IBM_HKEY_HID, 0}, + {"", 0}, +}; +static const struct acpi_device_id ibm_pci_device_ids[] = { + {IBM_PCI_HID, 0}, + {"", 0}, +}; + static struct tp_acpi_drv_struct ibm_hotkey_acpidriver = { - .hid = IBM_HKEY_HID, +// .hid = ibm_htk_device_ids, .notify = hotkey_notify, .handle = &hkey_handle, .type = ACPI_DEVICE_NOTIFY, @@ -1763,6 +1780,11 @@ IBM_HANDLE(dock, root, "\\_SB.GDCK", /* /* don't list other alternatives as we install a notify handler on the 570 */ IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */ +static const struct acpi_device_id ibm_pci_device_ids[] = { + {IBM_PCI_HID, 0}, + {"", 0}, +}; + static struct tp_acpi_drv_struct ibm_dock_acpidriver[2] = { { .notify = dock_notify, @@ -1770,7 +1792,7 @@ static struct tp_acpi_drv_struct ibm_doc .type = ACPI_SYSTEM_NOTIFY, }, { - .hid = IBM_PCI_HID, + .hid = ibm_pci_device_ids, .notify = dock_notify, .handle = &pci_handle, .type = ACPI_SYSTEM_NOTIFY, @@ -1829,7 +1851,8 @@ static int __init dock_init2(struct ibm_ static void dock_notify(struct ibm_struct *ibm, u32 event) { int docked = dock_docked(); - int pci = ibm->acpi->hid && strstr(ibm->acpi->hid, IBM_PCI_HID); + int pci = ibm->acpi->hid && ibm->acpi->device && + acpi_match_device_ids(ibm->acpi->device, ibm_pci_device_ids); if (event == 1 && !pci) /* 570 */ acpi_bus_generate_event(ibm->acpi->device, event, 1); /* button */ Index: linux-2.6.22-rc4/drivers/misc/thinkpad_acpi.h =================================================================== --- linux-2.6.22-rc4.orig/drivers/misc/thinkpad_acpi.h +++ linux-2.6.22-rc4/drivers/misc/thinkpad_acpi.h @@ -182,7 +182,7 @@ static void thinkpad_acpi_module_exit(vo struct ibm_struct; struct tp_acpi_drv_struct { - char *hid; + const struct acpi_device_id *hid; struct acpi_driver *driver; void (*notify) (struct ibm_struct *, u32); Index: linux-2.6.22-rc4/drivers/misc/sony-laptop.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/misc/sony-laptop.c +++ linux-2.6.22-rc4/drivers/misc/sony-laptop.c @@ -890,10 +890,22 @@ static int sony_nc_remove(struct acpi_de return 0; } +static const struct acpi_device_id sony_device_ids[] = { + {SONY_NC_HID, 0}, + {SONY_PIC_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, sony_device_ids); + +static const struct acpi_device_id sony_nc_device_ids[] = { + {SONY_NC_HID, 0}, + {"", 0}, +}; + static struct acpi_driver sony_nc_driver = { .name = SONY_NC_DRIVER_NAME, .class = SONY_NC_CLASS, - .ids = SONY_NC_HID, + .ids = sony_nc_device_ids, .owner = THIS_MODULE, .ops = { .add = sony_nc_add, @@ -2221,10 +2233,15 @@ static int sony_pic_resume(struct acpi_d return 0; } +static const struct acpi_device_id sony_pic_device_ids[] = { + {SONY_PIC_HID, 0}, + {"", 0}, +}; + static struct acpi_driver sony_pic_driver = { .name = SONY_PIC_DRIVER_NAME, .class = SONY_PIC_CLASS, - .ids = SONY_PIC_HID, + .ids = sony_pic_device_ids, .owner = THIS_MODULE, .ops = { .add = sony_pic_add, --=-7blMUuGpWSInmnTy5PaX Content-Disposition: attachment; filename=acpi_autoloading_implement_device_ids.patch Content-Type: text/x-patch; name=acpi_autoloading_implement_device_ids.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Create __mod_acpi_device_table symbol for all acpi drivers. modpost is going to use this one to create modules.alias Hopefully thinkpad module still works. IMO this one should get restructured and make use of acpi_bus_register_driver and try to avoid to test for HIDs/CIDs for its own. Signed-off-by: Thomas Renninger --- drivers/acpi/ac.c | 9 +++++++-- drivers/acpi/acpi_memhotplug.c | 8 +++++++- drivers/acpi/asus_acpi.c | 11 ++++++++--- drivers/acpi/battery.c | 10 ++++++++-- drivers/acpi/button.c | 10 +++++++++- drivers/acpi/container.c | 10 +++++++++- drivers/acpi/ec.c | 15 +++++++++++++-- drivers/acpi/fan.c | 8 +++++++- drivers/acpi/pci_link.c | 9 +++++++-- drivers/acpi/pci_root.c | 9 +++++++-- drivers/acpi/power.c | 8 +++++++- drivers/acpi/processor_core.c | 8 +++++++- drivers/acpi/sbs.c | 9 +++++++-- drivers/acpi/thermal.c | 8 +++++++- drivers/acpi/video.c | 8 +++++++- drivers/char/hpet.c | 8 +++++++- drivers/input/misc/atlas_btns.c | 9 +++++++-- drivers/misc/asus-laptop.c | 9 +++++++-- drivers/misc/sony-laptop.c | 21 +++++++++++++++++++-- drivers/misc/thinkpad_acpi.c | 31 +++++++++++++++++++++++++++---- drivers/misc/thinkpad_acpi.h | 2 +- 21 files changed, 185 insertions(+), 35 deletions(-) Index: linux-2.6.22-rc4/drivers/acpi/button.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/button.c +++ linux-2.6.22-rc4/drivers/acpi/button.c @@ -66,6 +66,14 @@ MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION("ACPI Button Driver"); MODULE_LICENSE("GPL"); +static const struct acpi_device_id button_device_ids[] = { + {ACPI_BUTTON_HID_LID, 0}, + {ACPI_BUTTON_HID_SLEEP, 0}, + {ACPI_BUTTON_HID_POWER, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, button_device_ids); + static int acpi_button_add(struct acpi_device *device); static int acpi_button_remove(struct acpi_device *device, int type); static int acpi_button_info_open_fs(struct inode *inode, struct file *file); @@ -74,7 +82,7 @@ static int acpi_button_state_open_fs(str static struct acpi_driver acpi_button_driver = { .name = "button", .class = ACPI_BUTTON_CLASS, - .ids = "button_power,button_sleep,PNP0C0D,PNP0C0C,PNP0C0E", + .ids = button_device_ids, .ops = { .add = acpi_button_add, .remove = acpi_button_remove, Index: linux-2.6.22-rc4/drivers/acpi/asus_acpi.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/asus_acpi.c +++ linux-2.6.22-rc4/drivers/acpi/asus_acpi.c @@ -56,7 +56,6 @@ #define ACPI_HOTK_NAME "Asus Laptop ACPI Extras Driver" #define ACPI_HOTK_CLASS "hotkey" #define ACPI_HOTK_DEVICE_NAME "Hotkey" -#define ACPI_HOTK_HID "ATK0100" /* * Some events we use, same for all Asus @@ -426,14 +425,20 @@ static struct acpi_table_header *asus_in static struct asus_hotk *hotk; /* - * The hotkey driver declaration + * The hotkey driver and autoloading declaration */ static int asus_hotk_add(struct acpi_device *device); static int asus_hotk_remove(struct acpi_device *device, int type); +static const struct acpi_device_id asus_device_ids[] = { + {"ATK0100", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, asus_device_ids); + static struct acpi_driver asus_hotk_driver = { .name = "asus_acpi", .class = ACPI_HOTK_CLASS, - .ids = ACPI_HOTK_HID, + .ids = asus_device_ids, .ops = { .add = asus_hotk_add, .remove = asus_hotk_remove, Index: linux-2.6.22-rc4/drivers/acpi/fan.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/fan.c +++ linux-2.6.22-rc4/drivers/acpi/fan.c @@ -50,10 +50,16 @@ static int acpi_fan_remove(struct acpi_d static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state); static int acpi_fan_resume(struct acpi_device *device); +static const struct acpi_device_id fan_device_ids[] = { + {"PNP0C0B", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, fan_device_ids); + static struct acpi_driver acpi_fan_driver = { .name = "fan", .class = ACPI_FAN_CLASS, - .ids = "PNP0C0B", + .ids = fan_device_ids, .ops = { .add = acpi_fan_add, .remove = acpi_fan_remove, Index: linux-2.6.22-rc4/drivers/acpi/container.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/container.c +++ linux-2.6.22-rc4/drivers/acpi/container.c @@ -52,10 +52,18 @@ MODULE_LICENSE("GPL"); static int acpi_container_add(struct acpi_device *device); static int acpi_container_remove(struct acpi_device *device, int type); +static const struct acpi_device_id container_device_ids[] = { + {"ACPI0004", 0}, + {"PNP0A05", 0}, + {"PNP0A06", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, container_device_ids); + static struct acpi_driver acpi_container_driver = { .name = "container", .class = ACPI_CONTAINER_CLASS, - .ids = "ACPI0004,PNP0A05,PNP0A06", + .ids = container_device_ids, .ops = { .add = acpi_container_add, .remove = acpi_container_remove, Index: linux-2.6.22-rc4/drivers/acpi/sbs.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/sbs.c +++ linux-2.6.22-rc4/drivers/acpi/sbs.c @@ -38,7 +38,6 @@ #define ACPI_SBS_CLASS "sbs" #define ACPI_AC_CLASS "ac_adapter" #define ACPI_BATTERY_CLASS "battery" -#define ACPI_SBS_HID "ACPI0002" #define ACPI_SBS_DEVICE_NAME "Smart Battery System" #define ACPI_SBS_FILE_INFO "info" #define ACPI_SBS_FILE_STATE "state" @@ -124,10 +123,16 @@ static int acpi_sbs_add(struct acpi_devi static int acpi_sbs_remove(struct acpi_device *device, int type); static int acpi_sbs_resume(struct acpi_device *device); +static const struct acpi_device_id sbs_device_ids[] = { + {"ACPI0002", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, sbs_device_ids); + static struct acpi_driver acpi_sbs_driver = { .name = "sbs", .class = ACPI_SBS_CLASS, - .ids = ACPI_SBS_HID, + .ids = sbs_device_ids, .ops = { .add = acpi_sbs_add, .remove = acpi_sbs_remove, Index: linux-2.6.22-rc4/drivers/acpi/battery.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/battery.c +++ linux-2.6.22-rc4/drivers/acpi/battery.c @@ -41,7 +41,6 @@ #define ACPI_BATTERY_COMPONENT 0x00040000 #define ACPI_BATTERY_CLASS "battery" -#define ACPI_BATTERY_HID "PNP0C0A" #define ACPI_BATTERY_DEVICE_NAME "Battery" #define ACPI_BATTERY_FILE_INFO "info" #define ACPI_BATTERY_FILE_STATUS "state" @@ -65,10 +64,16 @@ static int acpi_battery_add(struct acpi_ static int acpi_battery_remove(struct acpi_device *device, int type); static int acpi_battery_resume(struct acpi_device *device); +static const struct acpi_device_id battery_device_ids[] = { + {"PNP0C0A", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, battery_device_ids); + static struct acpi_driver acpi_battery_driver = { .name = "battery", .class = ACPI_BATTERY_CLASS, - .ids = ACPI_BATTERY_HID, + .ids = battery_device_ids, .ops = { .add = acpi_battery_add, .resume = acpi_battery_resume, Index: linux-2.6.22-rc4/drivers/acpi/thermal.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/thermal.c +++ linux-2.6.22-rc4/drivers/acpi/thermal.c @@ -92,10 +92,16 @@ static int acpi_thermal_polling_open_fs( static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, size_t, loff_t *); +static const struct acpi_device_id thermal_device_ids[] = { + {ACPI_THERMAL_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, thermal_device_ids); + static struct acpi_driver acpi_thermal_driver = { .name = "thermal", .class = ACPI_THERMAL_CLASS, - .ids = ACPI_THERMAL_HID, + .ids = thermal_device_ids, .ops = { .add = acpi_thermal_add, .remove = acpi_thermal_remove, Index: linux-2.6.22-rc4/drivers/acpi/ac.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/ac.c +++ linux-2.6.22-rc4/drivers/acpi/ac.c @@ -34,7 +34,6 @@ #define ACPI_AC_COMPONENT 0x00020000 #define ACPI_AC_CLASS "ac_adapter" -#define ACPI_AC_HID "ACPI0003" #define ACPI_AC_DEVICE_NAME "AC Adapter" #define ACPI_AC_FILE_STATE "state" #define ACPI_AC_NOTIFY_STATUS 0x80 @@ -56,10 +55,16 @@ static int acpi_ac_add(struct acpi_devic static int acpi_ac_remove(struct acpi_device *device, int type); static int acpi_ac_open_fs(struct inode *inode, struct file *file); +const static struct acpi_device_id ac_device_ids[] = { + {"ACPI0003", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, ac_device_ids); + static struct acpi_driver acpi_ac_driver = { .name = "ac", .class = ACPI_AC_CLASS, - .ids = ACPI_AC_HID, + .ids = ac_device_ids, .ops = { .add = acpi_ac_add, .remove = acpi_ac_remove, Index: linux-2.6.22-rc4/drivers/acpi/pci_link.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/pci_link.c +++ linux-2.6.22-rc4/drivers/acpi/pci_link.c @@ -46,7 +46,6 @@ #define _COMPONENT ACPI_PCI_COMPONENT ACPI_MODULE_NAME("pci_link"); #define ACPI_PCI_LINK_CLASS "pci_irq_routing" -#define ACPI_PCI_LINK_HID "PNP0C0F" #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" #define ACPI_PCI_LINK_FILE_INFO "info" #define ACPI_PCI_LINK_FILE_STATUS "state" @@ -54,10 +53,16 @@ ACPI_MODULE_NAME("pci_link"); static int acpi_pci_link_add(struct acpi_device *device); static int acpi_pci_link_remove(struct acpi_device *device, int type); +static struct acpi_device_id link_device_ids[] = { + {"PNP0C0F", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, link_device_ids); + static struct acpi_driver acpi_pci_link_driver = { .name = "pci_link", .class = ACPI_PCI_LINK_CLASS, - .ids = ACPI_PCI_LINK_HID, + .ids = link_device_ids, .ops = { .add = acpi_pci_link_add, .remove = acpi_pci_link_remove, Index: linux-2.6.22-rc4/drivers/acpi/pci_root.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/pci_root.c +++ linux-2.6.22-rc4/drivers/acpi/pci_root.c @@ -38,16 +38,21 @@ #define _COMPONENT ACPI_PCI_COMPONENT ACPI_MODULE_NAME("pci_root"); #define ACPI_PCI_ROOT_CLASS "pci_bridge" -#define ACPI_PCI_ROOT_HID "PNP0A03" #define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge" static int acpi_pci_root_add(struct acpi_device *device); static int acpi_pci_root_remove(struct acpi_device *device, int type); static int acpi_pci_root_start(struct acpi_device *device); +static struct acpi_device_id root_device_ids[] = { + {"PNP0A03", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, root_device_ids); + static struct acpi_driver acpi_pci_root_driver = { .name = "pci_root", .class = ACPI_PCI_ROOT_CLASS, - .ids = ACPI_PCI_ROOT_HID, + .ids = root_device_ids, .ops = { .add = acpi_pci_root_add, .remove = acpi_pci_root_remove, Index: linux-2.6.22-rc4/drivers/acpi/power.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/power.c +++ linux-2.6.22-rc4/drivers/acpi/power.c @@ -59,10 +59,16 @@ static int acpi_power_remove(struct acpi static int acpi_power_resume(struct acpi_device *device); static int acpi_power_open_fs(struct inode *inode, struct file *file); +static struct acpi_device_id power_device_ids[] = { + {ACPI_POWER_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, power_device_ids); + static struct acpi_driver acpi_power_driver = { .name = "power", .class = ACPI_POWER_CLASS, - .ids = ACPI_POWER_HID, + .ids = power_device_ids, .ops = { .add = acpi_power_add, .remove = acpi_power_remove, Index: linux-2.6.22-rc4/drivers/acpi/acpi_memhotplug.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/acpi_memhotplug.c +++ linux-2.6.22-rc4/drivers/acpi/acpi_memhotplug.c @@ -53,10 +53,16 @@ static int acpi_memory_device_add(struct static int acpi_memory_device_remove(struct acpi_device *device, int type); static int acpi_memory_device_start(struct acpi_device *device); +static const struct acpi_device_id memory_device_ids[] = { + {ACPI_MEMORY_DEVICE_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, memory_device_ids); + static struct acpi_driver acpi_memory_device_driver = { .name = "acpi_memhotplug", .class = ACPI_MEMORY_DEVICE_CLASS, - .ids = ACPI_MEMORY_DEVICE_HID, + .ids = memory_device_ids, .ops = { .add = acpi_memory_device_add, .remove = acpi_memory_device_remove, Index: linux-2.6.22-rc4/drivers/acpi/processor_core.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/processor_core.c +++ linux-2.6.22-rc4/drivers/acpi/processor_core.c @@ -85,10 +85,16 @@ static void acpi_processor_notify(acpi_h static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); static int acpi_processor_handle_eject(struct acpi_processor *pr); +static const struct acpi_device_id processor_device_ids[] = { + {ACPI_PROCESSOR_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, processor_device_ids); + static struct acpi_driver acpi_processor_driver = { .name = "processor", .class = ACPI_PROCESSOR_CLASS, - .ids = ACPI_PROCESSOR_HID, + .ids = processor_device_ids, .ops = { .add = acpi_processor_add, .remove = acpi_processor_remove, Index: linux-2.6.22-rc4/drivers/acpi/video.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/video.c +++ linux-2.6.22-rc4/drivers/acpi/video.c @@ -73,10 +73,16 @@ MODULE_LICENSE("GPL"); static int acpi_video_bus_add(struct acpi_device *device); static int acpi_video_bus_remove(struct acpi_device *device, int type); +static const struct acpi_device_id video_device_ids[] = { + {ACPI_VIDEO_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, video_device_ids); + static struct acpi_driver acpi_video_bus = { .name = "video", .class = ACPI_VIDEO_CLASS, - .ids = ACPI_VIDEO_HID, + .ids = video_device_ids, .ops = { .add = acpi_video_bus_add, .remove = acpi_video_bus_remove, Index: linux-2.6.22-rc4/drivers/char/hpet.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/char/hpet.c +++ linux-2.6.22-rc4/drivers/char/hpet.c @@ -999,9 +999,15 @@ static int hpet_acpi_remove(struct acpi_ return -EINVAL; } +static const struct acpi_device_id hpet_device_ids[] = { + {"PNP0103", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, hpet_device_ids); + static struct acpi_driver hpet_acpi_driver = { .name = "hpet", - .ids = "PNP0103", + .ids = hpet_device_ids, .ops = { .add = hpet_acpi_add, .remove = hpet_acpi_remove, Index: linux-2.6.22-rc4/drivers/input/misc/atlas_btns.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/input/misc/atlas_btns.c +++ linux-2.6.22-rc4/drivers/input/misc/atlas_btns.c @@ -31,7 +31,6 @@ #define ACPI_ATLAS_NAME "Atlas ACPI" #define ACPI_ATLAS_CLASS "Atlas" -#define ACPI_ATLAS_BUTTON_HID "ASIM0000" static struct input_dev *input_dev; @@ -130,10 +129,16 @@ static int atlas_acpi_button_remove(stru return status; } +static const struct acpi_device_id atlas_device_ids[] = { + {"ASIM0000", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, atlas_device_ids); + static struct acpi_driver atlas_acpi_driver = { .name = ACPI_ATLAS_NAME, .class = ACPI_ATLAS_CLASS, - .ids = ACPI_ATLAS_BUTTON_HID, + .ids = atlas_device_ids, .ops = { .add = atlas_acpi_button_add, .remove = atlas_acpi_button_remove, Index: linux-2.6.22-rc4/drivers/misc/asus-laptop.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/misc/asus-laptop.c +++ linux-2.6.22-rc4/drivers/misc/asus-laptop.c @@ -53,7 +53,6 @@ #define ASUS_HOTK_NAME "Asus Laptop Support" #define ASUS_HOTK_CLASS "hotkey" #define ASUS_HOTK_DEVICE_NAME "Hotkey" -#define ASUS_HOTK_HID "ATK0100" #define ASUS_HOTK_FILE "asus-laptop" #define ASUS_HOTK_PREFIX "\\_SB.ATKD." @@ -197,12 +196,18 @@ static struct asus_hotk *hotk; /* * The hotkey driver declaration */ +static const struct acpi_device_id asus_device_ids[] = { + {"ATK0100", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, asus_device_ids); + static int asus_hotk_add(struct acpi_device *device); static int asus_hotk_remove(struct acpi_device *device, int type); static struct acpi_driver asus_hotk_driver = { .name = ASUS_HOTK_NAME, .class = ASUS_HOTK_CLASS, - .ids = ASUS_HOTK_HID, + .ids = asus_device_ids, .ops = { .add = asus_hotk_add, .remove = asus_hotk_remove, Index: linux-2.6.22-rc4/drivers/acpi/ec.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/acpi/ec.c +++ linux-2.6.22-rc4/drivers/acpi/ec.c @@ -43,7 +43,6 @@ ACPI_MODULE_NAME("ec"); #define ACPI_EC_COMPONENT 0x00100000 #define ACPI_EC_CLASS "embedded_controller" -#define ACPI_EC_HID "PNP0C09" #define ACPI_EC_DEVICE_NAME "Embedded Controller" #define ACPI_EC_FILE_INFO "info" #undef PREFIX @@ -80,10 +79,22 @@ static int acpi_ec_start(struct acpi_dev static int acpi_ec_stop(struct acpi_device *device, int type); static int acpi_ec_add(struct acpi_device *device); +/* + ec never can be a module..., anyway let's keep the autoloading + things here, this line does not hurt. +*/ + +static const struct acpi_device_id ec_device_ids[] = { + {"PNP0C09", 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, ec_device_ids); + + static struct acpi_driver acpi_ec_driver = { .name = "ec", .class = ACPI_EC_CLASS, - .ids = ACPI_EC_HID, + .ids = ec_device_ids, .ops = { .add = acpi_ec_add, .remove = acpi_ec_remove, Index: linux-2.6.22-rc4/drivers/misc/thinkpad_acpi.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/misc/thinkpad_acpi.c +++ linux-2.6.22-rc4/drivers/misc/thinkpad_acpi.c @@ -388,12 +388,13 @@ static int __init register_tpacpi_subdri sprintf(ibm->acpi->driver->name, "%s_%s", IBM_NAME, ibm->name); ibm->acpi->driver->ids = ibm->acpi->hid; + ibm->acpi->driver->ops.add = &tpacpi_device_add; rc = acpi_bus_register_driver(ibm->acpi->driver); if (rc < 0) { printk(IBM_ERR "acpi_bus_register_driver(%s) failed: %d\n", - ibm->acpi->hid, rc); + ibm->name, rc); kfree(ibm->acpi->driver); ibm->acpi->driver = NULL; } else if (!rc) @@ -1000,8 +1001,24 @@ errexit: return res; } +static const struct acpi_device_id ibm_device_ids[] = { + {IBM_HKEY_HID, 0}, + {IBM_PCI_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, ibm_device_ids); + +static const struct acpi_device_id ibm_htk_device_ids[] = { + {IBM_HKEY_HID, 0}, + {"", 0}, +}; +static const struct acpi_device_id ibm_pci_device_ids[] = { + {IBM_PCI_HID, 0}, + {"", 0}, +}; + static struct tp_acpi_drv_struct ibm_hotkey_acpidriver = { - .hid = IBM_HKEY_HID, +// .hid = ibm_htk_device_ids, .notify = hotkey_notify, .handle = &hkey_handle, .type = ACPI_DEVICE_NOTIFY, @@ -1763,6 +1780,11 @@ IBM_HANDLE(dock, root, "\\_SB.GDCK", /* /* don't list other alternatives as we install a notify handler on the 570 */ IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */ +static const struct acpi_device_id ibm_pci_device_ids[] = { + {IBM_PCI_HID, 0}, + {"", 0}, +}; + static struct tp_acpi_drv_struct ibm_dock_acpidriver[2] = { { .notify = dock_notify, @@ -1770,7 +1792,7 @@ static struct tp_acpi_drv_struct ibm_doc .type = ACPI_SYSTEM_NOTIFY, }, { - .hid = IBM_PCI_HID, + .hid = ibm_pci_device_ids, .notify = dock_notify, .handle = &pci_handle, .type = ACPI_SYSTEM_NOTIFY, @@ -1829,7 +1851,8 @@ static int __init dock_init2(struct ibm_ static void dock_notify(struct ibm_struct *ibm, u32 event) { int docked = dock_docked(); - int pci = ibm->acpi->hid && strstr(ibm->acpi->hid, IBM_PCI_HID); + int pci = ibm->acpi->hid && ibm->acpi->device && + acpi_match_device_ids(ibm->acpi->device, ibm_pci_device_ids); if (event == 1 && !pci) /* 570 */ acpi_bus_generate_event(ibm->acpi->device, event, 1); /* button */ Index: linux-2.6.22-rc4/drivers/misc/thinkpad_acpi.h =================================================================== --- linux-2.6.22-rc4.orig/drivers/misc/thinkpad_acpi.h +++ linux-2.6.22-rc4/drivers/misc/thinkpad_acpi.h @@ -182,7 +182,7 @@ static void thinkpad_acpi_module_exit(vo struct ibm_struct; struct tp_acpi_drv_struct { - char *hid; + const struct acpi_device_id *hid; struct acpi_driver *driver; void (*notify) (struct ibm_struct *, u32); Index: linux-2.6.22-rc4/drivers/misc/sony-laptop.c =================================================================== --- linux-2.6.22-rc4.orig/drivers/misc/sony-laptop.c +++ linux-2.6.22-rc4/drivers/misc/sony-laptop.c @@ -890,10 +890,22 @@ static int sony_nc_remove(struct acpi_de return 0; } +static const struct acpi_device_id sony_device_ids[] = { + {SONY_NC_HID, 0}, + {SONY_PIC_HID, 0}, + {"", 0}, +}; +MODULE_DEVICE_TABLE(acpi, sony_device_ids); + +static const struct acpi_device_id sony_nc_device_ids[] = { + {SONY_NC_HID, 0}, + {"", 0}, +}; + static struct acpi_driver sony_nc_driver = { .name = SONY_NC_DRIVER_NAME, .class = SONY_NC_CLASS, - .ids = SONY_NC_HID, + .ids = sony_nc_device_ids, .owner = THIS_MODULE, .ops = { .add = sony_nc_add, @@ -2221,10 +2233,15 @@ static int sony_pic_resume(struct acpi_d return 0; } +static const struct acpi_device_id sony_pic_device_ids[] = { + {SONY_PIC_HID, 0}, + {"", 0}, +}; + static struct acpi_driver sony_pic_driver = { .name = SONY_PIC_DRIVER_NAME, .class = SONY_PIC_CLASS, - .ids = SONY_PIC_HID, + .ids = sony_pic_device_ids, .owner = THIS_MODULE, .ops = { .add = sony_pic_add, --=-7blMUuGpWSInmnTy5PaX-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/