make acpi_bus_register_driver() consistent with pci_register_driver() (again)
Subsystems (4)
PATCH 1/1 make acpi_bus_register_driver() consistent with pci_register_driver() (again)
Change acpi_bus_register_driver() to return zero on success, negative error on failure, like pci_register_driver() now does.
Also fix the asus_acpi and thinkpad_acpi drivers, which had screwed up register/unregister behavior. (The driver should remain registered as long as it is loaded, regardless of whether devices were claimed at acpi_bus_register_driver()-time).
Finally, the floppy and i8042 ACPI hooks need tweaking because they relied on the "number of devices claimed" return value. These are exceptions to the general rule in that they register/unregister immediately because all they need is presence and resource information and there's no hope of them dealing with hot-plug.
Change acpi_bus_register_driver() to return zero on success, negative error on failure, like pci_register_driver() now does.
Also fix the asus_acpi and thinkpad_acpi drivers, which had screwed up register/unregister behavior. (The driver should remain registered as long as it is loaded, regardless of whether devices were claimed at acpi_bus_register_driver()-time).
Finally, the floppy and i8042 ACPI hooks need tweaking because they relied on the "number of devices claimed" return value. These are exceptions to the general rule in that they register/unregister immediately because all they need is presence and resource information and there's no hope of them dealing with hot-plug.
drivers/acpi/asus_acpi.c +1 -2
@@ -1212,8 +1212,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 ; }
drivers/acpi/scan.c +15 -23
@@ -533,10 +533,9 @@return_VALUE (0 ); } -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" );
@@ -551,7 +550,6 @@if (!acpi_bus_match (dev, drv)) {if (!acpi_bus_driver_init (dev, drv)) {atomic_inc (&drv->references); - count++;ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"Found driver [%s] for device [%s]\n" , drv->name, dev->pnp.bus_id)); }
@@ -559,7 +557,6 @@spin_lock (&acpi_device_lock); }spin_unlock (&acpi_device_lock); -return_VALUE (count); }static int acpi_driver_detach (struct acpi_driver * drv)
@@ -590,16 +587,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)
@@ -611,9 +605,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 ); }
@@ -627,21 +621,19 @@acpi_bus_unregister_driver ( struct acpi_driver *driver) { -int error =0 ; -ACPI_FUNCTION_TRACE ("acpi_bus_unregister_driver" ); -if (driver) { -acpi_driver_detach (driver); +if (!driver) +return_VALUE (-EINVAL ); -if (!atomic_read (&driver->references)) { -spin_lock (&acpi_device_lock); -list_del_init (&driver->node); -spin_unlock (&acpi_device_lock); - } - }else - error = -EINVAL ; -return_VALUE (error); +acpi_driver_detach (driver); + +if (!atomic_read (&driver->references)) { +spin_lock (&acpi_device_lock); +list_del_init (&driver->node); +spin_unlock (&acpi_device_lock); + } +return_VALUE (0 ); }/**
drivers/acpi/thinkpad_acpi.c +1 -1
@@ -247,7 +247,7 @@return -ENODEV ; result =acpi_bus_register_driver (&acpi_thinkpad_driver); -if (result !=1 ) +if (result <0 )return -ENODEV ; printk(KERN_INFO LOGPREFIX "ACPI IBM Thinkpad Fn+Fx key driver version %s\n", DRIVER_VERSION);
drivers/block/floppy.c +27 -28
111 lines not on this page · raw message
drivers/input/serio/i8042-x86ia64io.h +32 -31
125 lines not on this page · raw message