linux/drivers/pcmcia
Andrea Righi 27ac792ca0 PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures
On 32-bit architectures PAGE_ALIGN() truncates 64-bit values to the 32-bit
boundary. For example:

	u64 val = PAGE_ALIGN(size);

always returns a value < 4GB even if size is greater than 4GB.

The problem resides in PAGE_MASK definition (from include/asm-x86/page.h for
example):

#define PAGE_SHIFT      12
#define PAGE_SIZE       (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK       (~(PAGE_SIZE-1))
...
#define PAGE_ALIGN(addr)       (((addr)+PAGE_SIZE-1)&PAGE_MASK)

The "~" is performed on a 32-bit value, so everything in "and" with
PAGE_MASK greater than 4GB will be truncated to the 32-bit boundary.
Using the ALIGN() macro seems to be the right way, because it uses
typeof(addr) for the mask.

Also move the PAGE_ALIGN() definitions out of include/asm-*/page.h in
include/linux/mm.h.

See also lkml discussion: http://lkml.org/lkml/2008/6/11/237

[akpm@linux-foundation.org: fix drivers/media/video/uvc/uvc_queue.c]
[akpm@linux-foundation.org: fix v850]
[akpm@linux-foundation.org: fix powerpc]
[akpm@linux-foundation.org: fix arm]
[akpm@linux-foundation.org: fix mips]
[akpm@linux-foundation.org: fix drivers/media/video/pvrusb2/pvrusb2-dvb.c]
[akpm@linux-foundation.org: fix drivers/mtd/maps/uclinux.c]
[akpm@linux-foundation.org: fix powerpc]
Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-24 10:47:21 -07:00
..
at91_cf.c pcmcia: fix platform driver hotplug/coldplug 2008-04-15 19:35:40 -07:00
au1000_db1x00.c pcmcia: replace remaining __FUNCTION__ occurrences 2008-05-01 08:04:00 -07:00
au1000_generic.c Alchemy Semi Au1000 pcmcia driver: convert pcmcia_sockets_lock in a mutex 2008-05-01 08:04:00 -07:00
au1000_generic.h pcmcia: remove unused bulkmem.h 2008-06-24 15:33:43 +02:00
au1000_pb1x00.c pcmcia: remove unused bulkmem.h 2008-06-24 15:33:43 +02:00
au1000_xxs1500.c pcmcia: remove unused bulkmem.h 2008-06-24 15:33:43 +02:00
bfin_cf_pcmcia.c pcmcia: add support CompactFlash PCMCIA support for Blackfin. 2008-06-24 15:33:39 +02:00
cardbus.c pcmcia: kill IN_CARD_SERVICES 2008-06-24 15:33:43 +02:00
cirrus.h
cistpl.c pcmcia: fix cisinfo_t removal 2008-07-15 20:53:06 +02:00
cs_internal.h pcmcia: (re)move {pcmcia,pccard}_get_status 2008-06-24 15:33:44 +02:00
cs.c pcmcia: kill IN_CARD_SERVICES 2008-06-24 15:33:43 +02:00
ds_internal.h [PATCH] pcmcia: remove export of pcmcia_release_configuration 2006-03-31 17:15:53 +02:00
ds.c pcmcia: allow for longer CIS firmware files 2008-06-24 15:45:55 +02:00
electra_cf.c PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures 2008-07-24 10:47:21 -07:00
hd64465_ss.c pcmcia: remove unused bulkmem.h 2008-06-24 15:33:43 +02:00
i82092.c pcmcia: remove CVS keywords 2008-06-24 15:33:37 +02:00
i82092aa.h pcmcia: remove CVS keywords 2008-06-24 15:33:37 +02:00
i82365.c pcmcia: i82365.c: check request_irq return value 2008-06-24 15:33:38 +02:00
i82365.h
Kconfig Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2008-07-23 18:24:08 -07:00
m8xx_pcmcia.c Merge commit '85082fd7cbe3173198aac0eb5e85ab1edcc6352c' into test-build 2008-07-15 15:44:51 +10:00
m32r_cfc.c pcmcia: replace kio_addr_t with unsigned int everywhere 2008-02-05 09:44:08 -08:00
m32r_cfc.h
m32r_pcc.c pcmcia: replace kio_addr_t with unsigned int everywhere 2008-02-05 09:44:08 -08:00
m32r_pcc.h
Makefile Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2008-07-23 18:24:08 -07:00
o2micro.h [PATCH] pcmcia: disable read prefetch/write burst on old O2Micro bridges 2005-07-28 08:39:01 -07:00
omap_cf.c ARM: OMAP: Change omap_cf.c and omap_nor.c to use omap_readw/writew instead of __REG 2008-07-03 12:24:41 +03:00
pcmcia_ioctl.c Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6 2008-07-14 14:48:31 -07:00
pcmcia_resource.c pcmcia: (re)move {pcmcia,pccard}_get_status 2008-06-24 15:33:44 +02:00
pd6729.c pcmcia: silence section mismatch warnings from pci_driver variables 2008-05-01 08:04:00 -07:00
pd6729.h
pxa2xx_base.c pcmcia: remove unused bulkmem.h 2008-06-24 15:33:43 +02:00
pxa2xx_base.h [ARM] Fix suspend oops caused by PXA2xx PCMCIA driver 2006-10-28 22:42:56 +01:00
pxa2xx_cm_x270.c [ARM] 5104/1: CM-X270: PCMCIA updates 2008-07-09 21:33:49 +01:00
pxa2xx_lubbock.c pcmcia: replace remaining __FUNCTION__ occurrences 2008-05-01 08:04:00 -07:00
pxa2xx_mainstone.c [ARM] pxa: avoid kfreeing static data if platform device fails to register 2008-06-02 13:49:16 +01:00
pxa2xx_palmtx.c [ARM] 5154/1: PalmTX PCMCIA 2008-07-10 12:15:32 +01:00
pxa2xx_sharpsl.c [ARM] pxa: avoid kfreeing static data if platform device fails to register 2008-06-02 13:49:16 +01:00
ricoh.h
rsrc_mgr.c pcmcia: carve out ioctl adjust function to pcmcia_ioctl 2008-06-24 15:33:42 +02:00
rsrc_nonstatic.c pcmcia: remove unused bulkmem.h 2008-06-24 15:33:43 +02:00
sa11xx_base.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sa11xx_base.h
sa1100_assabet.c pcmcia: replace remaining __FUNCTION__ occurrences 2008-05-01 08:04:00 -07:00
sa1100_badge4.c pcmcia: replace remaining __FUNCTION__ occurrences 2008-05-01 08:04:00 -07:00
sa1100_cerf.c pcmcia: replace remaining __FUNCTION__ occurrences 2008-05-01 08:04:00 -07:00
sa1100_generic.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sa1100_generic.h
sa1100_h3600.c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
sa1100_jornada720.c pcmcia: replace remaining __FUNCTION__ occurrences 2008-05-01 08:04:00 -07:00
sa1100_neponset.c pcmcia: replace remaining __FUNCTION__ occurrences 2008-05-01 08:04:00 -07:00
sa1100_shannon.c pcmcia: replace remaining __FUNCTION__ occurrences 2008-05-01 08:04:00 -07:00
sa1100_simpad.c pcmcia: replace remaining __FUNCTION__ occurrences 2008-05-01 08:04:00 -07:00
sa1111_generic.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sa1111_generic.h
soc_common.c pcmcia: replace remaining __FUNCTION__ occurrences 2008-05-01 08:04:00 -07:00
soc_common.h pcmcia: remove unused bulkmem.h 2008-06-24 15:33:43 +02:00
socket_sysfs.c pcmcia: kill IN_CARD_SERVICES 2008-06-24 15:33:43 +02:00
tcic.c pcmcia: replace kio_addr_t with unsigned int everywhere 2008-02-05 09:44:08 -08:00
tcic.h
ti113x.h pcmcia: Fix ti12xx_2nd_slot_empty always failing 2008-06-24 15:33:41 +02:00
topic.h [PATCH] yenta: make ToPIC95 bridges work with 16bit cards 2005-09-07 16:57:21 -07:00
vg468.h
vrc4171_card.c Driver core: more fallout from class_device changes for pcmcia 2007-02-23 14:52:09 -08:00
vrc4173_cardu.c IRQ: Maintain regs pointer globally rather than passing to IRQ handlers 2006-10-05 15:10:12 +01:00
vrc4173_cardu.h Update Yoichi Yuasa's email address. 2006-01-10 13:39:07 +00:00
yenta_socket.c pcmcia: fix kernel-doc comments 2007-12-10 19:43:54 -08:00
yenta_socket.h [PATCH] yenta: make ToPIC95 bridges work with 16bit cards 2005-09-07 16:57:21 -07:00