diff options
| -rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 51 |
1 files changed, 37 insertions, 14 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index d153871fd5ab..21e5206ed28b 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
| @@ -562,7 +562,7 @@ static int eeepc_hotk_add(struct acpi_device *device) | |||
| 562 | ehotk->device = device; | 562 | ehotk->device = device; |
| 563 | result = eeepc_hotk_check(); | 563 | result = eeepc_hotk_check(); |
| 564 | if (result) | 564 | if (result) |
| 565 | goto end; | 565 | goto ehotk_fail; |
| 566 | status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY, | 566 | status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY, |
| 567 | eeepc_hotk_notify, ehotk); | 567 | eeepc_hotk_notify, ehotk); |
| 568 | if (ACPI_FAILURE(status)) | 568 | if (ACPI_FAILURE(status)) |
| @@ -573,18 +573,25 @@ static int eeepc_hotk_add(struct acpi_device *device) | |||
| 573 | RFKILL_TYPE_WLAN); | 573 | RFKILL_TYPE_WLAN); |
| 574 | 574 | ||
| 575 | if (!ehotk->eeepc_wlan_rfkill) | 575 | if (!ehotk->eeepc_wlan_rfkill) |
| 576 | goto end; | 576 | goto wlan_fail; |
| 577 | 577 | ||
| 578 | ehotk->eeepc_wlan_rfkill->name = "eeepc-wlan"; | 578 | ehotk->eeepc_wlan_rfkill->name = "eeepc-wlan"; |
| 579 | ehotk->eeepc_wlan_rfkill->toggle_radio = eeepc_wlan_rfkill_set; | 579 | ehotk->eeepc_wlan_rfkill->toggle_radio = eeepc_wlan_rfkill_set; |
| 580 | ehotk->eeepc_wlan_rfkill->get_state = eeepc_wlan_rfkill_state; | 580 | ehotk->eeepc_wlan_rfkill->get_state = eeepc_wlan_rfkill_state; |
| 581 | if (get_acpi(CM_ASL_WLAN) == 1) | 581 | if (get_acpi(CM_ASL_WLAN) == 1) { |
| 582 | ehotk->eeepc_wlan_rfkill->state = | 582 | ehotk->eeepc_wlan_rfkill->state = |
| 583 | RFKILL_STATE_UNBLOCKED; | 583 | RFKILL_STATE_UNBLOCKED; |
| 584 | else | 584 | rfkill_set_default(RFKILL_TYPE_WLAN, |
| 585 | RFKILL_STATE_UNBLOCKED); | ||
| 586 | } else { | ||
| 585 | ehotk->eeepc_wlan_rfkill->state = | 587 | ehotk->eeepc_wlan_rfkill->state = |
| 586 | RFKILL_STATE_SOFT_BLOCKED; | 588 | RFKILL_STATE_SOFT_BLOCKED; |
| 587 | rfkill_register(ehotk->eeepc_wlan_rfkill); | 589 | rfkill_set_default(RFKILL_TYPE_WLAN, |
| 590 | RFKILL_STATE_SOFT_BLOCKED); | ||
| 591 | } | ||
| 592 | result = rfkill_register(ehotk->eeepc_wlan_rfkill); | ||
| 593 | if (result) | ||
| 594 | goto wlan_fail; | ||
| 588 | } | 595 | } |
| 589 | 596 | ||
| 590 | if (get_acpi(CM_ASL_BLUETOOTH) != -1) { | 597 | if (get_acpi(CM_ASL_BLUETOOTH) != -1) { |
| @@ -592,27 +599,43 @@ static int eeepc_hotk_add(struct acpi_device *device) | |||
| 592 | rfkill_allocate(&device->dev, RFKILL_TYPE_BLUETOOTH); | 599 | rfkill_allocate(&device->dev, RFKILL_TYPE_BLUETOOTH); |
| 593 | 600 | ||
| 594 | if (!ehotk->eeepc_bluetooth_rfkill) | 601 | if (!ehotk->eeepc_bluetooth_rfkill) |
| 595 | goto end; | 602 | goto bluetooth_fail; |
| 596 | 603 | ||
| 597 | ehotk->eeepc_bluetooth_rfkill->name = "eeepc-bluetooth"; | 604 | ehotk->eeepc_bluetooth_rfkill->name = "eeepc-bluetooth"; |
| 598 | ehotk->eeepc_bluetooth_rfkill->toggle_radio = | 605 | ehotk->eeepc_bluetooth_rfkill->toggle_radio = |
| 599 | eeepc_bluetooth_rfkill_set; | 606 | eeepc_bluetooth_rfkill_set; |
| 600 | ehotk->eeepc_bluetooth_rfkill->get_state = | 607 | ehotk->eeepc_bluetooth_rfkill->get_state = |
| 601 | eeepc_bluetooth_rfkill_state; | 608 | eeepc_bluetooth_rfkill_state; |
| 602 | if (get_acpi(CM_ASL_BLUETOOTH) == 1) | 609 | if (get_acpi(CM_ASL_BLUETOOTH) == 1) { |
| 603 | ehotk->eeepc_bluetooth_rfkill->state = | 610 | ehotk->eeepc_bluetooth_rfkill->state = |
| 604 | RFKILL_STATE_UNBLOCKED; | 611 | RFKILL_STATE_UNBLOCKED; |
| 605 | else | 612 | rfkill_set_default(RFKILL_TYPE_BLUETOOTH, |
| 613 | RFKILL_STATE_UNBLOCKED); | ||
| 614 | } else { | ||
| 606 | ehotk->eeepc_bluetooth_rfkill->state = | 615 | ehotk->eeepc_bluetooth_rfkill->state = |
| 607 | RFKILL_STATE_SOFT_BLOCKED; | 616 | RFKILL_STATE_SOFT_BLOCKED; |
| 608 | rfkill_register(ehotk->eeepc_bluetooth_rfkill); | 617 | rfkill_set_default(RFKILL_TYPE_BLUETOOTH, |
| 609 | } | 618 | RFKILL_STATE_SOFT_BLOCKED); |
| 619 | } | ||
| 610 | 620 | ||
| 611 | end: | 621 | result = rfkill_register(ehotk->eeepc_bluetooth_rfkill); |
| 612 | if (result) { | 622 | if (result) |
| 613 | kfree(ehotk); | 623 | goto bluetooth_fail; |
| 614 | ehotk = NULL; | ||
| 615 | } | 624 | } |
| 625 | return 0; | ||
| 626 | |||
| 627 | bluetooth_fail: | ||
| 628 | if (ehotk->eeepc_bluetooth_rfkill) | ||
| 629 | rfkill_free(ehotk->eeepc_bluetooth_rfkill); | ||
| 630 | rfkill_unregister(ehotk->eeepc_wlan_rfkill); | ||
| 631 | ehotk->eeepc_wlan_rfkill = NULL; | ||
| 632 | wlan_fail: | ||
| 633 | if (ehotk->eeepc_wlan_rfkill) | ||
| 634 | rfkill_free(ehotk->eeepc_wlan_rfkill); | ||
| 635 | ehotk_fail: | ||
| 636 | kfree(ehotk); | ||
| 637 | ehotk = NULL; | ||
| 638 | |||
| 616 | return result; | 639 | return result; |
| 617 | } | 640 | } |
| 618 | 641 | ||
