Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: OSL: Rearrange workqueue selection in acpi_os_execute()

Replace the 3-branch if () statement used for selecting the target
workqueue in acpi_os_execute() with a switch () one that is more
suitable for this purpose and carry out the work item initialization
before it to avoid code duplication.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

+7 -5
+7 -5
drivers/acpi/osl.c
··· 1092 1092 1093 1093 dpc->function = function; 1094 1094 dpc->context = context; 1095 + INIT_WORK(&dpc->work, acpi_os_execute_deferred); 1095 1096 1096 1097 /* 1097 1098 * To prevent lockdep from complaining unnecessarily, make sure that 1098 1099 * there is a different static lockdep key for each workqueue by using 1099 1100 * INIT_WORK() for each of them separately. 1100 1101 */ 1101 - if (type == OSL_NOTIFY_HANDLER) { 1102 + switch (type) { 1103 + case OSL_NOTIFY_HANDLER: 1102 1104 queue = kacpi_notify_wq; 1103 - INIT_WORK(&dpc->work, acpi_os_execute_deferred); 1104 - } else if (type == OSL_GPE_HANDLER) { 1105 + break; 1106 + case OSL_GPE_HANDLER: 1105 1107 queue = kacpid_wq; 1106 - INIT_WORK(&dpc->work, acpi_os_execute_deferred); 1107 - } else { 1108 + break; 1109 + default: 1108 1110 pr_err("Unsupported os_execute type %d.\n", type); 1109 1111 goto err; 1110 1112 }