2007-02-04 06:22:15

by Mathieu Desnoyers

[permalink] [raw]
Subject: [PATCH] kernel/time/clocksource.c needs struct task_struct on m68k

kernel/time/clocksource.c needs struct task_struct on m68k.

Because it uses spin_unlock_irq(), which, on m68k, uses hardirq_count(), which
uses preempt_count(), which needs to dereference struct task_struct, we
have to include sched.h. Because it would cause a loop inclusion, we
cannot include sched.h in any other of asm-m68k/system.h,
linux/thread_info.h, linux/hardirq.h, which leaves this ugly include in
a C file as the only simple solution.

Signed-off-by: Mathieu Desnoyers <[email protected]>

--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -28,6 +28,7 @@
#include <linux/sysdev.h>
#include <linux/init.h>
#include <linux/module.h>
+#include <linux/sched.h> /* for spin_unlock_irq() using preempt_count() m68k */

/* XXX - Would like a better way for initializing curr_clocksource */
extern struct clocksource clocksource_jiffies;
--
OpenPGP public key: http://krystal.dyndns.org:8080/key/compudj.gpg
Key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68


2007-02-04 10:18:45

by Tim Schmielau

[permalink] [raw]
Subject: Re: [PATCH] kernel/time/clocksource.c needs struct task_struct on m68k

On Sun, 4 Feb 2007, Mathieu Desnoyers wrote:

> kernel/time/clocksource.c needs struct task_struct on m68k.
>
> Because it uses spin_unlock_irq(), which, on m68k, uses hardirq_count(), which
> uses preempt_count(), which needs to dereference struct task_struct, we
> have to include sched.h. Because it would cause a loop inclusion, we
> cannot include sched.h in any other of asm-m68k/system.h,
> linux/thread_info.h, linux/hardirq.h, which leaves this ugly include in
> a C file as the only simple solution.

This indeed sounds quite ugly. If there really is no other simple way to
resolve this, this case seems to provide the missing incentive to create a
task_struct.h header file.

Unfortunately, I currently cannot foresee when I will have time to do so.

Tim