]> git.baikalelectronics.ru Git - kernel.git/commit
[PATCH] Enforce "unsigned long flags;" when spinlocking
authorAlexey Dobriyan <adobriyan@gmail.com>
Sat, 25 Nov 2006 19:09:36 +0000 (11:09 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Sat, 25 Nov 2006 21:28:34 +0000 (13:28 -0800)
commit0a7b4ee2bf74ceefd7783c20a933eebc1ed38fd0
tree557c5ade9b92e91f095e4017d97ffe7afd83383f
parent1da6cff87f0fe0fe98403144c47205cd6b9dbc68
[PATCH] Enforce "unsigned long flags;" when spinlocking

Make it break or warn if you pass to spin_lock_irqsave() and friends
something different from "unsigned long flags;".  Suprisingly large amount
of these was caught by recent commit
744533ddf23273191df0e6e35e59e1c70d2d70de and others.

Idea is largely from FRV typechecking. Suggestions from Andrew Morton.
All stupid typos in first version fixed.

Passes allmodconfig on i386, x86_64, alpha, arm as well as my usual config.

Note #1: checking with sparse is still needed, because a driver can save
 and pass around flags or something. So far patch is very intrusive.
Note #2: techically, we should break only if
sizeof(flags) < sizeof(unsigned long),
 however, the more pain for getting suspicious code into kernel,
 the better.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/irqflags.h
include/linux/spinlock.h