ACPI: make acpi_bus_register_driver() return success/failure, not device count
acpi_bus_register_driver() should not return the number of devices claimed. We're not asking to find devices, we're making a driver available to devices, including hot-pluggable devices that may appear in the future. I audited all callers of acpi_bus_register_driver(), and except asus_acpi.c and sonypi.c (fixed in previous patches), all either ignore the return value or test only for failure (<0). Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
@@ -548,10 +548,9 @@ static int acpi_start_single_object(struct acpi_device *device)
|
|||||||
return_VALUE(result);
|
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;
|
struct list_head *node, *next;
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_driver_attach");
|
ACPI_FUNCTION_TRACE("acpi_driver_attach");
|
||||||
|
|
||||||
@@ -568,7 +567,6 @@ static int acpi_driver_attach(struct acpi_driver *drv)
|
|||||||
if (!acpi_bus_driver_init(dev, drv)) {
|
if (!acpi_bus_driver_init(dev, drv)) {
|
||||||
acpi_start_single_object(dev);
|
acpi_start_single_object(dev);
|
||||||
atomic_inc(&drv->references);
|
atomic_inc(&drv->references);
|
||||||
count++;
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Found driver [%s] for device [%s]\n",
|
"Found driver [%s] for device [%s]\n",
|
||||||
drv->name, dev->pnp.bus_id));
|
drv->name, dev->pnp.bus_id));
|
||||||
@@ -577,7 +575,6 @@ static int acpi_driver_attach(struct acpi_driver *drv)
|
|||||||
spin_lock(&acpi_device_lock);
|
spin_lock(&acpi_device_lock);
|
||||||
}
|
}
|
||||||
spin_unlock(&acpi_device_lock);
|
spin_unlock(&acpi_device_lock);
|
||||||
return_VALUE(count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_driver_detach(struct acpi_driver *drv)
|
static int acpi_driver_detach(struct acpi_driver *drv)
|
||||||
@@ -610,14 +607,11 @@ static int acpi_driver_detach(struct acpi_driver *drv)
|
|||||||
* @driver: driver being registered
|
* @driver: driver being registered
|
||||||
*
|
*
|
||||||
* Registers a driver with the ACPI bus. Searches the namespace for all
|
* Registers a driver with the ACPI bus. Searches the namespace for all
|
||||||
* devices that match the driver's criteria and binds. Returns the
|
* devices that match the driver's criteria and binds. Returns zero for
|
||||||
* number of devices that were claimed by the driver, or a negative
|
* success or a negative error status for failure.
|
||||||
* error status for failure.
|
|
||||||
*/
|
*/
|
||||||
int acpi_bus_register_driver(struct acpi_driver *driver)
|
int acpi_bus_register_driver(struct acpi_driver *driver)
|
||||||
{
|
{
|
||||||
int count;
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_register_driver");
|
ACPI_FUNCTION_TRACE("acpi_bus_register_driver");
|
||||||
|
|
||||||
if (acpi_disabled)
|
if (acpi_disabled)
|
||||||
@@ -629,9 +623,9 @@ int acpi_bus_register_driver(struct acpi_driver *driver)
|
|||||||
spin_lock(&acpi_device_lock);
|
spin_lock(&acpi_device_lock);
|
||||||
list_add_tail(&driver->node, &acpi_bus_drivers);
|
list_add_tail(&driver->node, &acpi_bus_drivers);
|
||||||
spin_unlock(&acpi_device_lock);
|
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);
|
EXPORT_SYMBOL(acpi_bus_register_driver);
|
||||||
|
Reference in New Issue
Block a user