Ever since these macros were introduced in commit b56c0d8937e6 ("kthread: implement kthread_worker"), there has been precisely one user (commit 4d115420707a, "NVMe: Async IO queue deletion"), and that user went away in 2016 with db3cbfff5bcc ("NVMe: IO queue deletion re-write"). Apart from being unused, these macros are also awkward to use (which may contribute to them not being used): Having a way to statically (or on-stack) allocating the storage for the struct kthread_worker itself doesn't help much, since obviously one needs to have some code for actually _spawning_ the worker thread, which must have error checking. And these days we have the kthread_create_worker() interface which both allocates the struct kthread_worker and spawns the kthread.
Showing the changes to include (1 of 1 file). Show all
Unified · Split
| @@ -141,12 +141,6 @@ struct kthread_delayed_work { · 140 unmodified lines | |||
| 141 | struct timer_list timer; | 141 | struct timer_list timer; |
| 142 | }; | 142 | }; |
| 143 | 143 | ||
| 144 | #define KTHREAD_WORKER_INIT(worker) { \ | ||
| 145 | .lock = __RAW_SPIN_LOCK_UNLOCKED((worker).lock), \ | ||
| 146 | .work_list = LIST_HEAD_INIT((worker).work_list), \ | ||
| 147 | .delayed_work_list = LIST_HEAD_INIT((worker).delayed_work_list),\ | ||
| 148 | } | ||
| 149 | |||
| 150 | #define KTHREAD_WORK_INIT(work, fn) { \ | 144 | #define KTHREAD_WORK_INIT(work, fn) { \ |
| 151 | .node = LIST_HEAD_INIT((work).node), \ | 145 | .node = LIST_HEAD_INIT((work).node), \ |
| 152 | .func = (fn), \ | 146 | .func = (fn), \ |
| @@ -158,9 +152,6 @@ struct kthread_delayed_work { · 5 unmodified lines | |||
| 158 | TIMER_IRQSAFE), \ | 152 | TIMER_IRQSAFE), \ |
| 159 | } | 153 | } |
| 160 | 154 | ||
| 161 | #define DEFINE_KTHREAD_WORKER(worker) \ | ||
| 162 | struct kthread_worker worker = KTHREAD_WORKER_INIT(worker) | ||
| 163 | |||
| 164 | #define DEFINE_KTHREAD_WORK(work, fn) \ | 155 | #define DEFINE_KTHREAD_WORK(work, fn) \ |
| 165 | struct kthread_work work = KTHREAD_WORK_INIT(work, fn) | 156 | struct kthread_work work = KTHREAD_WORK_INIT(work, fn) |
| 166 | 157 | ||
| @@ -168,19 +159,6 @@ struct kthread_delayed_work { · 1 unmodified line | |||
| 168 | struct kthread_delayed_work dwork = \ | 159 | struct kthread_delayed_work dwork = \ |
| 169 | KTHREAD_DELAYED_WORK_INIT(dwork, fn) | 160 | KTHREAD_DELAYED_WORK_INIT(dwork, fn) |
| 170 | 161 | ||
| 171 | /* | ||
| 172 | * kthread_worker.lock needs its own lockdep class key when defined on | ||
| 173 | * stack with lockdep enabled. Use the following macros in such cases. | ||
| 174 | */ | ||
| 175 | #ifdef CONFIG_LOCKDEP | ||
| 176 | # define KTHREAD_WORKER_INIT_ONSTACK(worker) \ | ||
| 177 | ({ kthread_init_worker(&worker); worker; }) | ||
| 178 | # define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \ | ||
| 179 | struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker) | ||
| 180 | #else | ||
| 181 | # define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker) | ||
| 182 | #endif | ||
| 183 | |||
| 184 | extern void __kthread_init_worker(struct kthread_worker *worker, | 162 | extern void __kthread_init_worker(struct kthread_worker *worker, |
| 185 | const char *name, struct lock_class_key *key); | 163 | const char *name, struct lock_class_key *key); |
| 186 | 164 | ||