From: Bjorn H. <bjo...@hp...> - 2005-07-27 22:28:47
|
pci_register_driver() used to return the number of devices claimed, and we made acpi_bus_register_driver() consistent with that. But pci_register_driver() recently changed to return only success/failure (because the interface is to register the *driver*, not claim devices, and devices may be hot-plugged later). So let's do the same with acpi_bus_register_driver(). Note that asus_acpi.c used to unregister itself if it didn't claim any devices. Now it will remain registered, like everything else in drivers/acpi. Signed-off-by: Bjorn Helgaas <bjo...@hp...> Index: work/drivers/acpi/scan.c =================================================================== --- work.orig/drivers/acpi/scan.c 2005-07-27 10:17:43.000000000 -0600 +++ work/drivers/acpi/scan.c 2005-07-27 10:17:55.000000000 -0600 @@ -578,10 +578,9 @@ return_VALUE(result); } -static int acpi_driver_attach(struct acpi_driver * drv) +static void acpi_driver_attach(struct acpi_driver * drv) { struct list_head * node, * next; - int count = 0; ACPI_FUNCTION_TRACE("acpi_driver_attach"); @@ -597,7 +596,6 @@ if (!acpi_bus_driver_init(dev, drv)) { acpi_start_single_object(dev); atomic_inc(&drv->references); - count++; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found driver [%s] for device [%s]\n", drv->name, dev->pnp.bus_id)); } @@ -605,7 +603,6 @@ spin_lock(&acpi_device_lock); } spin_unlock(&acpi_device_lock); - return_VALUE(count); } static int acpi_driver_detach(struct acpi_driver * drv) @@ -636,16 +633,13 @@ * acpi_bus_register_driver * ------------------------ * Registers a driver with the ACPI bus. Searches the namespace for all - * devices that match the driver's criteria and binds. Returns the - * number of devices that were claimed by the driver, or a negative - * error status for failure. + * devices that match the driver's criteria and binds. Returns zero for + * success or a negative error status for failure. */ int acpi_bus_register_driver ( struct acpi_driver *driver) { - int count; - ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); if (acpi_disabled) @@ -657,9 +651,9 @@ spin_lock(&acpi_device_lock); list_add_tail(&driver->node, &acpi_bus_drivers); spin_unlock(&acpi_device_lock); - count = acpi_driver_attach(driver); + acpi_driver_attach(driver); - return_VALUE(count); + return_VALUE(0); } EXPORT_SYMBOL(acpi_bus_register_driver); Index: work/drivers/acpi/asus_acpi.c =================================================================== --- work.orig/drivers/acpi/asus_acpi.c 2005-07-27 10:17:43.000000000 -0600 +++ work/drivers/acpi/asus_acpi.c 2005-07-27 10:17:55.000000000 -0600 @@ -1216,8 +1216,7 @@ asus_proc_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&asus_hotk_driver); - if (result < 1) { - acpi_bus_unregister_driver(&asus_hotk_driver); + if (result < 0) { remove_proc_entry(PROC_ASUS, acpi_root_dir); return -ENODEV; } |