diff options
author | Jesper Juhl <juhl-lkml@dif.dk> | 2005-06-23 03:09:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-23 12:45:19 -0400 |
commit | be5b4fbd017d12e0d09ea0528a5839ce2ed2c8c8 (patch) | |
tree | 212a43003d1c4265718f53502547f36acbec143d /kernel | |
parent | dcd497f99a1ef29a7c5e76142965be77e9dacabd (diff) |
[PATCH] preempt_count is int - remove cast and don't assign to unsigned type
In kernel/sched.c the return value from preempt_count() is cast to an int.
That made sense when preempt_count was defined as different types on is not
needed and should go away. The patch removes the cast.
In kernel/timer.c the return value from preempt_count() is assigned to a
variable of type u32 and then that unsigned value is later compared to
preempt_count(). Since preempt_count() returns an int, an int is what
should be used to store its return value. Storing the result in an
unsigned 32bit integer made a tiny bit of sense back when preempt_count was
different types on different archs, but no more - let's not play signed vs
unsigned comparison games when we don't have to. The patch modifies the
code to use an int to hold the value. While I was around that bit of code
I also made two changes to a nearby (related) printk() - I modified it to
specify the loglevel explicitly and also broke the line into a few pieces
to avoid it being longer than 80 chars and clarified the text a bit.
Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 2 | ||||
-rw-r--r-- | kernel/timer.c | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index deca041fc364..6ee4515d5a20 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -2576,7 +2576,7 @@ void fastcall add_preempt_count(int val) | |||
2576 | /* | 2576 | /* |
2577 | * Underflow? | 2577 | * Underflow? |
2578 | */ | 2578 | */ |
2579 | BUG_ON(((int)preempt_count() < 0)); | 2579 | BUG_ON((preempt_count() < 0)); |
2580 | preempt_count() += val; | 2580 | preempt_count() += val; |
2581 | /* | 2581 | /* |
2582 | * Spinlock count overflowing soon? | 2582 | * Spinlock count overflowing soon? |
diff --git a/kernel/timer.c b/kernel/timer.c index 1f986c16d89f..51ff917c9590 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -489,10 +489,14 @@ static inline void __run_timers(tvec_base_t *base) | |||
489 | detach_timer(timer, 1); | 489 | detach_timer(timer, 1); |
490 | spin_unlock_irq(&base->t_base.lock); | 490 | spin_unlock_irq(&base->t_base.lock); |
491 | { | 491 | { |
492 | u32 preempt_count = preempt_count(); | 492 | int preempt_count = preempt_count(); |
493 | fn(data); | 493 | fn(data); |
494 | if (preempt_count != preempt_count()) { | 494 | if (preempt_count != preempt_count()) { |
495 | printk("huh, entered %p with %08x, exited with %08x?\n", fn, preempt_count, preempt_count()); | 495 | printk(KERN_WARNING "huh, entered %p " |
496 | "with preempt_count %08x, exited" | ||
497 | " with %08x?\n", | ||
498 | fn, preempt_count, | ||
499 | preempt_count()); | ||
496 | BUG(); | 500 | BUG(); |
497 | } | 501 | } |
498 | } | 502 | } |