diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-11-29 14:48:22 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-12-06 21:14:34 +0100 |
commit | 3f3a2599374ede5ac47ca89981ff8dd8f304d915 (patch) | |
tree | 9e3775ce29842923340400f8f64ffdee9cd359ed /drivers/acpi | |
parent | 392829ede37f36efa2e0f034631594786a9c8139 (diff) |
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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/osl.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 603057f6c63e..5eacf807d552 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1092,19 +1092,21 @@ acpi_status acpi_os_execute(acpi_execute_type type, dpc->function = function; dpc->context = context; + INIT_WORK(&dpc->work, acpi_os_execute_deferred); /* * To prevent lockdep from complaining unnecessarily, make sure that * there is a different static lockdep key for each workqueue by using * INIT_WORK() for each of them separately. */ - if (type == OSL_NOTIFY_HANDLER) { + switch (type) { + case OSL_NOTIFY_HANDLER: queue = kacpi_notify_wq; - INIT_WORK(&dpc->work, acpi_os_execute_deferred); - } else if (type == OSL_GPE_HANDLER) { + break; + case OSL_GPE_HANDLER: queue = kacpid_wq; - INIT_WORK(&dpc->work, acpi_os_execute_deferred); - } else { + break; + default: pr_err("Unsupported os_execute type %d.\n", type); goto err; } |