Files
linux/Documentation/driver-api
Krzysztof Kozlowski 1dfc9d60a6 workqueue: devres: Add device-managed allocate workqueue
Add a Resource-managed version of alloc_workqueue() to fix common
problem of drivers mixing devm() calls with destroy_workqueue.  Such
naive and discouraged driver approach leads to difficult to debug bugs
when the driver:

1. Allocates workqueue in standard way and destroys it in driver
   remove() callback,
2. Sets work struct with devm_work_autocancel(),
3. Registers interrupt handler with devm_request_threaded_irq().

Which leads to following unbind/removal path:

1. destroy_workqueue() via driver remove(),
   Any interrupt coming now would still execute the interrupt handler,
   which queues work on destroyed workqueue.
2. devm_irq_release(),
3. devm_work_drop() -> cancel_work_sync() on destroyed workqueue.

devm_alloc_workqueue() has two benefits:
1. Solves above problem of mix-and-match devres and non-devres code in
   driver,
2. Simplify any sane drivers which were correctly using
   alloc_workqueue() + devm_add_action_or_reset().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Acked-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2026-03-10 07:03:39 -10:00
..
2023-04-26 15:43:19 -07:00
2024-09-05 12:13:39 +02:00
2024-05-02 10:02:29 -06:00
2025-11-07 11:12:03 +01:00
2026-01-11 06:09:11 -10:00
2025-05-19 09:04:21 -06:00
2023-07-24 12:12:24 +02:00
2024-05-10 11:15:21 -06:00
2022-06-10 15:38:14 +02:00
2024-05-02 10:02:29 -06:00