diff options
Diffstat (limited to 'drivers/acpi/processor_driver.c')
-rw-r--r-- | drivers/acpi/processor_driver.c | 62 |
1 files changed, 27 insertions, 35 deletions
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index e83311bf1ebd..cbf1f122666b 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c | |||
@@ -81,7 +81,7 @@ MODULE_DESCRIPTION("ACPI Processor Driver"); | |||
81 | MODULE_LICENSE("GPL"); | 81 | MODULE_LICENSE("GPL"); |
82 | 82 | ||
83 | static int acpi_processor_add(struct acpi_device *device); | 83 | static int acpi_processor_add(struct acpi_device *device); |
84 | static int acpi_processor_remove(struct acpi_device *device, int type); | 84 | static int acpi_processor_remove(struct acpi_device *device); |
85 | static void acpi_processor_notify(struct acpi_device *device, u32 event); | 85 | static void acpi_processor_notify(struct acpi_device *device, u32 event); |
86 | static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr); | 86 | static acpi_status acpi_processor_hotadd_init(struct acpi_processor *pr); |
87 | static int acpi_processor_handle_eject(struct acpi_processor *pr); | 87 | static int acpi_processor_handle_eject(struct acpi_processor *pr); |
@@ -610,7 +610,7 @@ err_free_pr: | |||
610 | return result; | 610 | return result; |
611 | } | 611 | } |
612 | 612 | ||
613 | static int acpi_processor_remove(struct acpi_device *device, int type) | 613 | static int acpi_processor_remove(struct acpi_device *device) |
614 | { | 614 | { |
615 | struct acpi_processor *pr = NULL; | 615 | struct acpi_processor *pr = NULL; |
616 | 616 | ||
@@ -623,7 +623,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type) | |||
623 | if (pr->id >= nr_cpu_ids) | 623 | if (pr->id >= nr_cpu_ids) |
624 | goto free; | 624 | goto free; |
625 | 625 | ||
626 | if (type == ACPI_BUS_REMOVAL_EJECT) { | 626 | if (device->removal_type == ACPI_BUS_REMOVAL_EJECT) { |
627 | if (acpi_processor_handle_eject(pr)) | 627 | if (acpi_processor_handle_eject(pr)) |
628 | return -EINVAL; | 628 | return -EINVAL; |
629 | } | 629 | } |
@@ -677,36 +677,17 @@ static int is_processor_present(acpi_handle handle) | |||
677 | return 0; | 677 | return 0; |
678 | } | 678 | } |
679 | 679 | ||
680 | static | ||
681 | int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) | ||
682 | { | ||
683 | acpi_handle phandle; | ||
684 | struct acpi_device *pdev; | ||
685 | |||
686 | |||
687 | if (acpi_get_parent(handle, &phandle)) { | ||
688 | return -ENODEV; | ||
689 | } | ||
690 | |||
691 | if (acpi_bus_get_device(phandle, &pdev)) { | ||
692 | return -ENODEV; | ||
693 | } | ||
694 | |||
695 | if (acpi_bus_add(device, pdev, handle, ACPI_BUS_TYPE_PROCESSOR)) { | ||
696 | return -ENODEV; | ||
697 | } | ||
698 | |||
699 | return 0; | ||
700 | } | ||
701 | |||
702 | static void acpi_processor_hotplug_notify(acpi_handle handle, | 680 | static void acpi_processor_hotplug_notify(acpi_handle handle, |
703 | u32 event, void *data) | 681 | u32 event, void *data) |
704 | { | 682 | { |
705 | struct acpi_device *device = NULL; | 683 | struct acpi_device *device = NULL; |
706 | struct acpi_eject_event *ej_event = NULL; | 684 | struct acpi_eject_event *ej_event = NULL; |
707 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ | 685 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ |
686 | acpi_status status; | ||
708 | int result; | 687 | int result; |
709 | 688 | ||
689 | acpi_scan_lock_acquire(); | ||
690 | |||
710 | switch (event) { | 691 | switch (event) { |
711 | case ACPI_NOTIFY_BUS_CHECK: | 692 | case ACPI_NOTIFY_BUS_CHECK: |
712 | case ACPI_NOTIFY_DEVICE_CHECK: | 693 | case ACPI_NOTIFY_DEVICE_CHECK: |
@@ -721,12 +702,16 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, | |||
721 | if (!acpi_bus_get_device(handle, &device)) | 702 | if (!acpi_bus_get_device(handle, &device)) |
722 | break; | 703 | break; |
723 | 704 | ||
724 | result = acpi_processor_device_add(handle, &device); | 705 | result = acpi_bus_scan(handle); |
725 | if (result) { | 706 | if (result) { |
726 | acpi_handle_err(handle, "Unable to add the device\n"); | 707 | acpi_handle_err(handle, "Unable to add the device\n"); |
727 | break; | 708 | break; |
728 | } | 709 | } |
729 | 710 | result = acpi_bus_get_device(handle, &device); | |
711 | if (result) { | ||
712 | acpi_handle_err(handle, "Missing device object\n"); | ||
713 | break; | ||
714 | } | ||
730 | ost_code = ACPI_OST_SC_SUCCESS; | 715 | ost_code = ACPI_OST_SC_SUCCESS; |
731 | break; | 716 | break; |
732 | 717 | ||
@@ -751,25 +736,32 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, | |||
751 | break; | 736 | break; |
752 | } | 737 | } |
753 | 738 | ||
754 | ej_event->handle = handle; | 739 | get_device(&device->dev); |
740 | ej_event->device = device; | ||
755 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; | 741 | ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; |
756 | acpi_os_hotplug_execute(acpi_bus_hot_remove_device, | 742 | /* The eject is carried out asynchronously. */ |
757 | (void *)ej_event); | 743 | status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, |
758 | 744 | ej_event); | |
759 | /* eject is performed asynchronously */ | 745 | if (ACPI_FAILURE(status)) { |
760 | return; | 746 | put_device(&device->dev); |
747 | kfree(ej_event); | ||
748 | break; | ||
749 | } | ||
750 | goto out; | ||
761 | 751 | ||
762 | default: | 752 | default: |
763 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 753 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
764 | "Unsupported event [0x%x]\n", event)); | 754 | "Unsupported event [0x%x]\n", event)); |
765 | 755 | ||
766 | /* non-hotplug event; possibly handled by other handler */ | 756 | /* non-hotplug event; possibly handled by other handler */ |
767 | return; | 757 | goto out; |
768 | } | 758 | } |
769 | 759 | ||
770 | /* Inform firmware that the hotplug operation has completed */ | 760 | /* Inform firmware that the hotplug operation has completed */ |
771 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); | 761 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); |
772 | return; | 762 | |
763 | out: | ||
764 | acpi_scan_lock_release(); | ||
773 | } | 765 | } |
774 | 766 | ||
775 | static acpi_status is_processor_device(acpi_handle handle) | 767 | static acpi_status is_processor_device(acpi_handle handle) |