diff options
-rw-r--r-- | drivers/acpi/asus_acpi.c | 18 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 34 | ||||
-rw-r--r-- | drivers/char/sonypi.c | 10 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 2 |
4 files changed, 32 insertions, 32 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 | ||
1122 | static int asus_hotk_found; | ||
1123 | |||
1122 | static int asus_hotk_add(struct acpi_device *device) | 1124 | static 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 | ||
145 | static int acpi_device_unregister(struct acpi_device *device, int type) | 145 | static 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 | ||
164 | void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) | 163 | void 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 | ||
540 | static int acpi_driver_attach(struct acpi_driver *drv) | 539 | static 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 | ||
572 | static int acpi_driver_detach(struct acpi_driver *drv) | 568 | static 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 | */ |
606 | int acpi_bus_register_driver(struct acpi_driver *driver) | 600 | int 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 | ||
626 | EXPORT_SYMBOL(acpi_bus_register_driver); | 615 | EXPORT_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 | */ |
635 | int acpi_bus_unregister_driver(struct acpi_driver *driver) | 624 | void 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 | ||
652 | EXPORT_SYMBOL(acpi_bus_unregister_driver); | 636 | EXPORT_SYMBOL(acpi_bus_unregister_driver); |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index a90f5d97df35..43dfd8689dce 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -512,7 +512,7 @@ static struct sonypi_device { | |||
512 | 512 | ||
513 | #ifdef CONFIG_ACPI | 513 | #ifdef CONFIG_ACPI |
514 | static struct acpi_device *sonypi_acpi_device; | 514 | static struct acpi_device *sonypi_acpi_device; |
515 | static int acpi_enabled; | 515 | static int acpi_driver_registered; |
516 | #endif | 516 | #endif |
517 | 517 | ||
518 | static int sonypi_ec_write(u8 addr, u8 value) | 518 | static int sonypi_ec_write(u8 addr, u8 value) |
@@ -869,7 +869,7 @@ found: | |||
869 | sonypi_report_input_event(event); | 869 | sonypi_report_input_event(event); |
870 | 870 | ||
871 | #ifdef CONFIG_ACPI | 871 | #ifdef CONFIG_ACPI |
872 | if (acpi_enabled) | 872 | if (sonypi_acpi_device) |
873 | acpi_bus_generate_event(sonypi_acpi_device, 1, event); | 873 | acpi_bus_generate_event(sonypi_acpi_device, 1, event); |
874 | #endif | 874 | #endif |
875 | 875 | ||
@@ -1551,8 +1551,8 @@ static int __init sonypi_init(void) | |||
1551 | goto err_free_device; | 1551 | goto err_free_device; |
1552 | 1552 | ||
1553 | #ifdef CONFIG_ACPI | 1553 | #ifdef CONFIG_ACPI |
1554 | if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0) | 1554 | if (acpi_bus_register_driver(&sonypi_acpi_driver) >= 0) |
1555 | acpi_enabled = 1; | 1555 | acpi_driver_registered = 1; |
1556 | #endif | 1556 | #endif |
1557 | 1557 | ||
1558 | return 0; | 1558 | return 0; |
@@ -1567,7 +1567,7 @@ static int __init sonypi_init(void) | |||
1567 | static void __exit sonypi_exit(void) | 1567 | static void __exit sonypi_exit(void) |
1568 | { | 1568 | { |
1569 | #ifdef CONFIG_ACPI | 1569 | #ifdef CONFIG_ACPI |
1570 | if (acpi_enabled) | 1570 | if (acpi_driver_registered) |
1571 | acpi_bus_unregister_driver(&sonypi_acpi_driver); | 1571 | acpi_bus_unregister_driver(&sonypi_acpi_driver); |
1572 | #endif | 1572 | #endif |
1573 | platform_device_unregister(sonypi_platform_device); | 1573 | platform_device_unregister(sonypi_platform_device); |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 43f8c2a23a24..8c7590fdd822 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -327,7 +327,7 @@ int acpi_bus_set_power(acpi_handle handle, int state); | |||
327 | int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); | 327 | int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); |
328 | int acpi_bus_receive_event(struct acpi_bus_event *event); | 328 | int acpi_bus_receive_event(struct acpi_bus_event *event); |
329 | int acpi_bus_register_driver(struct acpi_driver *driver); | 329 | int acpi_bus_register_driver(struct acpi_driver *driver); |
330 | int acpi_bus_unregister_driver(struct acpi_driver *driver); | 330 | void acpi_bus_unregister_driver(struct acpi_driver *driver); |
331 | int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, | 331 | int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, |
332 | acpi_handle handle, int type); | 332 | acpi_handle handle, int type); |
333 | int acpi_bus_trim(struct acpi_device *start, int rmdevice); | 333 | int acpi_bus_trim(struct acpi_device *start, int rmdevice); |