From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx> The IA64 System Bus Adapter (SBA) I/O MMU driver uses an ACPI driver object to look for device objects it needs in the ACPI namespace, but the way that driver object is used by it is kind of abusive. First of all, the ACPI driver is registered with the assumption that its .add() routine (an equivalent of .probe()) will run immediately during the registration, which in principle may or may not happen (it happens in practice due to the way the kernel is built, but that's not actually guaranteed). Second, .add() is the only functionality provided by that driver object (which means that it probes devices without really doing anything with them afterward) and that .add() is only supposed to run during system initialization, so having the driver object registered (and present in sysfs) throughout the system's life time isn't particularly useful. A cleaner way to achieve the same goal that driver object is for is to use an ACPI scan handler instead of it, which at least prevents sysfs from being littered with useless data and causes an improved algorithm of matching ACPI device IDs to be used. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx> --- arch/ia64/hp/common/sba_iommu.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) Index: linux-pm/arch/ia64/hp/common/sba_iommu.c =================================================================== --- linux-pm.orig/arch/ia64/hp/common/sba_iommu.c +++ linux-pm/arch/ia64/hp/common/sba_iommu.c @@ -2042,7 +2042,8 @@ sba_map_ioc_to_node(struct ioc *ioc, acp #endif static int __init -acpi_sba_ioc_add(struct acpi_device *device) +acpi_sba_ioc_add(struct acpi_device *device, + const struct acpi_device_id *not_used) { struct ioc *ioc; acpi_status status; @@ -2090,14 +2091,18 @@ static const struct acpi_device_id hp_io {"HWP0004", 0}, {"", 0}, }; -static struct acpi_driver acpi_sba_ioc_driver = { - .name = "IOC IOMMU Driver", - .ids = hp_ioc_iommu_device_ids, - .ops = { - .add = acpi_sba_ioc_add, - }, +static struct acpi_scan_handler acpi_sba_ioc_handler = { + .ids = hp_ioc_iommu_device_ids, + .attach = acpi_sba_ioc_add, }; +static int __init acpi_sba_ioc_init_acpi(void) +{ + return acpi_scan_add_handler(&acpi_sba_ioc_handler); +} +/* This has to run before acpi_scan_init(). */ +arch_initcall(acpi_sba_ioc_init_acpi); + extern struct dma_map_ops swiotlb_dma_ops; static int __init @@ -2122,7 +2127,10 @@ sba_init(void) } #endif - acpi_bus_register_driver(&acpi_sba_ioc_driver); + /* + * ioc_list should be populated by the acpi_sba_ioc_handler's .attach() + * routine, but that only happens if acpi_scan_init() has already run. + */ if (!ioc_list) { #ifdef CONFIG_IA64_GENERIC /* -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html