aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2006-04-27 05:25:00 -0400
committerLen Brown <len.brown@intel.com>2006-05-13 23:23:57 -0400
commit06ea8e08ae7e7e450b6a78e7ce5e10b3c5f954ea (patch)
tree23497be5428324a3d9e8cdd504e1f37f9213c8bd /drivers/acpi
parente4513a57ef719d3d6d1cee0ca4d9f4016aa452bb (diff)
ACPI: acpi_bus_unregister_driver() returns void
Nobody looks at the return value, and this brings it into line with pci_unregister_driver(), etc. Also removed validation of the driver pointer passed in to register and unregister. More consistent, and we'll find bugs faster if we fault rather than returning an error that's ignored. Also makes internal functions acpi_device_unregister() and acpi_driver_detach() void, since nobody uses their returns either. 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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/scan.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 669553553fbb..e8efaac71e74 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -142,7 +142,7 @@ static void acpi_device_register(struct acpi_device *device,
142 create_sysfs_device_files(device); 142 create_sysfs_device_files(device);
143} 143}
144 144
145static int acpi_device_unregister(struct acpi_device *device, int type) 145static void acpi_device_unregister(struct acpi_device *device, int type)
146{ 146{
147 spin_lock(&acpi_device_lock); 147 spin_lock(&acpi_device_lock);
148 if (device->parent) { 148 if (device->parent) {
@@ -158,7 +158,6 @@ static int acpi_device_unregister(struct acpi_device *device, int type)
158 acpi_detach_data(device->handle, acpi_bus_data_handler); 158 acpi_detach_data(device->handle, acpi_bus_data_handler);
159 remove_sysfs_device_files(device); 159 remove_sysfs_device_files(device);
160 kobject_unregister(&device->kobj); 160 kobject_unregister(&device->kobj);
161 return 0;
162} 161}
163 162
164void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) 163void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context)
@@ -577,7 +576,7 @@ static void acpi_driver_attach(struct acpi_driver *drv)
577 spin_unlock(&acpi_device_lock); 576 spin_unlock(&acpi_device_lock);
578} 577}
579 578
580static int acpi_driver_detach(struct acpi_driver *drv) 579static void acpi_driver_detach(struct acpi_driver *drv)
581{ 580{
582 struct list_head *node, *next; 581 struct list_head *node, *next;
583 582
@@ -599,7 +598,6 @@ static int acpi_driver_detach(struct acpi_driver *drv)
599 } 598 }
600 } 599 }
601 spin_unlock(&acpi_device_lock); 600 spin_unlock(&acpi_device_lock);
602 return_VALUE(0);
603} 601}
604 602
605/** 603/**
@@ -617,9 +615,6 @@ int acpi_bus_register_driver(struct acpi_driver *driver)
617 if (acpi_disabled) 615 if (acpi_disabled)
618 return_VALUE(-ENODEV); 616 return_VALUE(-ENODEV);
619 617
620 if (!driver)
621 return_VALUE(-EINVAL);
622
623 spin_lock(&acpi_device_lock); 618 spin_lock(&acpi_device_lock);
624 list_add_tail(&driver->node, &acpi_bus_drivers); 619 list_add_tail(&driver->node, &acpi_bus_drivers);
625 spin_unlock(&acpi_device_lock); 620 spin_unlock(&acpi_device_lock);
@@ -637,23 +632,16 @@ EXPORT_SYMBOL(acpi_bus_register_driver);
637 * Unregisters a driver with the ACPI bus. Searches the namespace for all 632 * Unregisters a driver with the ACPI bus. Searches the namespace for all
638 * devices that match the driver's criteria and unbinds. 633 * devices that match the driver's criteria and unbinds.
639 */ 634 */
640int acpi_bus_unregister_driver(struct acpi_driver *driver) 635void acpi_bus_unregister_driver(struct acpi_driver *driver)
641{ 636{
642 int error = 0; 637 acpi_driver_detach(driver);
643
644 ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver");
645
646 if (driver) {
647 acpi_driver_detach(driver);
648 638
649 if (!atomic_read(&driver->references)) { 639 if (!atomic_read(&driver->references)) {
650 spin_lock(&acpi_device_lock); 640 spin_lock(&acpi_device_lock);
651 list_del_init(&driver->node); 641 list_del_init(&driver->node);
652 spin_unlock(&acpi_device_lock); 642 spin_unlock(&acpi_device_lock);
653 } 643 }
654 } else 644 return;
655 error = -EINVAL;
656 return_VALUE(error);
657} 645}
658 646
659EXPORT_SYMBOL(acpi_bus_unregister_driver); 647EXPORT_SYMBOL(acpi_bus_unregister_driver);