Skip to content

Commit 3f3a259

Browse files
committed
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>
1 parent 392829e commit 3f3a259

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

drivers/acpi/osl.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,19 +1092,21 @@ acpi_status acpi_os_execute(acpi_execute_type type,
10921092

10931093
dpc->function = function;
10941094
dpc->context = context;
1095+
INIT_WORK(&dpc->work, acpi_os_execute_deferred);
10951096

10961097
/*
10971098
* To prevent lockdep from complaining unnecessarily, make sure that
10981099
* there is a different static lockdep key for each workqueue by using
10991100
* INIT_WORK() for each of them separately.
11001101
*/
1101-
if (type == OSL_NOTIFY_HANDLER) {
1102+
switch (type) {
1103+
case OSL_NOTIFY_HANDLER:
11021104
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:
11051107
queue = kacpid_wq;
1106-
INIT_WORK(&dpc->work, acpi_os_execute_deferred);
1107-
} else {
1108+
break;
1109+
default:
11081110
pr_err("Unsupported os_execute type %d.\n", type);
11091111
goto err;
11101112
}

0 commit comments

Comments
 (0)