diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-02 08:09:08 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-14 18:18:20 -0500 |
commit | 3ae45a27df74358b4bcd3d5a67e47ad734a48945 (patch) | |
tree | 17ffd507fd96a4567fa2d6076b497298384d0945 | |
parent | c5b18e22e74dc7dbd3f7729997a3a553ce761d2b (diff) |
ACPI: Make seemingly useless check in osl.c more understandable
There is a seemingly useless check in drivers/acpi/osl.c added by
commit bc73675 (ACPI: fixes a false alarm from lockdep), which really
is necessary to avoid false positive lockdep complaints. Document
this and rearrange the code related to it so that it makes fewer
checks.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
-rw-r--r-- | drivers/acpi/osl.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 7dfe91d0173e..6dc4a2b1e956 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -932,7 +932,7 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, | |||
932 | * having a static work_struct. | 932 | * having a static work_struct. |
933 | */ | 933 | */ |
934 | 934 | ||
935 | dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC); | 935 | dpc = kzalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC); |
936 | if (!dpc) | 936 | if (!dpc) |
937 | return AE_NO_MEMORY; | 937 | return AE_NO_MEMORY; |
938 | 938 | ||
@@ -944,17 +944,22 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, | |||
944 | * because the hotplug code may call driver .remove() functions, | 944 | * because the hotplug code may call driver .remove() functions, |
945 | * which invoke flush_scheduled_work/acpi_os_wait_events_complete | 945 | * which invoke flush_scheduled_work/acpi_os_wait_events_complete |
946 | * to flush these workqueues. | 946 | * to flush these workqueues. |
947 | * | ||
948 | * To prevent lockdep from complaining unnecessarily, make sure that | ||
949 | * there is a different static lockdep key for each workqueue by using | ||
950 | * INIT_WORK() for each of them separately. | ||
947 | */ | 951 | */ |
948 | queue = hp ? kacpi_hotplug_wq : | 952 | if (hp) { |
949 | (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); | 953 | queue = kacpi_hotplug_wq; |
950 | dpc->wait = hp ? 1 : 0; | 954 | dpc->wait = 1; |
951 | |||
952 | if (queue == kacpi_hotplug_wq) | ||
953 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | 955 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); |
954 | else if (queue == kacpi_notify_wq) | 956 | } else if (type == OSL_NOTIFY_HANDLER) { |
957 | queue = kacpi_notify_wq; | ||
955 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | 958 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); |
956 | else | 959 | } else { |
960 | queue = kacpid_wq; | ||
957 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | 961 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); |
962 | } | ||
958 | 963 | ||
959 | /* | 964 | /* |
960 | * On some machines, a software-initiated SMI causes corruption unless | 965 | * On some machines, a software-initiated SMI causes corruption unless |