Re: [PATCH v8 02/12] kthread: Kthread worker API cleanup

From: Peter Zijlstra
Date: Thu Jun 09 2016 - 13:22:51 EST


On Thu, Jun 09, 2016 at 03:51:56PM +0200, Petr Mladek wrote:
> -#define DEFINE_KTHREAD_WORKER(worker) \
> - struct kthread_worker worker = KTHREAD_WORKER_INIT(worker)
> +#define KTHREAD_DECLARE_WORKER(worker) \
> + struct kthread_worker worker = KTHREAD_INIT_WORKER(worker)
>
> -#define DEFINE_KTHREAD_WORK(work, fn) \
> - struct kthread_work work = KTHREAD_WORK_INIT(work, fn)
> +#define KTHREAD_DECLARE_WORK(work, fn) \
> + struct kthread_work work = KTHREAD_INIT_WORK(work, fn)
>
> /*
> * kthread_worker.lock needs its own lockdep class key when defined on
> * stack with lockdep enabled. Use the following macros in such cases.
> */
> #ifdef CONFIG_LOCKDEP
> -# define KTHREAD_WORKER_INIT_ONSTACK(worker) \
> - ({ init_kthread_worker(&worker); worker; })
> -# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) \
> - struct kthread_worker worker = KTHREAD_WORKER_INIT_ONSTACK(worker)
> +# define KTHREAD_INIT_WORKER_ONSTACK(worker) \
> + ({ kthread_init_worker(&worker); worker; })
> +# define KTHREAD_DECLARE_WORKER_ONSTACK(worker) \
> + struct kthread_worker worker = KTHREAD_INIT_WORKER_ONSTACK(worker)
> #else
> -# define DEFINE_KTHREAD_WORKER_ONSTACK(worker) DEFINE_KTHREAD_WORKER(worker)
> +# define KTHREAD_DECLARE_WORKER_ONSTACK(worker) KTHREAD_DECLARE_WORKER(worker)
> #endif

As Steven already said; these are very much definitions _not_
declarations.