aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2006-06-15 21:28:57 -0400
committerLen Brown <len.brown@intel.com>2006-06-15 21:28:57 -0400
commit69cd291c6bbc6647fe3783257c5a2e076e808f71 (patch)
tree6f65a2d7d29228129cef09343c485aad64e3a3f1 /drivers/acpi
parent35a5d9ed9fedb74c22cb19ff7d749289473144e0 (diff)
parent06ea8e08ae7e7e450b6a78e7ce5e10b3c5f954ea (diff)
Pull acpi_bus_register_driver into release branch
Conflicts: drivers/acpi/asus_acpi.c drivers/acpi/scan.c
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/asus_acpi.c18
-rw-r--r--drivers/acpi/scan.c34
2 files changed, 26 insertions, 26 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index 1a545489e859..90eb3c5a15ca 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -1119,6 +1119,8 @@ static int asus_hotk_check(void)
1119 return result; 1119 return result;
1120} 1120}
1121 1121
1122static int asus_hotk_found;
1123
1122static int asus_hotk_add(struct acpi_device *device) 1124static int asus_hotk_add(struct acpi_device *device)
1123{ 1125{
1124 acpi_status status = AE_OK; 1126 acpi_status status = AE_OK;
@@ -1180,6 +1182,8 @@ static int asus_hotk_add(struct acpi_device *device)
1180 } 1182 }
1181 } 1183 }
1182 1184
1185 asus_hotk_found = 1;
1186
1183 end: 1187 end:
1184 if (result) { 1188 if (result) {
1185 kfree(hotk); 1189 kfree(hotk);
@@ -1226,7 +1230,19 @@ static int __init asus_acpi_init(void)
1226 asus_proc_dir->owner = THIS_MODULE; 1230 asus_proc_dir->owner = THIS_MODULE;
1227 1231
1228 result = acpi_bus_register_driver(&asus_hotk_driver); 1232 result = acpi_bus_register_driver(&asus_hotk_driver);
1229 if (result < 1) { 1233 if (result < 0) {
1234 remove_proc_entry(PROC_ASUS, acpi_root_dir);
1235 return -ENODEV;
1236 }
1237
1238 /*
1239 * This is a bit of a kludge. We only want this module loaded
1240 * for ASUS systems, but there's currently no way to probe the
1241 * ACPI namespace for ASUS HIDs. So we just return failure if
1242 * we didn't find one, which will cause the module to be
1243 * unloaded.
1244 */
1245 if (!asus_hotk_found) {
1230 acpi_bus_unregister_driver(&asus_hotk_driver); 1246 acpi_bus_unregister_driver(&asus_hotk_driver);
1231 remove_proc_entry(PROC_ASUS, acpi_root_dir); 1247 remove_proc_entry(PROC_ASUS, acpi_root_dir);
1232 return -ENODEV; 1248 return -ENODEV;
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index a5fa85832fa3..fc676ac0e3ed 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)
@@ -537,10 +536,9 @@ static int acpi_start_single_object(struct acpi_device *device)
537 return_VALUE(result); 536 return_VALUE(result);
538} 537}
539 538
540static int acpi_driver_attach(struct acpi_driver *drv) 539static void acpi_driver_attach(struct acpi_driver *drv)
541{ 540{
542 struct list_head *node, *next; 541 struct list_head *node, *next;
543 int count = 0;
544 542
545 ACPI_FUNCTION_TRACE("acpi_driver_attach"); 543 ACPI_FUNCTION_TRACE("acpi_driver_attach");
546 544
@@ -557,7 +555,6 @@ static int acpi_driver_attach(struct acpi_driver *drv)
557 if (!acpi_bus_driver_init(dev, drv)) { 555 if (!acpi_bus_driver_init(dev, drv)) {
558 acpi_start_single_object(dev); 556 acpi_start_single_object(dev);
559 atomic_inc(&drv->references); 557 atomic_inc(&drv->references);
560 count++;
561 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 558 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
562 "Found driver [%s] for device [%s]\n", 559 "Found driver [%s] for device [%s]\n",
563 drv->name, dev->pnp.bus_id)); 560 drv->name, dev->pnp.bus_id));
@@ -566,10 +563,9 @@ static int acpi_driver_attach(struct acpi_driver *drv)
566 spin_lock(&acpi_device_lock); 563 spin_lock(&acpi_device_lock);
567 } 564 }
568 spin_unlock(&acpi_device_lock); 565 spin_unlock(&acpi_device_lock);
569 return_VALUE(count);
570} 566}
571 567
572static int acpi_driver_detach(struct acpi_driver *drv) 568static void acpi_driver_detach(struct acpi_driver *drv)
573{ 569{
574 struct list_head *node, *next; 570 struct list_head *node, *next;
575 571
@@ -591,7 +587,6 @@ static int acpi_driver_detach(struct acpi_driver *drv)
591 } 587 }
592 } 588 }
593 spin_unlock(&acpi_device_lock); 589 spin_unlock(&acpi_device_lock);
594 return_VALUE(0);
595} 590}
596 591
597/** 592/**
@@ -599,28 +594,22 @@ static int acpi_driver_detach(struct acpi_driver *drv)
599 * @driver: driver being registered 594 * @driver: driver being registered
600 * 595 *
601 * Registers a driver with the ACPI bus. Searches the namespace for all 596 * Registers a driver with the ACPI bus. Searches the namespace for all
602 * devices that match the driver's criteria and binds. Returns the 597 * devices that match the driver's criteria and binds. Returns zero for
603 * number of devices that were claimed by the driver, or a negative 598 * success or a negative error status for failure.
604 * error status for failure.
605 */ 599 */
606int acpi_bus_register_driver(struct acpi_driver *driver) 600int acpi_bus_register_driver(struct acpi_driver *driver)
607{ 601{
608 int count;
609
610 ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); 602 ACPI_FUNCTION_TRACE("acpi_bus_register_driver");
611 603
612 if (acpi_disabled) 604 if (acpi_disabled)
613 return_VALUE(-ENODEV); 605 return_VALUE(-ENODEV);
614 606
615 if (!driver)
616 return_VALUE(-EINVAL);
617
618 spin_lock(&acpi_device_lock); 607 spin_lock(&acpi_device_lock);
619 list_add_tail(&driver->node, &acpi_bus_drivers); 608 list_add_tail(&driver->node, &acpi_bus_drivers);
620 spin_unlock(&acpi_device_lock); 609 spin_unlock(&acpi_device_lock);
621 count = acpi_driver_attach(driver); 610 acpi_driver_attach(driver);
622 611
623 return_VALUE(count); 612 return_VALUE(0);
624} 613}
625 614
626EXPORT_SYMBOL(acpi_bus_register_driver); 615EXPORT_SYMBOL(acpi_bus_register_driver);
@@ -632,13 +621,8 @@ EXPORT_SYMBOL(acpi_bus_register_driver);
632 * Unregisters a driver with the ACPI bus. Searches the namespace for all 621 * Unregisters a driver with the ACPI bus. Searches the namespace for all
633 * devices that match the driver's criteria and unbinds. 622 * devices that match the driver's criteria and unbinds.
634 */ 623 */
635int acpi_bus_unregister_driver(struct acpi_driver *driver) 624void acpi_bus_unregister_driver(struct acpi_driver *driver)
636{ 625{
637 ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver");
638
639 if (!driver)
640 return_VALUE(-EINVAL);
641
642 acpi_driver_detach(driver); 626 acpi_driver_detach(driver);
643 627
644 if (!atomic_read(&driver->references)) { 628 if (!atomic_read(&driver->references)) {
@@ -646,7 +630,7 @@ int acpi_bus_unregister_driver(struct acpi_driver *driver)
646 list_del_init(&driver->node); 630 list_del_init(&driver->node);
647 spin_unlock(&acpi_device_lock); 631 spin_unlock(&acpi_device_lock);
648 } 632 }
649 return_VALUE(0); 633 return;
650} 634}
651 635
652EXPORT_SYMBOL(acpi_bus_unregister_driver); 636EXPORT_SYMBOL(acpi_bus_unregister_driver);