diff options
| author | Azael Avalos <coproscefalo@gmail.com> | 2015-03-26 16:56:06 -0400 |
|---|---|---|
| committer | Darren Hart <dvhart@linux.intel.com> | 2015-03-26 17:15:07 -0400 |
| commit | 18b8696b66d79024649c895d4a5b7da4f268300e (patch) | |
| tree | bbd34a200847671d000deb29a245e1d98011d127 | |
| parent | bb2ea96b4840fb244e74ed7c470a3ec88e5b084a (diff) | |
toshiba_bluetooth: Clean up *_add function and disable BT device at removal
This patch cleans the toshiba_bluetooth_add function by using the
recently introduced function toshiba_bluetooth_present, simplifying
its code and returning appropriate error values.
Also, disables the BT device at the removal of the driver, by using
the function toshiba_bluetooth_disable.
Signed-off-by: Azael Avalos <coproscefalo@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
| -rw-r--r-- | drivers/platform/x86/toshiba_bluetooth.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/platform/x86/toshiba_bluetooth.c b/drivers/platform/x86/toshiba_bluetooth.c index b479a701d3a8..b8404c7a74cf 100644 --- a/drivers/platform/x86/toshiba_bluetooth.c +++ b/drivers/platform/x86/toshiba_bluetooth.c | |||
| @@ -62,6 +62,11 @@ static int toshiba_bluetooth_present(acpi_handle handle) | |||
| 62 | acpi_status result; | 62 | acpi_status result; |
| 63 | u64 bt_present; | 63 | u64 bt_present; |
| 64 | 64 | ||
| 65 | /* | ||
| 66 | * Some Toshiba laptops may have a fake TOS6205 device in | ||
| 67 | * their ACPI BIOS, so query the _STA method to see if there | ||
| 68 | * is really anything there. | ||
| 69 | */ | ||
| 65 | result = acpi_evaluate_integer(handle, "_STA", NULL, &bt_present); | 70 | result = acpi_evaluate_integer(handle, "_STA", NULL, &bt_present); |
| 66 | if (ACPI_FAILURE(result)) { | 71 | if (ACPI_FAILURE(result)) { |
| 67 | pr_err("ACPI call to query Bluetooth presence failed"); | 72 | pr_err("ACPI call to query Bluetooth presence failed"); |
| @@ -150,23 +155,18 @@ static int toshiba_bt_resume(struct device *dev) | |||
| 150 | 155 | ||
| 151 | static int toshiba_bt_rfkill_add(struct acpi_device *device) | 156 | static int toshiba_bt_rfkill_add(struct acpi_device *device) |
| 152 | { | 157 | { |
| 153 | acpi_status status; | 158 | int result; |
| 154 | u64 bt_present; | ||
| 155 | int result = -ENODEV; | ||
| 156 | 159 | ||
| 157 | /* | 160 | result = toshiba_bluetooth_present(device->handle); |
| 158 | * Some Toshiba laptops may have a fake TOS6205 device in | 161 | if (result) |
| 159 | * their ACPI BIOS, so query the _STA method to see if there | 162 | return result; |
| 160 | * is really anything there, before trying to enable it. | ||
| 161 | */ | ||
| 162 | status = acpi_evaluate_integer(device->handle, "_STA", NULL, | ||
| 163 | &bt_present); | ||
| 164 | 163 | ||
| 165 | if (!ACPI_FAILURE(status) && bt_present) { | 164 | pr_info("Toshiba ACPI Bluetooth device driver\n"); |
| 166 | pr_info("Detected Toshiba ACPI Bluetooth device - " | 165 | |
| 167 | "installing RFKill handler\n"); | 166 | /* Enable the BT device */ |
| 168 | result = toshiba_bluetooth_enable(device->handle); | 167 | result = toshiba_bluetooth_enable(device->handle); |
| 169 | } | 168 | if (result) |
| 169 | return result; | ||
| 170 | 170 | ||
| 171 | return result; | 171 | return result; |
| 172 | } | 172 | } |
| @@ -174,7 +174,7 @@ static int toshiba_bt_rfkill_add(struct acpi_device *device) | |||
| 174 | static int toshiba_bt_rfkill_remove(struct acpi_device *device) | 174 | static int toshiba_bt_rfkill_remove(struct acpi_device *device) |
| 175 | { | 175 | { |
| 176 | /* clean up */ | 176 | /* clean up */ |
| 177 | return 0; | 177 | return toshiba_bluetooth_disable(device->handle); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | module_acpi_driver(toshiba_bt_rfkill_driver); | 180 | module_acpi_driver(toshiba_bt_rfkill_driver); |
