mirror of
https://github.com/torvalds/linux.git
synced 2025-04-12 15:47:24 +00:00
drm/managed: Add DRM-managed alloc_ordered_workqueue
Add drmm_alloc_ordered_workqueue(), a helper that provides managed ordered workqueue cleanup. The workqueue will be destroyed with the final reference of the DRM device. Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Maxime Ripard <mripard@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20250116-google-vkms-managed-v9-3-3e4ae1bd05a0@bootlin.com Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
This commit is contained in:
parent
16d22ba2de
commit
c367b772e6
@ -310,3 +310,11 @@ void __drmm_mutex_release(struct drm_device *dev, void *res)
|
||||
mutex_destroy(lock);
|
||||
}
|
||||
EXPORT_SYMBOL(__drmm_mutex_release);
|
||||
|
||||
void __drmm_workqueue_release(struct drm_device *device, void *res)
|
||||
{
|
||||
struct workqueue_struct *wq = res;
|
||||
|
||||
destroy_workqueue(wq);
|
||||
}
|
||||
EXPORT_SYMBOL(__drmm_workqueue_release);
|
||||
|
@ -127,4 +127,16 @@ void __drmm_mutex_release(struct drm_device *dev, void *res);
|
||||
drmm_add_action_or_reset(dev, __drmm_mutex_release, lock); \
|
||||
}) \
|
||||
|
||||
void __drmm_workqueue_release(struct drm_device *device, void *wq);
|
||||
|
||||
#define drmm_alloc_ordered_workqueue(dev, fmt, flags, args...) \
|
||||
({ \
|
||||
struct workqueue_struct *wq = alloc_ordered_workqueue(fmt, flags, ##args); \
|
||||
wq ? ({ \
|
||||
int ret = drmm_add_action_or_reset(dev, __drmm_workqueue_release, wq); \
|
||||
ret ? ERR_PTR(ret) : wq; \
|
||||
}) : \
|
||||
wq; \
|
||||
})
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user