Skip to content

Commit

Permalink
[PATCH] lockdep: clean up completion initializer in smpboot.c
Browse files Browse the repository at this point in the history
Clean up lockdep on-stack-completion initializer.  (This also removes the
dependency on waitqueue_lock_key.)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Ingo Molnar authored and Linus Torvalds committed Jul 10, 2006
1 parent d6d897c commit f86bf9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions arch/x86_64/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,12 +771,10 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
unsigned long start_rip;
struct create_idle c_idle = {
.cpu = cpu,
.done = COMPLETION_INITIALIZER(c_idle.done),
.done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
};
DECLARE_WORK(work, do_fork_idle, &c_idle);

lockdep_set_class(&c_idle.done.wait.lock, &waitqueue_lock_key);

/* allocate memory for gdts of secondary cpus. Hotplug is considered */
if (!cpu_gdt_descr[cpu].address &&
!(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) {
Expand Down
5 changes: 4 additions & 1 deletion include/linux/completion.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ struct completion {
#define COMPLETION_INITIALIZER(work) \
{ 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }

#define COMPLETION_INITIALIZER_ONSTACK(work) \
({ init_completion(&work); work; })

#define DECLARE_COMPLETION(work) \
struct completion work = COMPLETION_INITIALIZER(work)

Expand All @@ -28,7 +31,7 @@ struct completion {
*/
#ifdef CONFIG_LOCKDEP
# define DECLARE_COMPLETION_ONSTACK(work) \
struct completion work = ({ init_completion(&work); work; })
struct completion work = COMPLETION_INITIALIZER_ONSTACK(work)
#else
# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)
#endif
Expand Down

0 comments on commit f86bf9b

Please sign in to comment.