diff options
Diffstat (limited to 'include/linux/workqueue.h')
-rw-r--r-- | include/linux/workqueue.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index a0143dd24430..b6cc20b56560 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -221,24 +221,31 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; } * to generate better code. */ #ifdef CONFIG_LOCKDEP -#define __INIT_WORK(_work, _func, _onstack) \ +#define __INIT_WORK_WITH_KEY(_work, _func, _onstack, _key) \ do { \ - static struct lock_class_key __key; \ - \ __init_work((_work), _onstack); \ (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ - lockdep_init_map(&(_work)->lockdep_map, "(work_completion)"#_work, &__key, 0); \ + lockdep_init_map(&(_work)->lockdep_map, "(work_completion)"#_work, _key, 0); \ INIT_LIST_HEAD(&(_work)->entry); \ (_work)->func = (_func); \ } while (0) -#else + #define __INIT_WORK(_work, _func, _onstack) \ do { \ + static struct lock_class_key __key; \ + __INIT_WORK_WITH_KEY(_work, _func, _onstack, &__key); \ + } while (0) +#else +#define __INIT_WORK_WITH_KEY(_work, _func, _onstack, _key) \ + do { \ __init_work((_work), _onstack); \ (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ INIT_LIST_HEAD(&(_work)->entry); \ (_work)->func = (_func); \ } while (0) + +#define __INIT_WORK(_work, _func, _onstack) \ + __INIT_WORK_WITH_KEY(_work, _func, _onstack, NULL) #endif #define INIT_WORK(_work, _func) \ |