diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2006-03-28 17:04:00 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-04-01 21:48:08 -0500 |
commit | e4513a57ef719d3d6d1cee0ca4d9f4016aa452bb (patch) | |
tree | e4b837a10ada6c1d8ecfb065cb864c556a4641ce /drivers/char | |
parent | 578b333bfe8eb1360207a08a53c321822a8f40f3 (diff) |
ACPI: fix sonypi ACPI driver registration to unregister on failure
Remove the assumption that acpi_bus_register_driver() returns the number of
devices claimed. Returning the count is unreliable because devices may be
hot-plugged in the future (admittedly not applicable for this driver).
This also fixes a bug: if sonypi_acpi_driver was registered but found no
devices, sonypi_exit() did not unregister it.
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/char')
-rw-r--r-- | drivers/char/sonypi.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index f8dd8527c6aa..81ce5515b41f 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 | ||
@@ -1548,8 +1548,8 @@ static int __init sonypi_init(void) | |||
1548 | goto err_free_device; | 1548 | goto err_free_device; |
1549 | 1549 | ||
1550 | #ifdef CONFIG_ACPI | 1550 | #ifdef CONFIG_ACPI |
1551 | if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0) | 1551 | if (acpi_bus_register_driver(&sonypi_acpi_driver) >= 0) |
1552 | acpi_enabled = 1; | 1552 | acpi_driver_registered = 1; |
1553 | #endif | 1553 | #endif |
1554 | 1554 | ||
1555 | return 0; | 1555 | return 0; |
@@ -1564,7 +1564,7 @@ static int __init sonypi_init(void) | |||
1564 | static void __exit sonypi_exit(void) | 1564 | static void __exit sonypi_exit(void) |
1565 | { | 1565 | { |
1566 | #ifdef CONFIG_ACPI | 1566 | #ifdef CONFIG_ACPI |
1567 | if (acpi_enabled) | 1567 | if (acpi_driver_registered) |
1568 | acpi_bus_unregister_driver(&sonypi_acpi_driver); | 1568 | acpi_bus_unregister_driver(&sonypi_acpi_driver); |
1569 | #endif | 1569 | #endif |
1570 | platform_device_unregister(sonypi_platform_device); | 1570 | platform_device_unregister(sonypi_platform_device); |