From 4250cbcc4a5fa9284482c8c1de4eb9af4533f172 Mon Sep 17 00:00:00 2001 From: Nathan Zimmer Date: Wed, 20 Feb 2013 13:13:46 +1100 Subject: [PATCH] timer_list-convert-timer-list-to-be-a-proper-seq_file-v2 v2: Added comments on the iteration. Signed-off-by: Nathan Zimmer Cc: John Stultz Cc: Thomas Gleixner Cc: Dave Jones Signed-off-by: Andrew Morton --- kernel/time/timer_list.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c index c438d759228d..1098ee4d23c8 100644 --- a/kernel/time/timer_list.c +++ b/kernel/time/timer_list.c @@ -274,6 +274,19 @@ static int timer_list_show(struct seq_file *m, void *v) return 0; } +/* + * This itererator really needs some explination since it is offset and has + * two passes one of which is controlled by a config option. + * In a hotplugged system some cpus, including cpu 0, may be missing so we have + * to use cpumask_* to iterate over the cpus. + * For the first pass: + * It returns 1 for the header position. + * For cpu 0 it returns 2 and the final possible cpu would be nr_cpu_ids + 1. + * On the second pass: + * It returnes nr_cpu_ids + 1 for the second header position. + * For cpu 0 it returns nr_cpu_ids + 2 + * The final possible cpu would be nr_cpu_ids + nr_cpu_ids + 2. + */ static void *timer_list_start(struct seq_file *file, loff_t *offset) { unsigned long n = *offset; -- 2.39.5