diff options
Diffstat (limited to 'drivers/acpi/dock.c')
-rw-r--r-- | drivers/acpi/dock.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 78648f811049..4fdea381ef21 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -744,7 +744,9 @@ static void acpi_dock_deferred_cb(void *context) | |||
744 | { | 744 | { |
745 | struct dock_data *data = context; | 745 | struct dock_data *data = context; |
746 | 746 | ||
747 | acpi_scan_lock_acquire(); | ||
747 | dock_notify(data->handle, data->event, data->ds); | 748 | dock_notify(data->handle, data->event, data->ds); |
749 | acpi_scan_lock_release(); | ||
748 | kfree(data); | 750 | kfree(data); |
749 | } | 751 | } |
750 | 752 | ||
@@ -757,20 +759,31 @@ static int acpi_dock_notifier_call(struct notifier_block *this, | |||
757 | if (event != ACPI_NOTIFY_BUS_CHECK && event != ACPI_NOTIFY_DEVICE_CHECK | 759 | if (event != ACPI_NOTIFY_BUS_CHECK && event != ACPI_NOTIFY_DEVICE_CHECK |
758 | && event != ACPI_NOTIFY_EJECT_REQUEST) | 760 | && event != ACPI_NOTIFY_EJECT_REQUEST) |
759 | return 0; | 761 | return 0; |
762 | |||
763 | acpi_scan_lock_acquire(); | ||
764 | |||
760 | list_for_each_entry(dock_station, &dock_stations, sibling) { | 765 | list_for_each_entry(dock_station, &dock_stations, sibling) { |
761 | if (dock_station->handle == handle) { | 766 | if (dock_station->handle == handle) { |
762 | struct dock_data *dd; | 767 | struct dock_data *dd; |
768 | acpi_status status; | ||
763 | 769 | ||
764 | dd = kmalloc(sizeof(*dd), GFP_KERNEL); | 770 | dd = kmalloc(sizeof(*dd), GFP_KERNEL); |
765 | if (!dd) | 771 | if (!dd) |
766 | return 0; | 772 | break; |
773 | |||
767 | dd->handle = handle; | 774 | dd->handle = handle; |
768 | dd->event = event; | 775 | dd->event = event; |
769 | dd->ds = dock_station; | 776 | dd->ds = dock_station; |
770 | acpi_os_hotplug_execute(acpi_dock_deferred_cb, dd); | 777 | status = acpi_os_hotplug_execute(acpi_dock_deferred_cb, |
771 | return 0 ; | 778 | dd); |
779 | if (ACPI_FAILURE(status)) | ||
780 | kfree(dd); | ||
781 | |||
782 | break; | ||
772 | } | 783 | } |
773 | } | 784 | } |
785 | |||
786 | acpi_scan_lock_release(); | ||
774 | return 0; | 787 | return 0; |
775 | } | 788 | } |
776 | 789 | ||
@@ -825,7 +838,7 @@ static ssize_t show_docked(struct device *dev, | |||
825 | 838 | ||
826 | struct dock_station *dock_station = dev->platform_data; | 839 | struct dock_station *dock_station = dev->platform_data; |
827 | 840 | ||
828 | if (ACPI_SUCCESS(acpi_bus_get_device(dock_station->handle, &tmp))) | 841 | if (!acpi_bus_get_device(dock_station->handle, &tmp)) |
829 | return snprintf(buf, PAGE_SIZE, "1\n"); | 842 | return snprintf(buf, PAGE_SIZE, "1\n"); |
830 | return snprintf(buf, PAGE_SIZE, "0\n"); | 843 | return snprintf(buf, PAGE_SIZE, "0\n"); |
831 | } | 844 | } |