diff options
author | Len Brown <len.brown@intel.com> | 2004-08-09 04:23:17 -0400 |
---|---|---|
committer | Len Brown <lenb@dhcppc3.> | 2004-08-09 04:23:17 -0400 |
commit | c9b5713062dfc43c433af49cbd3a73f0ccd652c3 (patch) | |
tree | 1b4485d5d486f28b80d86c70cc1dbea7f295a69a /drivers | |
parent | a2653f6448697d4801239e410e962aee33342e89 (diff) | |
download | history-c9b5713062dfc43c433af49cbd3a73f0ccd652c3.tar.gz |
[ACPI] acpi_bus_register_driver() now return a count
consistent with pnp_register_driver() and pci_register_driver()
All existing callers of acpi_bus_register_driver() either ignore the
return value or check only for negative (error) return values.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/scan.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 901ad5a7d32bc8..0d38957f27c736 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -370,6 +370,7 @@ acpi_bus_driver_init ( static int acpi_driver_attach(struct acpi_driver * drv) { struct list_head * node, * next; + int count = 0; ACPI_FUNCTION_TRACE("acpi_driver_attach"); @@ -384,6 +385,7 @@ static int acpi_driver_attach(struct acpi_driver * drv) 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)); } @@ -391,7 +393,7 @@ static int acpi_driver_attach(struct acpi_driver * drv) spin_lock(&acpi_device_lock); } spin_unlock(&acpi_device_lock); - return_VALUE(0); + return_VALUE(count); } static int acpi_driver_detach(struct acpi_driver * drv) @@ -422,28 +424,30 @@ static int acpi_driver_detach(struct acpi_driver * drv) * 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. + * 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. */ int acpi_bus_register_driver ( struct acpi_driver *driver) { - int error = 0; + int count; ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); if (acpi_disabled) return_VALUE(-ENODEV); - if (driver) { - spin_lock(&acpi_device_lock); - list_add_tail(&driver->node, &acpi_bus_drivers); - spin_unlock(&acpi_device_lock); - acpi_driver_attach(driver); - } else - error = -EINVAL; + if (!driver) + return_VALUE(-EINVAL); - return_VALUE(error); + spin_lock(&acpi_device_lock); + list_add_tail(&driver->node, &acpi_bus_drivers); + spin_unlock(&acpi_device_lock); + count = acpi_driver_attach(driver); + + return_VALUE(count); } |