Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sched: add kernel doc for the completion, fix kernel-doc-nano-HOWTO.txt

This patch adds kernel doc for the completion feature.

An error in the split-man.pl PERL snippet in kernel-doc-nano-HOWTO.txt is
also fixed.

Signed-off-by: Kevin Diggs <kevdig@hypersurf.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by

Kevin Diggs and committed by
Ingo Molnar
65eb3dc6 3cf430b0

+99 -2
+2 -2
Documentation/kernel-doc-nano-HOWTO.txt
··· 168 168 mkdir $ARGV[0],0777; 169 169 $state = 0; 170 170 while (<STDIN>) { 171 - if (/^\.TH \"[^\"]*\" 4 \"([^\"]*)\"/) { 171 + if (/^\.TH \"[^\"]*\" 9 \"([^\"]*)\"/) { 172 172 if ($state == 1) { close OUT } 173 173 $state = 1; 174 - $fn = "$ARGV[0]/$1.4"; 174 + $fn = "$ARGV[0]/$1.9"; 175 175 print STDERR "Creating $fn\n"; 176 176 open OUT, ">$fn" or die "can't open $fn: $!\n"; 177 177 print OUT $_;
+41
include/linux/completion.h
··· 10 10 11 11 #include <linux/wait.h> 12 12 13 + /** 14 + * struct completion - structure used to maintain state for a "completion" 15 + * 16 + * This is the opaque structure used to maintain the state for a "completion". 17 + * Completions currently use a FIFO to queue threads that have to wait for 18 + * the "completion" event. 19 + * 20 + * See also: complete(), wait_for_completion() (and friends _timeout, 21 + * _interruptible, _interruptible_timeout, and _killable), init_completion(), 22 + * and macros DECLARE_COMPLETION(), DECLARE_COMPLETION_ONSTACK(), and 23 + * INIT_COMPLETION(). 24 + */ 13 25 struct completion { 14 26 unsigned int done; 15 27 wait_queue_head_t wait; ··· 33 21 #define COMPLETION_INITIALIZER_ONSTACK(work) \ 34 22 ({ init_completion(&work); work; }) 35 23 24 + /** 25 + * DECLARE_COMPLETION: - declare and initialize a completion structure 26 + * @work: identifier for the completion structure 27 + * 28 + * This macro declares and initializes a completion structure. Generally used 29 + * for static declarations. You should use the _ONSTACK variant for automatic 30 + * variables. 31 + */ 36 32 #define DECLARE_COMPLETION(work) \ 37 33 struct completion work = COMPLETION_INITIALIZER(work) 38 34 ··· 49 29 * completions - so we use the _ONSTACK() variant for those that 50 30 * are on the kernel stack: 51 31 */ 32 + /** 33 + * DECLARE_COMPLETION_ONSTACK: - declare and initialize a completion structure 34 + * @work: identifier for the completion structure 35 + * 36 + * This macro declares and initializes a completion structure on the kernel 37 + * stack. 38 + */ 52 39 #ifdef CONFIG_LOCKDEP 53 40 # define DECLARE_COMPLETION_ONSTACK(work) \ 54 41 struct completion work = COMPLETION_INITIALIZER_ONSTACK(work) ··· 63 36 # define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) 64 37 #endif 65 38 39 + /** 40 + * init_completion: - Initialize a dynamically allocated completion 41 + * @x: completion structure that is to be initialized 42 + * 43 + * This inline function will initialize a dynamically created completion 44 + * structure. 45 + */ 66 46 static inline void init_completion(struct completion *x) 67 47 { 68 48 x->done = 0; ··· 89 55 extern void complete(struct completion *); 90 56 extern void complete_all(struct completion *); 91 57 58 + /** 59 + * INIT_COMPLETION: - reinitialize a completion structure 60 + * @x: completion structure to be reinitialized 61 + * 62 + * This macro should be used to reinitialize a completion structure so it can 63 + * be reused. This is especially important after complete_all() is used. 64 + */ 92 65 #define INIT_COMPLETION(x) ((x).done = 0) 93 66 94 67
+56
kernel/sched.c
··· 4565 4565 } 4566 4566 EXPORT_SYMBOL_GPL(__wake_up_sync); /* For internal use only */ 4567 4567 4568 + /** 4569 + * complete: - signals a single thread waiting on this completion 4570 + * @x: holds the state of this particular completion 4571 + * 4572 + * This will wake up a single thread waiting on this completion. Threads will be 4573 + * awakened in the same order in which they were queued. 4574 + * 4575 + * See also complete_all(), wait_for_completion() and related routines. 4576 + */ 4568 4577 void complete(struct completion *x) 4569 4578 { 4570 4579 unsigned long flags; ··· 4585 4576 } 4586 4577 EXPORT_SYMBOL(complete); 4587 4578 4579 + /** 4580 + * complete_all: - signals all threads waiting on this completion 4581 + * @x: holds the state of this particular completion 4582 + * 4583 + * This will wake up all threads waiting on this particular completion event. 4584 + */ 4588 4585 void complete_all(struct completion *x) 4589 4586 { 4590 4587 unsigned long flags; ··· 4639 4624 return timeout; 4640 4625 } 4641 4626 4627 + /** 4628 + * wait_for_completion: - waits for completion of a task 4629 + * @x: holds the state of this particular completion 4630 + * 4631 + * This waits to be signaled for completion of a specific task. It is NOT 4632 + * interruptible and there is no timeout. 4633 + * 4634 + * See also similar routines (i.e. wait_for_completion_timeout()) with timeout 4635 + * and interrupt capability. Also see complete(). 4636 + */ 4642 4637 void __sched wait_for_completion(struct completion *x) 4643 4638 { 4644 4639 wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_UNINTERRUPTIBLE); 4645 4640 } 4646 4641 EXPORT_SYMBOL(wait_for_completion); 4647 4642 4643 + /** 4644 + * wait_for_completion_timeout: - waits for completion of a task (w/timeout) 4645 + * @x: holds the state of this particular completion 4646 + * @timeout: timeout value in jiffies 4647 + * 4648 + * This waits for either a completion of a specific task to be signaled or for a 4649 + * specified timeout to expire. The timeout is in jiffies. It is not 4650 + * interruptible. 4651 + */ 4648 4652 unsigned long __sched 4649 4653 wait_for_completion_timeout(struct completion *x, unsigned long timeout) 4650 4654 { ··· 4671 4637 } 4672 4638 EXPORT_SYMBOL(wait_for_completion_timeout); 4673 4639 4640 + /** 4641 + * wait_for_completion_interruptible: - waits for completion of a task (w/intr) 4642 + * @x: holds the state of this particular completion 4643 + * 4644 + * This waits for completion of a specific task to be signaled. It is 4645 + * interruptible. 4646 + */ 4674 4647 int __sched wait_for_completion_interruptible(struct completion *x) 4675 4648 { 4676 4649 long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_INTERRUPTIBLE); ··· 4687 4646 } 4688 4647 EXPORT_SYMBOL(wait_for_completion_interruptible); 4689 4648 4649 + /** 4650 + * wait_for_completion_interruptible_timeout: - waits for completion (w/(to,intr)) 4651 + * @x: holds the state of this particular completion 4652 + * @timeout: timeout value in jiffies 4653 + * 4654 + * This waits for either a completion of a specific task to be signaled or for a 4655 + * specified timeout to expire. It is interruptible. The timeout is in jiffies. 4656 + */ 4690 4657 unsigned long __sched 4691 4658 wait_for_completion_interruptible_timeout(struct completion *x, 4692 4659 unsigned long timeout) ··· 4703 4654 } 4704 4655 EXPORT_SYMBOL(wait_for_completion_interruptible_timeout); 4705 4656 4657 + /** 4658 + * wait_for_completion_killable: - waits for completion of a task (killable) 4659 + * @x: holds the state of this particular completion 4660 + * 4661 + * This waits to be signaled for completion of a specific task. It can be 4662 + * interrupted by a kill signal. 4663 + */ 4706 4664 int __sched wait_for_completion_killable(struct completion *x) 4707 4665 { 4708 4666 long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_KILLABLE);