diff options
| author | Tejun Heo <tj@kernel.org> | 2026-03-10 07:03:57 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-03-10 07:03:57 -1000 |
| commit | b39bf7f0fae98c03e5ba6061e2251eeb36ec0b39 (patch) | |
| tree | 7ea9c05e8a9b7537930985c0a9a19c9ba6773909 /include/linux/workqueue.h | |
| parent | c116737e972ea74f4468a1bd0703d623a3c0ee4a (diff) | |
| parent | 1dfc9d60a69ec148e1cb709256617d86e5f0e8f8 (diff) | |
Merge branch 'for-7.1-devm-alloc-wq' into for-7.1
Diffstat (limited to 'include/linux/workqueue.h')
| -rw-r--r-- | include/linux/workqueue.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 8e0855d56e74..9f971912c6be 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -516,6 +516,26 @@ __printf(1, 4) struct workqueue_struct * alloc_workqueue_noprof(const char *fmt, unsigned int flags, int max_active, ...); #define alloc_workqueue(...) alloc_hooks(alloc_workqueue_noprof(__VA_ARGS__)) +/** + * devm_alloc_workqueue - Resource-managed allocate a workqueue + * @dev: Device to allocate workqueue for + * @fmt: printf format for the name of the workqueue + * @flags: WQ_* flags + * @max_active: max in-flight work items, 0 for default + * @...: args for @fmt + * + * Resource managed workqueue, see alloc_workqueue() for details. + * + * The workqueue will be automatically destroyed on driver detach. Typically + * this should be used in drivers already relying on devm interafaces. + * + * RETURNS: + * Pointer to the allocated workqueue on success, %NULL on failure. + */ +__printf(2, 5) struct workqueue_struct * +devm_alloc_workqueue(struct device *dev, const char *fmt, unsigned int flags, + int max_active, ...); + #ifdef CONFIG_LOCKDEP /** * alloc_workqueue_lockdep_map - allocate a workqueue with user-defined lockdep_map @@ -572,6 +592,8 @@ alloc_workqueue_lockdep_map(const char *fmt, unsigned int flags, int max_active, */ #define alloc_ordered_workqueue(fmt, flags, args...) \ alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args) +#define devm_alloc_ordered_workqueue(dev, fmt, flags, args...) \ + devm_alloc_workqueue(dev, fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args) #define create_workqueue(name) \ alloc_workqueue("%s", __WQ_LEGACY | WQ_MEM_RECLAIM | WQ_PERCPU, 1, (name)) |
