Cesar Eduardo Barros
597781f3e5
kmap_atomic: make kunmap_atomic() harder to misuse
...
kunmap_atomic() is currently at level -4 on Rusty's "Hard To Misuse"
list[1] ("Follow common convention and you'll get it wrong"), except in
some architectures when CONFIG_DEBUG_HIGHMEM is set[2][3].
kunmap() takes a pointer to a struct page; kunmap_atomic(), however, takes
takes a pointer to within the page itself. This seems to once in a while
trip people up (the convention they are following is the one from
kunmap()).
Make it much harder to misuse, by moving it to level 9 on Rusty's list[4]
("The compiler/linker won't let you get it wrong"). This is done by
refusing to build if the type of its first argument is a pointer to a
struct page.
The real kunmap_atomic() is renamed to kunmap_atomic_notypecheck()
(which is what you would call in case for some strange reason calling it
with a pointer to a struct page is not incorrect in your code).
The previous version of this patch was compile tested on x86-64.
[1] http://ozlabs.org/~rusty/index.cgi/tech/2008-04-01.html
[2] In these cases, it is at level 5, "Do it right or it will always
break at runtime."
[3] At least mips and powerpc look very similar, and sparc also seems to
share a common ancestor with both; there seems to be quite some
degree of copy-and-paste coding here. The include/asm/highmem.h file
for these three archs mention x86 CPUs at its top.
[4] http://ozlabs.org/~rusty/index.cgi/tech/2008-03-30.html
[5] As an aside, could someone tell me why mn10300 uses unsigned long as
the first parameter of kunmap_atomic() instead of void *?
Signed-off-by: Cesar Eduardo Barros <[email protected] >
Cc: Russell King <[email protected] > (arch/arm)
Cc: Ralf Baechle <[email protected] > (arch/mips)
Cc: David Howells <[email protected] > (arch/frv, arch/mn10300)
Cc: Koichi Yasutake <[email protected] > (arch/mn10300)
Cc: Kyle McMartin <[email protected] > (arch/parisc)
Cc: Helge Deller <[email protected] > (arch/parisc)
Cc: "James E.J. Bottomley" <[email protected] > (arch/parisc)
Cc: Benjamin Herrenschmidt <[email protected] > (arch/powerpc)
Cc: Paul Mackerras <[email protected] > (arch/powerpc)
Cc: "David S. Miller" <[email protected] > (arch/sparc)
Cc: Thomas Gleixner <[email protected] > (arch/x86)
Cc: Ingo Molnar <[email protected] > (arch/x86)
Cc: "H. Peter Anvin" <[email protected] > (arch/x86)
Cc: Arnd Bergmann <[email protected] > (include/asm-generic)
Cc: Rusty Russell <[email protected] > ("Hard To Misuse" list)
Signed-off-by: Andrew Morton <[email protected] >
Signed-off-by: Linus Torvalds <[email protected] >
2010-08-09 20:44:54 -07:00
..
boot
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
2010-08-03 14:31:24 -07:00
common
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
2010-08-03 14:31:24 -07:00
configs
Remove ARM default configurations which duplicate omap3_defconfig
2010-08-04 15:47:29 +03:00
include /asm
kmap_atomic: make kunmap_atomic() harder to misuse
2010-08-09 20:44:54 -07:00
kernel
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
2010-08-06 09:30:52 -07:00
lib
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
2010-08-03 14:31:24 -07:00
mach-aaec2000
ARM: Remove DISCONTIGMEM support
2010-07-16 10:57:35 +01:00
mach-at91
ARM: 6209/3: at91_udc: Add vbus polarity and polling mode
2010-07-18 20:39:10 +01:00
mach-bcmring
ARM: AMBA: Add pclk definition for platforms using primecells
2010-07-22 09:55:38 +01:00
mach-clps711x
Merge branches 'at91', 'ep93xx', 'kexec', 'iop', 'lmb', 'nomadik', 'nuc', 'pl', 'spear' and 'versatile' into devel
2010-07-31 14:19:35 +01:00
mach-cns3xxx
ARM: cns3xxx: Add support for AHCI controllers
2010-06-08 17:37:09 +04:00
mach-davinci
Merge branch 'davinci-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci
2010-08-08 10:00:55 -07:00
mach-dove
[ARM] Dove: platform device registration for the sdio interfaces
2010-07-16 22:01:59 -04:00
mach-ebsa110
mach-ep93xx
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
2010-08-07 17:07:31 -07:00
mach-footbridge
ARM: 6233/1: Delete a wrong redundant right parenthesis
2010-07-22 09:20:50 +01:00
mach-gemini
mach-h720x
ARM: 6258/1: arm/h720x: fix debug macro compilation failure
2010-07-26 10:33:05 +01:00
mach-imx
Merge branch 'master' into for-next
2010-08-04 15:14:38 +02:00
mach-integrator
Merge branch 'misc' into devel
2010-07-31 14:20:02 +01:00
mach-iop13xx
Merge branch 'misc' into devel
2010-07-31 14:20:02 +01:00
mach-iop32x
mach-iop33x
mach-ixp4xx
Merge branch 'misc' into devel
2010-07-31 14:20:02 +01:00
mach-ixp23xx
ARM: 6269/1: Add 'code' parameter for hook_fault_code()
2010-07-27 10:48:34 +01:00
mach-ixp2000
ARM: 6269/1: Add 'code' parameter for hook_fault_code()
2010-07-27 10:48:34 +01:00
mach-kirkwood
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
2010-08-07 17:07:31 -07:00
mach-ks8695
ARM: 6269/1: Add 'code' parameter for hook_fault_code()
2010-07-27 10:48:34 +01:00
mach-lh7a40x
ARM: Remove DISCONTIGMEM support
2010-07-16 10:57:35 +01:00
mach-loki
mach-lpc32xx
ARM: LPC32XX: Arch config menu supoport and makefiles
2010-07-27 08:46:22 -07:00
mach-mmp
mach-msm
Merge branch 'master' into for-next
2010-08-04 15:14:38 +02:00
mach-mv78xx0
mach-mx3
Merge branch 'for-rmk' of git://git.pengutronix.de/git/imx/linux-2.6 into devel-stable
2010-07-29 15:48:37 +01:00
mach-mx5
i.MX51: add support for cpuimx51 module and its baseboard
2010-07-26 15:05:37 +02:00
mach-mx25
imx: move gpio init after to irq init
2010-07-26 15:05:35 +02:00
mach-mxc91231
ARM: mxc91231: remove paragraphs with old address of the FSF
2010-06-30 09:00:27 +02:00
mach-netx
mach-nomadik
ARM: AMBA: Add pclk definition for platforms using primecells
2010-07-22 09:55:38 +01:00
mach-ns9xxx
ARM: 6263/1: ns9xxx: fix FTBFS for zImage
2010-07-26 10:33:07 +01:00
mach-nuc93x
mach-omap1
Merge branch 'v2.6.35-omap-mailbox-for-next' of git://gitorious.org/~doyu/lk/mainline into omap-for-linus
2010-08-04 16:10:38 +03:00
mach-omap2
Merge branch 'for-linus' of git://gitorious.org/linux-omap-dss2/linux
2010-08-08 10:02:59 -07:00
mach-orion5x
[ARM] Orion: DNS-323 C1 requires phylib
2010-07-16 22:02:48 -04:00
mach-pnx4008
mach-pxa
Merge branches 'at91', 'ep93xx', 'kexec', 'iop', 'lmb', 'nomadik', 'nuc', 'pl', 'spear' and 'versatile' into devel
2010-07-31 14:19:35 +01:00
mach-realview
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
2010-08-03 14:31:24 -07:00
mach-rpc
mach-s3c24a0/include /mach
mach-s3c64xx
ARM: S3C64XX: Add USB OTG HCLK to the list of clocks
2010-05-28 19:31:34 +09:00
mach-s3c2400
mach-s3c2410
ARM: Convert platform reservations to use LMB rather than bootmem
2010-07-27 08:48:23 +01:00
mach-s3c2412
ARM: Remove DISCONTIGMEM support
2010-07-16 10:57:35 +01:00
mach-s3c2416
mach-s3c2440
ARM: Convert platform reservations to use LMB rather than bootmem
2010-07-27 08:48:23 +01:00
mach-s3c2443
mach-s5p6440
ARM: S5P: Fix the platform external interrupt issues.
2010-05-26 19:09:50 +09:00
mach-s5p6442
ARM: S5P6442: Fix PLL setting announce message.
2010-07-05 16:01:04 +09:00
mach-s5pc100
ARM: S5PC100: Fixup cross tree merge problems
2010-05-26 19:09:50 +09:00
mach-s5pv210
ARM: S5PV210: Correct clock register properties
2010-07-05 16:01:04 +09:00
mach-sa1100
Merge branch 'master' into for-next
2010-08-04 15:14:38 +02:00
mach-shark
Merge branches 'at91', 'ep93xx', 'kexec', 'iop', 'lmb', 'nomadik', 'nuc', 'pl', 'spear' and 'versatile' into devel
2010-07-31 14:19:35 +01:00
mach-shmobile
ARM: 6277/1: mach-shmobile: Allow users to select HZ, default to 128
2010-07-29 22:32:28 +01:00
mach-spear3xx
ARM: AMBA: Add pclk definition for platforms using primecells
2010-07-22 09:55:38 +01:00
mach-spear6xx
ARM: AMBA: Add pclk definition for platforms using primecells
2010-07-22 09:55:38 +01:00
mach-stmp37xx
mach-stmp378x
mach-tegra
[ARM] tegra: harmony: Add harmony board file
2010-08-05 14:57:02 -07:00
mach-u300
Merge branch 'master' into for-next
2010-08-04 15:14:38 +02:00
mach-ux500
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
2010-08-03 14:31:24 -07:00
mach-versatile
Merge branches 'at91', 'ep93xx', 'kexec', 'iop', 'lmb', 'nomadik', 'nuc', 'pl', 'spear' and 'versatile' into devel
2010-07-31 14:19:35 +01:00
mach-vexpress
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
2010-08-03 14:31:24 -07:00
mach-w90x900
Merge branches 'at91', 'ep93xx', 'kexec', 'iop', 'lmb', 'nomadik', 'nuc', 'pl', 'spear' and 'versatile' into devel
2010-07-31 14:19:35 +01:00
mm
kmap_atomic: make kunmap_atomic() harder to misuse
2010-08-09 20:44:54 -07:00
nwfpe
ARM: arch/arm/nwfpe/fpsr.h: Checkpatch cleanup
2010-05-24 20:40:12 +01:00
oprofile
plat-iop
Merge branch 'misc' into devel
2010-07-31 14:20:02 +01:00
plat-mxc
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
2010-08-07 17:07:31 -07:00
plat-nomadik
ARM: 6153/1: nomadik MTU to use dynamic shift and mult assignment
2010-06-16 22:29:31 +01:00
plat-omap
Merge branch 'for-linus' of git://gitorious.org/linux-omap-dss2/linux
2010-08-08 10:02:59 -07:00
plat-orion
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
2010-08-07 17:07:31 -07:00
plat-pxa
[ARM] mmp: fix build failure due to IRQ_PMU depends on ARCH_PXA
2010-06-14 00:45:26 +08:00
plat-s3c24xx
Merge branch 'master' into for-next
2010-06-16 18:08:13 +02:00
plat-s5p
ARM: S5P: Bug fix on external interrupt for S5P SoCs
2010-07-05 16:01:04 +09:00
plat-samsung
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
2010-08-04 15:31:02 -07:00
plat-spear
Merge branch 'master' into for-next
2010-08-04 15:14:38 +02:00
plat-stmp3xxx
plat-versatile
ARM: 6264/1: fix Versatile Express LED oversight
2010-07-26 10:48:34 +01:00
tools
ARM: Update mach-types
2010-07-12 21:14:53 +01:00
vfp
ARM: 6203/1: Make VFPv3 usable on ARMv6
2010-07-09 14:41:34 +01:00
Kconfig
Merge branch 'for-linus' of git://android.kernel.org/kernel/tegra
2010-08-08 10:05:57 -07:00
Kconfig-nommu
Kconfig.debug
Makefile
[ARM] tegra: initial tegra support
2010-08-05 14:51:42 -07:00