diff options
| -rw-r--r-- | include/linux/workqueue.h | 4 | ||||
| -rw-r--r-- | kernel/workqueue.c | 15 |
2 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 9466e860d8c2..d0f7c8178498 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
| @@ -297,4 +297,8 @@ static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) | |||
| 297 | #else | 297 | #else |
| 298 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); | 298 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); |
| 299 | #endif /* CONFIG_SMP */ | 299 | #endif /* CONFIG_SMP */ |
| 300 | |||
| 301 | #ifdef CONFIG_LOCKDEP | ||
| 302 | int in_workqueue_context(struct workqueue_struct *wq); | ||
| 303 | #endif | ||
| 300 | #endif | 304 | #endif |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 327d2deb4451..59fef1531dd2 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
| @@ -68,6 +68,21 @@ struct workqueue_struct { | |||
| 68 | #endif | 68 | #endif |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | #ifdef CONFIG_LOCKDEP | ||
| 72 | /** | ||
| 73 | * in_workqueue_context() - in context of specified workqueue? | ||
| 74 | * @wq: the workqueue of interest | ||
| 75 | * | ||
| 76 | * Checks lockdep state to see if the current task is executing from | ||
| 77 | * within a workqueue item. This function exists only if lockdep is | ||
| 78 | * enabled. | ||
| 79 | */ | ||
| 80 | int in_workqueue_context(struct workqueue_struct *wq) | ||
| 81 | { | ||
| 82 | return lock_is_held(&wq->lockdep_map); | ||
| 83 | } | ||
| 84 | #endif | ||
| 85 | |||
| 71 | #ifdef CONFIG_DEBUG_OBJECTS_WORK | 86 | #ifdef CONFIG_DEBUG_OBJECTS_WORK |
| 72 | 87 | ||
| 73 | static struct debug_obj_descr work_debug_descr; | 88 | static struct debug_obj_descr work_debug_descr; |
