lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1450741676-5865-61-git-send-email-viro@ZenIV.linux.org.uk>
Date:	Mon, 21 Dec 2015 23:47:34 +0000
From:	Al Viro <viro@...IV.linux.org.uk>
To:	linux-kernel@...r.kernel.org
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [POC][PATCH 61/83] switch obvious cases to get_free_page()

From: Al Viro <viro@...iv.linux.org.uk>

Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
 arch/alpha/include/asm/pgalloc.h                  |  4 ++--
 arch/alpha/kernel/srm_env.c                       |  4 ++--
 arch/alpha/mm/init.c                              |  2 +-
 arch/arc/kernel/setup.c                           |  2 +-
 arch/arc/kernel/troubleshoot.c                    |  4 ++--
 arch/arm/include/asm/pgalloc.h                    |  2 +-
 arch/arm/kvm/arm.c                                |  2 +-
 arch/arm/kvm/mmu.c                                |  4 ++--
 arch/arm64/include/asm/pgalloc.h                  |  6 +++---
 arch/arm64/mm/mmu.c                               |  2 +-
 arch/arm64/mm/pgd.c                               |  2 +-
 arch/blackfin/kernel/dma-mapping.c                |  2 +-
 arch/cris/include/asm/pgalloc.h                   |  2 +-
 arch/frv/mm/pgalloc.c                             |  2 +-
 arch/hexagon/include/asm/pgalloc.h                |  4 ++--
 arch/m32r/include/asm/pgalloc.h                   |  4 ++--
 arch/m68k/include/asm/mcf_pgalloc.h               |  2 +-
 arch/m68k/include/asm/motorola_pgalloc.h          |  2 +-
 arch/metag/include/asm/pgalloc.h                  |  2 +-
 arch/microblaze/mm/pgtable.c                      |  2 +-
 arch/mn10300/mm/pgtable.c                         |  2 +-
 arch/openrisc/include/asm/pgalloc.h               |  2 +-
 arch/openrisc/mm/ioremap.c                        |  2 +-
 arch/parisc/include/asm/pgalloc.h                 |  2 +-
 arch/powerpc/include/asm/pgalloc-64.h             |  2 +-
 arch/powerpc/kvm/e500.c                           |  2 +-
 arch/powerpc/kvm/e500mc.c                         |  2 +-
 arch/powerpc/mm/hugetlbpage.c                     |  2 +-
 arch/powerpc/mm/pgtable_32.c                      |  2 +-
 arch/powerpc/platforms/pseries/cmm.c              |  6 ++----
 arch/powerpc/platforms/pseries/iommu.c            |  4 ++--
 arch/s390/crypto/aes_s390.c                       |  2 +-
 arch/s390/crypto/des_s390.c                       |  2 +-
 arch/s390/crypto/prng.c                           |  2 +-
 arch/s390/kernel/kprobes.c                        |  2 +-
 arch/s390/kernel/topology.c                       |  2 +-
 arch/s390/mm/cmm.c                                |  5 ++---
 arch/s390/mm/maccess.c                            |  4 ++--
 arch/s390/mm/pgtable.c                            |  3 +--
 arch/tile/mm/elf.c                                |  2 +-
 arch/um/kernel/mem.c                              |  6 +++---
 arch/unicore32/include/asm/pgalloc.h              |  2 +-
 arch/x86/kvm/mmu.c                                |  2 +-
 arch/x86/kvm/vmx.c                                | 21 +++++++++------------
 arch/x86/mm/pgtable.c                             |  8 ++++----
 arch/x86/pci/pcbios.c                             |  2 +-
 arch/x86/um/ldt.c                                 |  3 +--
 arch/x86/xen/mmu.c                                |  2 +-
 arch/x86/xen/p2m.c                                |  2 +-
 arch/xtensa/include/asm/pgalloc.h                 |  2 +-
 block/partitions/check.c                          |  2 +-
 crypto/blkcipher.c                                |  2 +-
 crypto/tcrypt.c                                   |  4 ++--
 crypto/testmgr.c                                  |  2 +-
 drivers/acpi/nvs.c                                |  2 +-
 drivers/block/cciss.c                             |  2 +-
 drivers/block/drbd/drbd_main.c                    |  4 ++--
 drivers/char/agp/amd-k7-agp.c                     |  2 +-
 drivers/char/agp/ati-agp.c                        |  2 +-
 drivers/char/agp/sworks-agp.c                     |  2 +-
 drivers/char/mem.c                                |  4 ++--
 drivers/char/tpm/xen-tpmfront.c                   |  2 +-
 drivers/char/xilinx_hwicap/xilinx_hwicap.c        |  2 +-
 drivers/firewire/ohci.c                           |  2 +-
 drivers/gpu/drm/via/via_dmablit.c                 |  3 +--
 drivers/ide/ide-proc.c                            |  2 +-
 drivers/infiniband/core/umem.c                    |  4 ++--
 drivers/infiniband/core/umem_odp.c                |  2 +-
 drivers/infiniband/hw/cxgb3/iwch_provider.c       |  2 +-
 drivers/infiniband/hw/cxgb4/device.c              |  3 +--
 drivers/infiniband/hw/cxgb4/mem.c                 |  2 +-
 drivers/infiniband/hw/mlx4/mr.c                   |  2 +-
 drivers/infiniband/hw/mlx5/odp.c                  |  2 +-
 drivers/infiniband/hw/mthca/mthca_provider.c      |  2 +-
 drivers/infiniband/hw/usnic/usnic_uiom.c          |  2 +-
 drivers/input/misc/xen-kbdfront.c                 |  2 +-
 drivers/macintosh/rack-meter.c                    |  2 +-
 drivers/media/pci/pt1/pt1.c                       |  2 +-
 drivers/media/pci/ttpci/av7110_ca.c               |  2 +-
 drivers/misc/cxl/pci.c                            |  2 +-
 drivers/misc/ibmasm/ibmasmfs.c                    |  2 +-
 drivers/misc/lkdtm.c                              |  6 +++---
 drivers/mmc/host/tmio_mmc_dma.c                   |  2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c   |  2 +-
 drivers/net/ethernet/sfc/mcdi.c                   |  2 +-
 drivers/net/ethernet/toshiba/ps3_gelic_wireless.c | 12 ++++++------
 drivers/net/usb/kaweth.c                          |  2 +-
 drivers/pci/xen-pcifront.c                        |  3 +--
 drivers/platform/x86/dell-laptop.c                |  2 +-
 drivers/s390/block/dasd_eckd.c                    |  2 +-
 drivers/s390/block/xpram.c                        |  4 ++--
 drivers/s390/char/sclp_cmd.c                      |  2 +-
 drivers/s390/char/vmur.c                          |  4 ++--
 drivers/s390/char/zcore.c                         |  2 +-
 drivers/s390/cio/qdio_setup.c                     |  4 ++--
 drivers/s390/cio/scm.c                            |  2 +-
 drivers/s390/net/qeth_core_main.c                 |  2 +-
 drivers/scsi/cxlflash/main.c                      |  2 +-
 drivers/scsi/ipr.c                                |  2 +-
 drivers/scsi/scsi_devinfo.c                       |  2 +-
 drivers/scsi/scsi_proc.c                          |  4 ++--
 drivers/scsi/xen-scsifront.c                      |  2 +-
 drivers/spi/spi-sh-msiof.c                        |  4 ++--
 drivers/staging/lustre/lustre/llite/llite_lib.c   |  2 +-
 drivers/staging/unisys/visorbus/visorchannel.c    |  2 +-
 drivers/target/target_core_file.c                 |  2 +-
 drivers/tty/hvc/hvc_xen.c                         |  2 +-
 drivers/tty/hvc/hvcs.c                            |  2 +-
 drivers/tty/mxser.c                               |  2 +-
 drivers/tty/rocket.c                              |  2 +-
 drivers/tty/serial/68328serial.c                  |  2 +-
 drivers/tty/serial/men_z135_uart.c                |  2 +-
 drivers/tty/serial/pch_uart.c                     |  2 +-
 drivers/tty/vt/vc_screen.c                        |  4 ++--
 drivers/usb/atm/cxacru.c                          |  6 +++---
 drivers/usb/atm/speedtch.c                        |  2 +-
 drivers/usb/core/devio.c                          |  2 +-
 drivers/usb/misc/rio500.c                         |  4 ++--
 drivers/usb/serial/usb_wwan.c                     |  2 +-
 drivers/uwb/hwa-rc.c                              |  2 +-
 drivers/video/fbdev/xen-fbfront.c                 |  2 +-
 drivers/xen/events/events_base.c                  |  2 +-
 drivers/xen/events/events_fifo.c                  |  4 ++--
 drivers/xen/evtchn.c                              |  2 +-
 drivers/xen/grant-table.c                         |  4 ++--
 fs/binfmt_misc.c                                  |  2 +-
 fs/fuse/dir.c                                     |  2 +-
 fs/fuse/file.c                                    |  2 +-
 fs/isofs/dir.c                                    |  2 +-
 fs/jfs/jfs_dtree.c                                |  2 +-
 fs/namespace.c                                    |  2 +-
 fs/nfs/namespace.c                                |  2 +-
 fs/nfs/nfs4namespace.c                            |  8 ++++----
 fs/nfs/super.c                                    |  2 +-
 fs/nfsd/vfs.c                                     |  2 +-
 fs/ocfs2/dlm/dlmdomain.c                          |  2 +-
 fs/ocfs2/dlm/dlmmaster.c                          |  2 +-
 fs/ocfs2/dlm/dlmrecovery.c                        |  2 +-
 fs/overlayfs/copy_up.c                            |  2 +-
 fs/proc/base.c                                    | 10 +++++-----
 fs/select.c                                       |  2 +-
 include/linux/quicklist.h                         |  2 +-
 kernel/groups.c                                   |  2 +-
 kernel/power/swap.c                               | 13 ++++++-------
 kernel/sysctl.c                                   |  6 +++---
 kernel/trace/trace_events.c                       |  4 ++--
 kernel/trace/trace_events_filter.c                |  2 +-
 kernel/trace/trace_events_trigger.c               |  2 +-
 kernel/user_namespace.c                           |  2 +-
 lib/scatterlist.c                                 |  2 +-
 mm/memory.c                                       |  4 ++--
 mm/migrate.c                                      |  2 +-
 mm/mincore.c                                      |  2 +-
 net/atm/mpoa_proc.c                               |  2 +-
 security/selinux/hooks.c                          |  2 +-
 security/selinux/selinuxfs.c                      |  2 +-
 sound/oss/msnd_pinnacle.c                         |  4 ++--
 157 files changed, 221 insertions(+), 233 deletions(-)

diff --git a/arch/alpha/include/asm/pgalloc.h b/arch/alpha/include/asm/pgalloc.h
index 078da57..001da1d 100644
--- a/arch/alpha/include/asm/pgalloc.h
+++ b/arch/alpha/include/asm/pgalloc.h
@@ -40,7 +40,7 @@ pgd_free(struct mm_struct *mm, pgd_t *pgd)
 static inline pmd_t *
 pmd_alloc_one(struct mm_struct *mm, unsigned long address)
 {
-	pmd_t *ret = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
+	pmd_t *ret = get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
 	return ret;
 }
 
@@ -53,7 +53,7 @@ pmd_free(struct mm_struct *mm, pmd_t *pmd)
 static inline pte_t *
 pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
-	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
+	pte_t *pte = get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
 	return pte;
 }
 
diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c
index a66f23b..14f8597 100644
--- a/arch/alpha/kernel/srm_env.c
+++ b/arch/alpha/kernel/srm_env.c
@@ -82,7 +82,7 @@ static int srm_env_proc_show(struct seq_file *m, void *v)
 	unsigned long	id = (unsigned long)m->private;
 	char		*page;
 
-	page = (char *)__get_free_page(GFP_USER);
+	page = get_free_page(GFP_USER);
 	if (!page)
 		return -ENOMEM;
 
@@ -107,7 +107,7 @@ static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer,
 {
 	int res;
 	unsigned long	id = (unsigned long)PDE_DATA(file_inode(file));
-	char		*buf = (char *) __get_free_page(GFP_USER);
+	char		*buf = get_free_page(GFP_USER);
 	unsigned long	ret1, ret2;
 
 	if (!buf)
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index a1bea91..6a604df 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -42,7 +42,7 @@ pgd_alloc(struct mm_struct *mm)
 {
 	pgd_t *ret, *init;
 
-	ret = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
+	ret = get_free_page(GFP_KERNEL | __GFP_ZERO);
 	init = pgd_offset(&init_mm, 0UL);
 	if (ret) {
 #ifdef CONFIG_ALPHA_LARGE_VMALLOC
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 56fd4fc..39cae4a 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -473,7 +473,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 		goto done;
 	}
 
-	str = (char *)__get_free_page(GFP_TEMPORARY);
+	str = get_free_page(GFP_TEMPORARY);
 	if (!str)
 		goto done;
 
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index eb3464d..f09d68d 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -175,7 +175,7 @@ void show_regs(struct pt_regs *regs)
 	struct callee_regs *cregs;
 	char *buf;
 
-	buf = (char *)__get_free_page(GFP_TEMPORARY);
+	buf = get_free_page(GFP_TEMPORARY);
 	if (!buf)
 		return;
 
@@ -272,7 +272,7 @@ static int fill_display_data(char *kbuf)
 
 static int tlb_stats_open(struct inode *inode, struct file *file)
 {
-	file->private_data = (void *)__get_free_page(GFP_KERNEL);
+	file->private_data = get_free_page(GFP_KERNEL);
 	return 0;
 }
 
diff --git a/arch/arm/include/asm/pgalloc.h b/arch/arm/include/asm/pgalloc.h
index 540647d..aafdebc 100644
--- a/arch/arm/include/asm/pgalloc.h
+++ b/arch/arm/include/asm/pgalloc.h
@@ -85,7 +85,7 @@ pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
 {
 	pte_t *pte;
 
-	pte = (pte_t *)__get_free_page(PGALLOC_GFP);
+	pte = get_free_page(PGALLOC_GFP);
 	if (pte)
 		clean_pte_table(pte);
 
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index 385bdce..56b066f 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -1046,7 +1046,7 @@ static int init_hyp_mode(void)
 	 * Allocate stack pages for Hypervisor-mode
 	 */
 	for_each_possible_cpu(cpu) {
-		void *stack_page = (void *)__get_free_page(GFP_KERNEL);
+		void *stack_page = get_free_page(GFP_KERNEL);
 		if (!stack_page) {
 			err = -ENOMEM;
 			goto out_free_stack_pages;
diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 429b673..34c2de6 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -131,7 +131,7 @@ static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache,
 	if (cache->nobjs >= min)
 		return 0;
 	while (cache->nobjs < max) {
-		page = (void *)__get_free_page(PGALLOC_GFP);
+		page = get_free_page(PGALLOC_GFP);
 		if (!page)
 			return -ENOMEM;
 		cache->objects[cache->nobjs++] = page;
@@ -1679,7 +1679,7 @@ int kvm_mmu_init(void)
 	}
 
 	if (__kvm_cpu_uses_extended_idmap()) {
-		merged_hyp_pgd = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
+		merged_hyp_pgd = get_free_page(GFP_KERNEL | __GFP_ZERO);
 		if (!merged_hyp_pgd) {
 			kvm_err("Failed to allocate extra HYP pgd\n");
 			goto out;
diff --git a/arch/arm64/include/asm/pgalloc.h b/arch/arm64/include/asm/pgalloc.h
index ce9b3c0..5bfbe35 100644
--- a/arch/arm64/include/asm/pgalloc.h
+++ b/arch/arm64/include/asm/pgalloc.h
@@ -33,7 +33,7 @@
 
 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
 {
-	return (pmd_t *)__get_free_page(PGALLOC_GFP);
+	return get_free_page(PGALLOC_GFP);
 }
 
 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
@@ -53,7 +53,7 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
 
 static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
 {
-	return (pud_t *)__get_free_page(PGALLOC_GFP);
+	return get_free_page(PGALLOC_GFP);
 }
 
 static inline void pud_free(struct mm_struct *mm, pud_t *pud)
@@ -75,7 +75,7 @@ extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
 static inline pte_t *
 pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
 {
-	return (pte_t *)__get_free_page(PGALLOC_GFP);
+	return get_free_page(PGALLOC_GFP);
 }
 
 static inline pgtable_t
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 873e363..753b6cb 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -267,7 +267,7 @@ static void *late_alloc(unsigned long size)
 	void *ptr;
 
 	BUG_ON(size > PAGE_SIZE);
-	ptr = (void *)__get_free_page(PGALLOC_GFP);
+	ptr = get_free_page(PGALLOC_GFP);
 	BUG_ON(!ptr);
 	return ptr;
 }
diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c
index a468648..d5574e5 100644
--- a/arch/arm64/mm/pgd.c
+++ b/arch/arm64/mm/pgd.c
@@ -33,7 +33,7 @@ static struct kmem_cache *pgd_cache;
 pgd_t *pgd_alloc(struct mm_struct *mm)
 {
 	if (PGD_SIZE == PAGE_SIZE)
-		return (pgd_t *)__get_free_page(PGALLOC_GFP);
+		return get_free_page(PGALLOC_GFP);
 	else
 		return kmem_cache_alloc(pgd_cache, PGALLOC_GFP);
 }
diff --git a/arch/blackfin/kernel/dma-mapping.c b/arch/blackfin/kernel/dma-mapping.c
index df437e5..aa71d9b 100644
--- a/arch/blackfin/kernel/dma-mapping.c
+++ b/arch/blackfin/kernel/dma-mapping.c
@@ -27,7 +27,7 @@ static void dma_alloc_init(unsigned long start, unsigned long end)
 	spin_lock_init(&dma_page_lock);
 	dma_initialized = 0;
 
-	dma_page = (unsigned long *)__get_free_page(GFP_KERNEL);
+	dma_page = get_free_page(GFP_KERNEL);
 	memset(dma_page, 0, PAGE_SIZE);
 	dma_base = PAGE_ALIGN(start);
 	dma_size = PAGE_ALIGN(end) - PAGE_ALIGN(start);
diff --git a/arch/cris/include/asm/pgalloc.h b/arch/cris/include/asm/pgalloc.h
index cac8206..65e3f32 100644
--- a/arch/cris/include/asm/pgalloc.h
+++ b/arch/cris/include/asm/pgalloc.h
@@ -24,7 +24,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 
 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
-  	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
+  	pte_t *pte = get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
  	return pte;
 }
 
diff --git a/arch/frv/mm/pgalloc.c b/arch/frv/mm/pgalloc.c
index 41907d2..16addf2 100644
--- a/arch/frv/mm/pgalloc.c
+++ b/arch/frv/mm/pgalloc.c
@@ -22,7 +22,7 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((aligned(PAGE_SIZE)));
 
 pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
-	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
+	pte_t *pte = get_free_page(GFP_KERNEL|__GFP_REPEAT);
 	if (pte)
 		clear_page(pte);
 	return pte;
diff --git a/arch/hexagon/include/asm/pgalloc.h b/arch/hexagon/include/asm/pgalloc.h
index 48c04dc..ca48fcf 100644
--- a/arch/hexagon/include/asm/pgalloc.h
+++ b/arch/hexagon/include/asm/pgalloc.h
@@ -35,7 +35,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
 {
 	pgd_t *pgd;
 
-	pgd = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
+	pgd = get_free_page(GFP_KERNEL | __GFP_ZERO);
 
 	/*
 	 * There may be better ways to do this, but to ensure
@@ -79,7 +79,7 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
 					  unsigned long address)
 {
 	gfp_t flags =  GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO;
-	return (pte_t *) __get_free_page(flags);
+	return get_free_page(flags);
 }
 
 static inline void pte_free(struct mm_struct *mm, struct page *pte)
diff --git a/arch/m32r/include/asm/pgalloc.h b/arch/m32r/include/asm/pgalloc.h
index 3923429..80d1b26 100644
--- a/arch/m32r/include/asm/pgalloc.h
+++ b/arch/m32r/include/asm/pgalloc.h
@@ -20,7 +20,7 @@ static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
  */
 static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm)
 {
-	pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
+	pgd_t *pgd = get_free_page(GFP_KERNEL|__GFP_ZERO);
 
 	return pgd;
 }
@@ -33,7 +33,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 static __inline__ pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
 	unsigned long address)
 {
-	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
+	pte_t *pte = get_free_page(GFP_KERNEL|__GFP_ZERO);
 
 	return pte;
 }
diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h
index 2e70a56..04ffc22 100644
--- a/arch/m68k/include/asm/mcf_pgalloc.h
+++ b/arch/m68k/include/asm/mcf_pgalloc.h
@@ -93,7 +93,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
 {
 	pgd_t *new_pgd;
 
-	new_pgd = (pgd_t *)__get_free_page(GFP_DMA | __GFP_NOWARN);
+	new_pgd = get_free_page(GFP_DMA | __GFP_NOWARN);
 	if (!new_pgd)
 		return NULL;
 	memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE);
diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h
index 6e84224..60df054 100644
--- a/arch/m68k/include/asm/motorola_pgalloc.h
+++ b/arch/m68k/include/asm/motorola_pgalloc.h
@@ -11,7 +11,7 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long ad
 {
 	pte_t *pte;
 
-	pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
+	pte = get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
 	if (pte) {
 		__flush_page_to_ram(pte);
 		flush_tlb_kernel_page(pte);
diff --git a/arch/metag/include/asm/pgalloc.h b/arch/metag/include/asm/pgalloc.h
index cf9e2fb..ae19628 100644
--- a/arch/metag/include/asm/pgalloc.h
+++ b/arch/metag/include/asm/pgalloc.h
@@ -42,7 +42,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
 					  unsigned long address)
 {
-	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT |
+	pte_t *pte = get_free_page(GFP_KERNEL | __GFP_REPEAT |
 					      __GFP_ZERO);
 	return pte;
 }
diff --git a/arch/microblaze/mm/pgtable.c b/arch/microblaze/mm/pgtable.c
index 4f4520e..76e117d 100644
--- a/arch/microblaze/mm/pgtable.c
+++ b/arch/microblaze/mm/pgtable.c
@@ -239,7 +239,7 @@ __init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
 {
 	pte_t *pte;
 	if (mem_init_done) {
-		pte = (pte_t *)__get_free_page(GFP_KERNEL |
+		pte = get_free_page(GFP_KERNEL |
 					__GFP_REPEAT | __GFP_ZERO);
 	} else {
 		pte = (pte_t *)early_get_page();
diff --git a/arch/mn10300/mm/pgtable.c b/arch/mn10300/mm/pgtable.c
index e77a7c7..391992b 100644
--- a/arch/mn10300/mm/pgtable.c
+++ b/arch/mn10300/mm/pgtable.c
@@ -63,7 +63,7 @@ void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags)
 
 pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
-	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
+	pte_t *pte = get_free_page(GFP_KERNEL|__GFP_REPEAT);
 	if (pte)
 		clear_page(pte);
 	return pte;
diff --git a/arch/openrisc/include/asm/pgalloc.h b/arch/openrisc/include/asm/pgalloc.h
index 1f61391..642186f 100644
--- a/arch/openrisc/include/asm/pgalloc.h
+++ b/arch/openrisc/include/asm/pgalloc.h
@@ -43,7 +43,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
  */
 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
 {
-	pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL);
+	pgd_t *ret = get_free_page(GFP_KERNEL);
 
 	if (ret) {
 		memset(ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
diff --git a/arch/openrisc/mm/ioremap.c b/arch/openrisc/mm/ioremap.c
index 62b08ef..801533f 100644
--- a/arch/openrisc/mm/ioremap.c
+++ b/arch/openrisc/mm/ioremap.c
@@ -122,7 +122,7 @@ pte_t __init_refok *pte_alloc_one_kernel(struct mm_struct *mm,
 	pte_t *pte;
 
 	if (likely(mem_init_done)) {
-		pte = (pte_t *) __get_free_page(GFP_KERNEL | __GFP_REPEAT);
+		pte = get_free_page(GFP_KERNEL | __GFP_REPEAT);
 	} else {
 		pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
 #if 0
diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h
index 5c10934..94e5b41 100644
--- a/arch/parisc/include/asm/pgalloc.h
+++ b/arch/parisc/include/asm/pgalloc.h
@@ -135,7 +135,7 @@ pte_alloc_one(struct mm_struct *mm, unsigned long address)
 static inline pte_t *
 pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
 {
-	pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
+	pte_t *pte = get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
 	return pte;
 }
 
diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
index c26021b..e61b0d2 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -79,7 +79,7 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
 					  unsigned long address)
 {
-	return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
+	return get_free_page(GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO);
 }
 
 static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c
index 29803fb..a525971 100644
--- a/arch/powerpc/kvm/e500.c
+++ b/arch/powerpc/kvm/e500.c
@@ -462,7 +462,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_e500(struct kvm *kvm,
 	if (err)
 		goto uninit_id;
 
-	vcpu->arch.shared = (void*)__get_free_page(GFP_KERNEL|__GFP_ZERO);
+	vcpu->arch.shared = get_free_page(GFP_KERNEL|__GFP_ZERO);
 	if (!vcpu->arch.shared)
 		goto uninit_tlb;
 
diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c
index e002a71..450eab9 100644
--- a/arch/powerpc/kvm/e500mc.c
+++ b/arch/powerpc/kvm/e500mc.c
@@ -330,7 +330,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_e500mc(struct kvm *kvm,
 	if (err)
 		goto uninit_vcpu;
 
-	vcpu->arch.shared = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
+	vcpu->arch.shared = get_free_page(GFP_KERNEL | __GFP_ZERO);
 	if (!vcpu->arch.shared)
 		goto uninit_tlb;
 
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index a466b84..a94f92b6 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -497,7 +497,7 @@ static void hugepd_free(struct mmu_gather *tlb, void *hugepte)
 	}
 
 	if (*batchp == NULL) {
-		*batchp = (struct hugepd_freelist *)__get_free_page(GFP_ATOMIC);
+		*batchp = get_free_page(GFP_ATOMIC);
 		(*batchp)->index = 0;
 	}
 
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index 6e6c311..542f425 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -109,7 +109,7 @@ __init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long add
 	pte_t *pte;
 
 	if (slab_is_available()) {
-		pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
+		pte = get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
 	} else {
 		pte = __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
 		if (pte)
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index db1dbe6..f4aa67d 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -145,8 +145,7 @@ static long cmm_alloc_pages(long nr)
 		if (!pa || pa->index >= CMM_NR_PAGES) {
 			/* Need a new page for the page list. */
 			spin_unlock(&cmm_lock);
-			npa = (struct cmm_page_array *)__get_free_page(
-					GFP_NOIO | __GFP_NOWARN |
+			npa = get_free_page(GFP_NOIO | __GFP_NOWARN |
 					__GFP_NORETRY | __GFP_NOMEMALLOC);
 			if (!npa) {
 				pr_info("%s: Can not allocate new page list\n", __func__);
@@ -566,8 +565,7 @@ static int cmm_mem_going_offline(void *arg)
 	while (pa_curr) {
 		if (((unsigned long)pa_curr >= start_page) &&
 				((unsigned long)pa_curr < end_page)) {
-			npa = (struct cmm_page_array *)__get_free_page(
-					GFP_NOIO | __GFP_NOWARN |
+			npa = get_free_page(GFP_NOIO | __GFP_NOWARN |
 					__GFP_NORETRY | __GFP_NOMEMALLOC);
 			if (!npa) {
 				spin_unlock(&cmm_lock);
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index bd98ce2..f471734 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -275,7 +275,7 @@ static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
 	 * from iommu_alloc{,_sg}()
 	 */
 	if (!tcep) {
-		tcep = (__be64 *)__get_free_page(GFP_ATOMIC);
+		tcep = get_free_page(GFP_ATOMIC);
 		/* If allocation fails, fall back to the loop implementation */
 		if (!tcep) {
 			local_irq_restore(flags);
@@ -474,7 +474,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn,
 	tcep = __this_cpu_read(tce_page);
 
 	if (!tcep) {
-		tcep = (__be64 *)__get_free_page(GFP_ATOMIC);
+		tcep = get_free_page(GFP_ATOMIC);
 		if (!tcep) {
 			local_irq_enable();
 			return -ENOMEM;
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index 4b610d6..15edffb 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -936,7 +936,7 @@ static int __init aes_s390_init(void)
 				CRYPT_S390_MSA | CRYPT_S390_MSA4) &&
 	    crypt_s390_func_available(KMCTR_AES_256_ENCRYPT,
 				CRYPT_S390_MSA | CRYPT_S390_MSA4)) {
-		ctrblk = (u8 *) __get_free_page(GFP_KERNEL);
+		ctrblk = get_free_page(GFP_KERNEL);
 		if (!ctrblk) {
 			ret = -ENOMEM;
 			goto ctr_aes_err;
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
index 9f402dc..6f7288b 100644
--- a/arch/s390/crypto/des_s390.c
+++ b/arch/s390/crypto/des_s390.c
@@ -573,7 +573,7 @@ static int __init des_s390_init(void)
 		ret = crypto_register_alg(&ctr_des3_alg);
 		if (ret)
 			goto ctr_des3_err;
-		ctrblk = (u8 *) __get_free_page(GFP_KERNEL);
+		ctrblk = get_free_page(GFP_KERNEL);
 		if (!ctrblk) {
 			ret = -ENOMEM;
 			goto ctr_mem_err;
diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c
index d3835d2..2971c2c 100644
--- a/arch/s390/crypto/prng.c
+++ b/arch/s390/crypto/prng.c
@@ -116,7 +116,7 @@ static int generate_entropy(u8 *ebuf, size_t nbytes)
 	int n, ret = 0;
 	u8 *pg, *h, hash[32];
 
-	pg = (u8 *) __get_free_page(GFP_KERNEL);
+	pg = get_free_page(GFP_KERNEL);
 	if (!pg) {
 		prng_errorflag = PRNG_GEN_ENTROPY_FAILED;
 		return -ENOMEM;
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 2021dc0..8e2c032 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -43,7 +43,7 @@ DEFINE_INSN_CACHE_OPS(dmainsn);
 
 static void *alloc_dmainsn_page(void)
 {
-	return (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
+	return get_free_page(GFP_KERNEL | GFP_DMA);
 }
 
 static void free_dmainsn_page(void *page)
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 40b8102..b7994b5 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -481,7 +481,7 @@ static int __init s390_topology_init(void)
 
 	if (!MACHINE_HAS_TOPOLOGY)
 		return 0;
-	tl_info = (struct sysinfo_15_1_x *)__get_free_page(GFP_KERNEL);
+	tl_info = get_free_page(GFP_KERNEL);
 	info = tl_info;
 	store_topology(info);
 	pr_info("The CPU configuration topology of the machine is:");
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index e5879ba..4236961 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -67,7 +67,7 @@ static long cmm_alloc_pages(long nr, long *counter,
 	void *addr;
 
 	while (nr) {
-		addr = (void *)__get_free_page(GFP_NOIO);
+		addr = get_free_page(GFP_NOIO);
 		if (!addr)
 			break;
 		spin_lock(&cmm_lock);
@@ -75,8 +75,7 @@ static long cmm_alloc_pages(long nr, long *counter,
 		if (!pa || pa->index >= CMM_NR_PAGES) {
 			/* Need a new page for the page list. */
 			spin_unlock(&cmm_lock);
-			npa = (struct cmm_page_array *)
-				__get_free_page(GFP_NOIO);
+			npa = get_free_page(GFP_NOIO);
 			if (!npa) {
 				free_page(addr);
 				break;
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index e20811c..93241b9 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -137,7 +137,7 @@ int copy_to_user_real(void __user *dest, void *src, unsigned long count)
 	int offs = 0, size, rc;
 	char *buf;
 
-	buf = (char *) __get_free_page(GFP_KERNEL);
+	buf = get_free_page(GFP_KERNEL);
 	if (!buf)
 		return -ENOMEM;
 	rc = -EFAULT;
@@ -189,7 +189,7 @@ void *xlate_dev_mem_ptr(phys_addr_t addr)
 	preempt_disable();
 	if (is_swapped(addr)) {
 		size = PAGE_SIZE - (addr & ~PAGE_MASK);
-		bounce = (void *) __get_free_page(GFP_ATOMIC);
+		bounce = get_free_page(GFP_ATOMIC);
 		if (bounce)
 			memcpy_absolute(bounce, (void *) addr, size);
 	}
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index df429c6..5078169 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -1113,8 +1113,7 @@ void tlb_remove_table(struct mmu_gather *tlb, void *table)
 
 	tlb->mm->context.flush_mm = 1;
 	if (*batch == NULL) {
-		*batch = (struct mmu_table_batch *)
-			__get_free_page(GFP_NOWAIT | __GFP_NOWARN);
+		*batch = get_free_page(GFP_NOWAIT | __GFP_NOWARN);
 		if (*batch == NULL) {
 			__tlb_flush_mm_lazy(tlb->mm);
 			tlb_remove_table_one(table);
diff --git a/arch/tile/mm/elf.c b/arch/tile/mm/elf.c
index cbc81ab..a8a58cd 100644
--- a/arch/tile/mm/elf.c
+++ b/arch/tile/mm/elf.c
@@ -48,7 +48,7 @@ static int notify_exec(struct mm_struct *mm)
 	if (!sim_is_simulator())
 		return 1;
 
-	buf = (char *) __get_free_page(GFP_KERNEL);
+	buf = get_free_page(GFP_KERNEL);
 	if (buf == NULL)
 		return 0;
 
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 8936388..5bbd2eb 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -184,7 +184,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 
 pgd_t *pgd_alloc(struct mm_struct *mm)
 {
-	pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL);
+	pgd_t *pgd = get_free_page(GFP_KERNEL);
 
 	if (pgd) {
 		memset(pgd, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
@@ -204,7 +204,7 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
 	pte_t *pte;
 
-	pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
+	pte = get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
 	return pte;
 }
 
@@ -225,7 +225,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
 #ifdef CONFIG_3_LEVEL_PGTABLES
 pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
 {
-	pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL);
+	pmd_t *pmd = get_free_page(GFP_KERNEL);
 
 	if (pmd)
 		memset(pmd, 0, PAGE_SIZE);
diff --git a/arch/unicore32/include/asm/pgalloc.h b/arch/unicore32/include/asm/pgalloc.h
index 3287878..3b03876 100644
--- a/arch/unicore32/include/asm/pgalloc.h
+++ b/arch/unicore32/include/asm/pgalloc.h
@@ -38,7 +38,7 @@ pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
 {
 	pte_t *pte;
 
-	pte = (pte_t *)__get_free_page(PGALLOC_GFP);
+	pte = get_free_page(PGALLOC_GFP);
 	if (pte)
 		clean_dcache_area(pte, PTRS_PER_PTE * sizeof(pte_t));
 
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index fb86efb..c3f7453 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -692,7 +692,7 @@ static int mmu_topup_memory_cache_page(struct kvm_mmu_memory_cache *cache,
 	if (cache->nobjs >= min)
 		return 0;
 	while (cache->nobjs < ARRAY_SIZE(cache->objects)) {
-		page = (void *)__get_free_page(GFP_KERNEL);
+		page = get_free_page(GFP_KERNEL);
 		if (!page)
 			return -ENOMEM;
 		cache->objects[cache->nobjs++] = page;
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 7206fee..fe36bf2 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -6088,44 +6088,41 @@ static __init int hardware_setup(void)
 	for (i = 0; i < ARRAY_SIZE(vmx_msr_index); ++i)
 		kvm_define_shared_msr(i, vmx_msr_index[i]);
 
-	vmx_io_bitmap_a = (unsigned long *)__get_free_page(GFP_KERNEL);
+	vmx_io_bitmap_a = get_free_page(GFP_KERNEL);
 	if (!vmx_io_bitmap_a)
 		return r;
 
-	vmx_io_bitmap_b = (unsigned long *)__get_free_page(GFP_KERNEL);
+	vmx_io_bitmap_b = get_free_page(GFP_KERNEL);
 	if (!vmx_io_bitmap_b)
 		goto out;
 
-	vmx_msr_bitmap_legacy = (unsigned long *)__get_free_page(GFP_KERNEL);
+	vmx_msr_bitmap_legacy = get_free_page(GFP_KERNEL);
 	if (!vmx_msr_bitmap_legacy)
 		goto out1;
 
-	vmx_msr_bitmap_legacy_x2apic =
-				(unsigned long *)__get_free_page(GFP_KERNEL);
+	vmx_msr_bitmap_legacy_x2apic = get_free_page(GFP_KERNEL);
 	if (!vmx_msr_bitmap_legacy_x2apic)
 		goto out2;
 
-	vmx_msr_bitmap_longmode = (unsigned long *)__get_free_page(GFP_KERNEL);
+	vmx_msr_bitmap_longmode = get_free_page(GFP_KERNEL);
 	if (!vmx_msr_bitmap_longmode)
 		goto out3;
 
-	vmx_msr_bitmap_longmode_x2apic =
-				(unsigned long *)__get_free_page(GFP_KERNEL);
+	vmx_msr_bitmap_longmode_x2apic = get_free_page(GFP_KERNEL);
 	if (!vmx_msr_bitmap_longmode_x2apic)
 		goto out4;
 
 	if (nested) {
-		vmx_msr_bitmap_nested =
-			(unsigned long *)__get_free_page(GFP_KERNEL);
+		vmx_msr_bitmap_nested = get_free_page(GFP_KERNEL);
 		if (!vmx_msr_bitmap_nested)
 			goto out5;
 	}
 
-	vmx_vmread_bitmap = (unsigned long *)__get_free_page(GFP_KERNEL);
+	vmx_vmread_bitmap = get_free_page(GFP_KERNEL);
 	if (!vmx_vmread_bitmap)
 		goto out6;
 
-	vmx_vmwrite_bitmap = (unsigned long *)__get_free_page(GFP_KERNEL);
+	vmx_vmwrite_bitmap = get_free_page(GFP_KERNEL);
 	if (!vmx_vmwrite_bitmap)
 		goto out7;
 
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index 8e51a6c..d9781f0 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -18,7 +18,7 @@ gfp_t __userpte_alloc_gfp = PGALLOC_GFP | PGALLOC_USER_GFP;
 
 pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
-	return (pte_t *)__get_free_page(PGALLOC_GFP);
+	return get_free_page(PGALLOC_GFP);
 }
 
 pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
@@ -209,7 +209,7 @@ static int preallocate_pmds(struct mm_struct *mm, pmd_t *pmds[])
 	bool failed = false;
 
 	for(i = 0; i < PREALLOCATED_PMDS; i++) {
-		pmd_t *pmd = (pmd_t *)__get_free_page(PGALLOC_GFP);
+		pmd_t *pmd = get_free_page(PGALLOC_GFP);
 		if (!pmd)
 			failed = true;
 		if (pmd && !pgtable_pmd_page_ctor(virt_to_page(pmd))) {
@@ -323,7 +323,7 @@ static inline pgd_t *_pgd_alloc(void)
 	 * We allocate one page for pgd.
 	 */
 	if (!SHARED_KERNEL_PMD)
-		return (pgd_t *)__get_free_page(PGALLOC_GFP);
+		return get_free_page(PGALLOC_GFP);
 
 	/*
 	 * Now PAE kernel is not running as a Xen domain. We can allocate
@@ -342,7 +342,7 @@ static inline void _pgd_free(pgd_t *pgd)
 #else
 static inline pgd_t *_pgd_alloc(void)
 {
-	return (pgd_t *)__get_free_page(PGALLOC_GFP);
+	return get_free_page(PGALLOC_GFP);
 }
 
 static inline void _pgd_free(pgd_t *pgd)
diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
index 674ecff..f5a9458 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -385,7 +385,7 @@ struct irq_routing_table * pcibios_get_irq_routing_table(void)
 
 	if (!pci_bios_present)
 		return NULL;
-	page = (void *)__get_free_page(GFP_KERNEL);
+	page = get_free_page(GFP_KERNEL);
 	if (!page)
 		return NULL;
 	opt.table = page;
diff --git a/arch/x86/um/ldt.c b/arch/x86/um/ldt.c
index 5264f55..60b4314 100644
--- a/arch/x86/um/ldt.c
+++ b/arch/x86/um/ldt.c
@@ -157,8 +157,7 @@ static int write_ldt(void __user * ptr, unsigned long bytecount, int func)
 			if (i == 0)
 				memcpy(&entry0, ldt->u.entries,
 				       sizeof(entry0));
-			ldt->u.pages[i] = (struct ldt_entry *)
-				__get_free_page(GFP_KERNEL|__GFP_ZERO);
+			ldt->u.pages[i] = get_free_page(GFP_KERNEL|__GFP_ZERO);
 			if (!ldt->u.pages[i]) {
 				err = -ENOMEM;
 				/* Undo the change in host */
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index bb7b2e5..d06a96d 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1523,7 +1523,7 @@ static int xen_pgd_alloc(struct mm_struct *mm)
 
 		ret = -ENOMEM;
 
-		user_pgd = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
+		user_pgd = get_free_page(GFP_KERNEL | __GFP_ZERO);
 		page->private = (unsigned long)user_pgd;
 
 		if (user_pgd != NULL) {
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index b72eab3..b2505a6 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -182,7 +182,7 @@ static void * __ref alloc_p2m_page(void)
 	if (unlikely(!slab_is_available()))
 		return alloc_bootmem_align(PAGE_SIZE, PAGE_SIZE);
 
-	return (void *)__get_free_page(GFP_KERNEL | __GFP_REPEAT);
+	return get_free_page(GFP_KERNEL | __GFP_REPEAT);
 }
 
 static void __ref free_p2m_page(void *p)
diff --git a/arch/xtensa/include/asm/pgalloc.h b/arch/xtensa/include/asm/pgalloc.h
index 2a7631f..65657a6 100644
--- a/arch/xtensa/include/asm/pgalloc.h
+++ b/arch/xtensa/include/asm/pgalloc.h
@@ -44,7 +44,7 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
 	pte_t *ptep;
 	int i;
 
-	ptep = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
+	ptep = get_free_page(GFP_KERNEL|__GFP_REPEAT);
 	if (!ptep)
 		return NULL;
 	for (i = 0; i < 1024; i++)
diff --git a/block/partitions/check.c b/block/partitions/check.c
index dc43d02b..6e69263 100644
--- a/block/partitions/check.c
+++ b/block/partitions/check.c
@@ -147,7 +147,7 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
 	state = allocate_partitions(hd);
 	if (!state)
 		return NULL;
-	state->pp_buf = (char *)__get_free_page(GFP_KERNEL);
+	state->pp_buf = get_free_page(GFP_KERNEL);
 	if (!state->pp_buf) {
 		free_partitions(state);
 		return NULL;
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c
index d46ebfa..97274e7 100644
--- a/crypto/blkcipher.c
+++ b/crypto/blkcipher.c
@@ -240,7 +240,7 @@ static int blkcipher_walk_next(struct blkcipher_desc *desc,
 	    !scatterwalk_aligned(&walk->out, walk->alignmask)) {
 		walk->flags |= BLKCIPHER_WALK_COPY;
 		if (!walk->page) {
-			walk->page = (void *)__get_free_page(GFP_ATOMIC);
+			walk->page = get_free_page(GFP_ATOMIC);
 			if (!walk->page)
 				n = 0;
 		}
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 5cc0a85..df693aa 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -255,7 +255,7 @@ static int testmgr_alloc_buf(char *buf[XBUFSIZE])
 	int i;
 
 	for (i = 0; i < XBUFSIZE; i++) {
-		buf[i] = (void *)__get_free_page(GFP_KERNEL);
+		buf[i] = get_free_page(GFP_KERNEL);
 		if (!buf[i])
 			goto err_free_buf;
 	}
@@ -2204,7 +2204,7 @@ static int __init tcrypt_mod_init(void)
 	int i;
 
 	for (i = 0; i < TVMEMSIZE; i++) {
-		tvmem[i] = (void *)__get_free_page(GFP_KERNEL);
+		tvmem[i] = get_free_page(GFP_KERNEL);
 		if (!tvmem[i])
 			goto err_free_tv;
 	}
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index dc8d8f7..47dd4b8 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -166,7 +166,7 @@ static int testmgr_alloc_buf(char *buf[XBUFSIZE])
 	int i;
 
 	for (i = 0; i < XBUFSIZE; i++) {
-		buf[i] = (void *)__get_free_page(GFP_KERNEL);
+		buf[i] = get_free_page(GFP_KERNEL);
 		if (!buf[i])
 			goto err_free_buf;
 	}
diff --git a/drivers/acpi/nvs.c b/drivers/acpi/nvs.c
index 36bf798..c07363c 100644
--- a/drivers/acpi/nvs.c
+++ b/drivers/acpi/nvs.c
@@ -155,7 +155,7 @@ int suspend_nvs_alloc(void)
 	struct nvs_page *entry;
 
 	list_for_each_entry(entry, &nvs_list, node) {
-		entry->data = (void *)__get_free_page(GFP_KERNEL);
+		entry->data = get_free_page(GFP_KERNEL);
 		if (!entry->data) {
 			suspend_nvs_free();
 			return -ENOMEM;
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index a055899..9e0889f 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -514,7 +514,7 @@ cciss_proc_write(struct file *file, const char __user *buf,
 	if (!buf || length > PAGE_SIZE - 1)
 		return -EINVAL;
 
-	buffer = (char *)__get_free_page(GFP_KERNEL);
+	buffer = get_free_page(GFP_KERNEL);
 	if (!buffer)
 		return -ENOMEM;
 
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index c5f9c21..06ca3ef 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2487,10 +2487,10 @@ found:
 
 static int drbd_alloc_socket(struct drbd_socket *socket)
 {
-	socket->rbuf = (void *) __get_free_page(GFP_KERNEL);
+	socket->rbuf = get_free_page(GFP_KERNEL);
 	if (!socket->rbuf)
 		return -ENOMEM;
-	socket->sbuf = (void *) __get_free_page(GFP_KERNEL);
+	socket->sbuf = get_free_page(GFP_KERNEL);
 	if (!socket->sbuf)
 		return -ENOMEM;
 	return 0;
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 3835c1b..505be8d 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -37,7 +37,7 @@ static int amd_create_page_map(struct amd_page_map *page_map)
 {
 	int i;
 
-	page_map->real = (unsigned long *) __get_free_page(GFP_KERNEL);
+	page_map->real = get_free_page(GFP_KERNEL);
 	if (page_map->real == NULL)
 		return -ENOMEM;
 
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 95651e2..758e7c6 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -56,7 +56,7 @@ static int ati_create_page_map(struct ati_page_map *page_map)
 {
 	int i, err = 0;
 
-	page_map->real = (unsigned long *) __get_free_page(GFP_KERNEL);
+	page_map->real = get_free_page(GFP_KERNEL);
 	if (page_map->real == NULL)
 		return -ENOMEM;
 
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
index 96d2e55..b590985 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -48,7 +48,7 @@ static int serverworks_create_page_map(struct serverworks_page_map *page_map)
 {
 	int i;
 
-	page_map->real = (unsigned long *) __get_free_page(GFP_KERNEL);
+	page_map->real = get_free_page(GFP_KERNEL);
 	if (page_map->real == NULL) {
 		return -ENOMEM;
 	}
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 63f7056..2a6ce6b 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -424,7 +424,7 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
 	}
 
 	if (count > 0) {
-		kbuf = (char *)__get_free_page(GFP_KERNEL);
+		kbuf = get_free_page(GFP_KERNEL);
 		if (!kbuf)
 			return -ENOMEM;
 		while (count > 0) {
@@ -524,7 +524,7 @@ static ssize_t write_kmem(struct file *file, const char __user *buf,
 	}
 
 	if (count > 0) {
-		kbuf = (char *)__get_free_page(GFP_KERNEL);
+		kbuf = get_free_page(GFP_KERNEL);
 		if (!kbuf)
 			return wrote ? wrote : -ENOMEM;
 		while (count > 0) {
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
index 2ccd0c9..abd4162 100644
--- a/drivers/char/tpm/xen-tpmfront.c
+++ b/drivers/char/tpm/xen-tpmfront.c
@@ -195,7 +195,7 @@ static int setup_ring(struct xenbus_device *dev, struct tpm_private *priv)
 	int rv;
 	grant_ref_t gref;
 
-	priv->shr = (void *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
+	priv->shr = get_free_page(GFP_KERNEL|__GFP_ZERO);
 	if (!priv->shr) {
 		xenbus_dev_fatal(dev, -ENOMEM, "allocating shared ring");
 		return -ENOMEM;
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 7b09193..7175120a 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -456,7 +456,7 @@ hwicap_write(struct file *file, const char __user *buf,
 		goto error;
 	}
 
-	kbuf = (u32 *) __get_free_page(GFP_KERNEL);
+	kbuf = get_free_page(GFP_KERNEL);
 	if (!kbuf) {
 		status = -ENOMEM;
 		goto error;
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
index f7303dd..bf433b7 100644
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -2999,7 +2999,7 @@ static struct fw_iso_context *ohci_allocate_iso_context(struct fw_card *card,
 
 	memset(ctx, 0, sizeof(*ctx));
 	ctx->header_length = 0;
-	ctx->header = (void *) __get_free_page(GFP_KERNEL);
+	ctx->header = get_free_page(GFP_KERNEL);
 	if (ctx->header == NULL) {
 		ret = -ENOMEM;
 		goto out;
diff --git a/drivers/gpu/drm/via/via_dmablit.c b/drivers/gpu/drm/via/via_dmablit.c
index 869282d..5fa7c6d 100644
--- a/drivers/gpu/drm/via/via_dmablit.c
+++ b/drivers/gpu/drm/via/via_dmablit.c
@@ -277,8 +277,7 @@ via_alloc_desc_pages(drm_via_sg_info_t *vsg)
 
 	vsg->state = dr_via_desc_pages_alloc;
 	for (i = 0; i < vsg->num_desc_pages; ++i) {
-		if (NULL == (vsg->desc_pages[i] =
-			     (drm_via_descriptor_t *) __get_free_page(GFP_KERNEL)))
+		if (NULL == (vsg->desc_pages[i] = get_free_page(GFP_KERNEL)))
 			return -ENOMEM;
 	}
 	DRM_DEBUG("Allocated %d pages for %d descriptors.\n", vsg->num_desc_pages,
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index 0002937..cbb2ba2 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -349,7 +349,7 @@ static ssize_t ide_settings_proc_write(struct file *file, const char __user *buf
 	if (count >= PAGE_SIZE)
 		return -EINVAL;
 
-	s = buf = (char *)__get_free_page(GFP_USER);
+	s = buf = get_free_page(GFP_USER);
 	if (!buf)
 		return -ENOMEM;
 
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index a81e139..61b9417 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -147,7 +147,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 	/* We assume the memory is from hugetlb until proved otherwise */
 	umem->hugetlb   = 1;
 
-	page_list = (struct page **) __get_free_page(GFP_KERNEL);
+	page_list = get_free_page(GFP_KERNEL);
 	if (!page_list) {
 		kfree(umem);
 		return ERR_PTR(-ENOMEM);
@@ -157,7 +157,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 	 * if we can't alloc the vma_list, it's not so bad;
 	 * just assume the memory is not hugetlb memory
 	 */
-	vma_list = (struct vm_area_struct **) __get_free_page(GFP_KERNEL);
+	vma_list = get_free_page(GFP_KERNEL);
 	if (!vma_list)
 		umem->hugetlb = 0;
 
diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c
index 8b14a3f..c0f950ad 100644
--- a/drivers/infiniband/core/umem_odp.c
+++ b/drivers/infiniband/core/umem_odp.c
@@ -535,7 +535,7 @@ int ib_umem_odp_map_dma_pages(struct ib_umem *umem, u64 user_virt, u64 bcnt,
 	    user_virt + bcnt > ib_umem_end(umem))
 		return -EFAULT;
 
-	local_page_list = (struct page **)__get_free_page(GFP_KERNEL);
+	local_page_list = get_free_page(GFP_KERNEL);
 	if (!local_page_list)
 		return -ENOMEM;
 
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index a80b709..db0b414 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -660,7 +660,7 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 	if (err)
 		goto err;
 
-	pages = (__be64 *) __get_free_page(GFP_KERNEL);
+	pages = get_free_page(GFP_KERNEL);
 	if (!pages) {
 		err = -ENOMEM;
 		goto err_pbl;
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index 870ac06..f519bc1 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -848,8 +848,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
 		printk(KERN_ERR MOD "error %d initializing ocqp pool\n", err);
 		goto err4;
 	}
-	rdev->status_page = (struct t4_dev_status_page *)
-			    __get_free_page(GFP_KERNEL);
+	rdev->status_page = get_free_page(GFP_KERNEL);
 	if (!rdev->status_page) {
 		pr_err(MOD "error allocating status page\n");
 		goto err4;
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
index 9720caa..eb6d82d 100644
--- a/drivers/infiniband/hw/cxgb4/mem.c
+++ b/drivers/infiniband/hw/cxgb4/mem.c
@@ -743,7 +743,7 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 	if (err)
 		goto err;
 
-	pages = (__be64 *) __get_free_page(GFP_KERNEL);
+	pages = get_free_page(GFP_KERNEL);
 	if (!pages) {
 		err = -ENOMEM;
 		goto err_pbl;
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c
index 227c99bb..c942b00 100644
--- a/drivers/infiniband/hw/mlx4/mr.c
+++ b/drivers/infiniband/hw/mlx4/mr.c
@@ -96,7 +96,7 @@ int mlx4_ib_umem_write_mtt(struct mlx4_ib_dev *dev, struct mlx4_mtt *mtt,
 	int err = 0;
 	struct scatterlist *sg;
 
-	pages = (u64 *) __get_free_page(GFP_KERNEL);
+	pages = get_free_page(GFP_KERNEL);
 	if (!pages)
 		return -ENOMEM;
 
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index 899add65..a378917 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -538,7 +538,7 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_qp *qp,
 	u16 wqe_index = pfault->mpfault.wqe.wqe_index;
 	int requestor = pfault->mpfault.flags & MLX5_PFAULT_REQUESTOR;
 
-	buffer = (char *)__get_free_page(GFP_KERNEL);
+	buffer = get_free_page(GFP_KERNEL);
 	if (!buffer) {
 		mlx5_ib_err(dev, "Error allocating memory for IO page fault handling.\n");
 		resume_with_error = 1;
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index e95980e..4ea565c 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -1026,7 +1026,7 @@ static struct ib_mr *mthca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 		goto err_umem;
 	}
 
-	pages = (u64 *) __get_free_page(GFP_KERNEL);
+	pages = get_free_page(GFP_KERNEL);
 	if (!pages) {
 		err = -ENOMEM;
 		goto err_mtt;
diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.c b/drivers/infiniband/hw/usnic/usnic_uiom.c
index daaaf3d..ddadc5c 100644
--- a/drivers/infiniband/hw/usnic/usnic_uiom.c
+++ b/drivers/infiniband/hw/usnic/usnic_uiom.c
@@ -122,7 +122,7 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable,
 
 	INIT_LIST_HEAD(chunk_list);
 
-	page_list = (struct page **) __get_free_page(GFP_KERNEL);
+	page_list = get_free_page(GFP_KERNEL);
 	if (!page_list)
 		return -ENOMEM;
 
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 93f3a5c..91be47a 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -123,7 +123,7 @@ static int xenkbd_probe(struct xenbus_device *dev,
 	info->gref = -1;
 	snprintf(info->phys, sizeof(info->phys), "xenbus/%s", dev->nodename);
 
-	info->page = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
+	info->page = get_free_page(GFP_KERNEL | __GFP_ZERO);
 	if (!info->page)
 		goto error_nomem;
 
diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index ff85b7b..971dc30 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -441,7 +441,7 @@ static int rackmeter_probe(struct macio_dev* mdev,
 	pr_debug("  dma @0x%08x\n", (unsigned int)rdma.start);
 	pr_debug("  irq %d\n", rm->irq);
 
-	rm->ubuf = (u8 *)__get_free_page(GFP_KERNEL);
+	rm->ubuf = get_free_page(GFP_KERNEL);
 	if (rm->ubuf == NULL) {
 		printk(KERN_ERR
 		       "rackmeter: failed to allocate samples page !\n");
diff --git a/drivers/media/pci/pt1/pt1.c b/drivers/media/pci/pt1/pt1.c
index ce4f862..b56fe66 100644
--- a/drivers/media/pci/pt1/pt1.c
+++ b/drivers/media/pci/pt1/pt1.c
@@ -651,7 +651,7 @@ pt1_alloc_adapter(struct pt1 *pt1)
 	adap->voltage = SEC_VOLTAGE_OFF;
 	adap->sleep = 1;
 
-	buf = (u8 *)__get_free_page(GFP_KERNEL);
+	buf = get_free_page(GFP_KERNEL);
 	if (!buf) {
 		ret = -ENOMEM;
 		goto err_kfree;
diff --git a/drivers/media/pci/ttpci/av7110_ca.c b/drivers/media/pci/ttpci/av7110_ca.c
index ed9c8380..c99e079 100644
--- a/drivers/media/pci/ttpci/av7110_ca.c
+++ b/drivers/media/pci/ttpci/av7110_ca.c
@@ -152,7 +152,7 @@ static ssize_t ci_ll_write(struct dvb_ringbuffer *cibuf, struct file *file,
 {
 	int free;
 	int non_blocking = file->f_flags & O_NONBLOCK;
-	u8 *page = (u8 *)__get_free_page(GFP_USER);
+	u8 *page = get_free_page(GFP_USER);
 	int res;
 
 	if (!page)
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index 2750bff..5cce770 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -790,7 +790,7 @@ ssize_t cxl_afu_read_err_buffer(struct cxl_afu *afu, char *buf,
 	}
 
 	/* use bounce buffer for copy */
-	tbuf = (void *)__get_free_page(GFP_TEMPORARY);
+	tbuf = get_free_page(GFP_TEMPORARY);
 	if (!tbuf)
 		return -ENOMEM;
 
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 6694cca..b5385b0 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -519,7 +519,7 @@ static ssize_t remote_settings_file_read(struct file *file, char __user *buf, si
 	if (*offset != 0)
 		return 0;
 
-	page = (unsigned char *)__get_free_page(GFP_KERNEL);
+	page = get_free_page(GFP_KERNEL);
 	if (!page)
 		return -ENOMEM;
 
diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c
index 0446145..98a1108 100644
--- a/drivers/misc/lkdtm.c
+++ b/drivers/misc/lkdtm.c
@@ -627,7 +627,7 @@ static ssize_t do_register_entry(enum cname which, struct file *f,
 	if (count >= PAGE_SIZE)
 		return -EINVAL;
 
-	buf = (char *)__get_free_page(GFP_KERNEL);
+	buf = get_free_page(GFP_KERNEL);
 	if (!buf)
 		return -ENOMEM;
 	if (copy_from_user(buf, user_buf, count)) {
@@ -660,7 +660,7 @@ static ssize_t lkdtm_debugfs_read(struct file *f, char __user *user_buf,
 	char *buf;
 	int i, n, out;
 
-	buf = (char *)__get_free_page(GFP_KERNEL);
+	buf = get_free_page(GFP_KERNEL);
 	if (buf == NULL)
 		return -ENOMEM;
 
@@ -742,7 +742,7 @@ static ssize_t direct_entry(struct file *f, const char __user *user_buf,
 	if (count < 1)
 		return -EINVAL;
 
-	buf = (char *)__get_free_page(GFP_KERNEL);
+	buf = get_free_page(GFP_KERNEL);
 	if (!buf)
 		return -ENOMEM;
 	if (copy_from_user(buf, user_buf, count)) {
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index be9c8d7..08a1ad0 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -315,7 +315,7 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
 		if (ret < 0)
 			goto ecfgrx;
 
-		host->bounce_buf = (u8 *)__get_free_page(GFP_KERNEL | GFP_DMA);
+		host->bounce_buf = get_free_page(GFP_KERNEL | GFP_DMA);
 		if (!host->bounce_buf)
 			goto ebouncebuf;
 
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index f8d7a2f..37d9b36 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -692,7 +692,7 @@ static void *bnx2x_frag_alloc(const struct bnx2x_fastpath *fp, gfp_t gfp_mask)
 	if (fp->rx_frag_size) {
 		/* GFP_KERNEL allocations are used only during initialization */
 		if (unlikely(gfpflags_allow_blocking(gfp_mask)))
-			return (void *)__get_free_page(gfp_mask);
+			return get_free_page(gfp_mask);
 
 		return netdev_alloc_frag(fp->rx_frag_size);
 	}
diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c
index 36c786b..972b9a7 100644
--- a/drivers/net/ethernet/sfc/mcdi.c
+++ b/drivers/net/ethernet/sfc/mcdi.c
@@ -76,7 +76,7 @@ int efx_mcdi_init(struct efx_nic *efx)
 	mcdi->efx = efx;
 #ifdef CONFIG_SFC_MCDI_LOGGING
 	/* consuming code assumes buffer is page-sized */
-	mcdi->logging_buffer = (char *)__get_free_page(GFP_KERNEL);
+	mcdi->logging_buffer = get_free_page(GFP_KERNEL);
 	if (!mcdi->logging_buffer)
 		goto fail1;
 	mcdi->logging_enabled = mcdi_logging_default;
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
index c1b3142..9ece945 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
@@ -1412,7 +1412,7 @@ static struct iw_statistics *gelic_wl_get_wireless_stats(
 
 	pr_debug("%s: <-\n", __func__);
 
-	buf = (void *)__get_free_page(GFP_KERNEL);
+	buf = get_free_page(GFP_KERNEL);
 	if (!buf)
 		return NULL;
 
@@ -1472,7 +1472,7 @@ static int gelic_wl_start_scan(struct gelic_wl_info *wl, int always_scan,
 
 	/* ESSID scan ? */
 	if (essid_len && essid) {
-		buf = (void *)__get_free_page(GFP_KERNEL);
+		buf = get_free_page(GFP_KERNEL);
 		if (!buf) {
 			ret = -ENOMEM;
 			goto out;
@@ -1523,7 +1523,7 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
 	pr_debug("%s:start\n", __func__);
 	mutex_lock(&wl->scan_lock);
 
-	buf = (void *)__get_free_page(GFP_KERNEL);
+	buf = get_free_page(GFP_KERNEL);
 	if (!buf) {
 		pr_info("%s: scan buffer alloc failed\n", __func__);
 		goto out;
@@ -1764,7 +1764,7 @@ static int gelic_wl_do_wep_setup(struct gelic_wl_info *wl)
 
 	pr_debug("%s: <-\n", __func__);
 	/* we can assume no one should uses the buffer */
-	wep = (struct gelic_eurus_wep_cfg *)__get_free_page(GFP_KERNEL);
+	wep = get_free_page(GFP_KERNEL);
 	if (!wep)
 		return -ENOMEM;
 
@@ -1854,7 +1854,7 @@ static int gelic_wl_do_wpa_setup(struct gelic_wl_info *wl)
 
 	pr_debug("%s: <-\n", __func__);
 	/* we can assume no one should uses the buffer */
-	wpa = (struct gelic_eurus_wpa_cfg *)__get_free_page(GFP_KERNEL);
+	wpa = get_free_page(GFP_KERNEL);
 	if (!wpa)
 		return -ENOMEM;
 
@@ -1935,7 +1935,7 @@ static int gelic_wl_associate_bss(struct gelic_wl_info *wl,
 	pr_debug("%s: <-\n", __func__);
 
 	/* do common config */
-	common = (struct gelic_eurus_common_cfg *)__get_free_page(GFP_KERNEL);
+	common = get_free_page(GFP_KERNEL);
 	if (!common)
 		return -ENOMEM;
 
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index a8493be..ae21f17 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -1047,7 +1047,7 @@ static int kaweth_probe(
 	} else {
 		/* Download the firmware */
 		dev_info(dev, "Downloading firmware...\n");
-		kaweth->firmware_buf = (__u8 *)__get_free_page(GFP_KERNEL);
+		kaweth->firmware_buf = get_free_page(GFP_KERNEL);
 		if ((result = kaweth_download_firmware(kaweth,
 						      "kaweth/new_code.bin",
 						      100,
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 90b77b9..5e41853 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -725,8 +725,7 @@ static struct pcifront_device *alloc_pdev(struct xenbus_device *xdev)
 	if (pdev == NULL)
 		goto out;
 
-	pdev->sh_info =
-	    (struct xen_pci_sharedinfo *)__get_free_page(GFP_KERNEL);
+	pdev->sh_info = get_free_page(GFP_KERNEL);
 	if (pdev->sh_info == NULL) {
 		kfree(pdev);
 		pdev = NULL;
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 996839f..43a750a 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -2145,7 +2145,7 @@ static int __init dell_init(void)
 	 * Allocate buffer below 4GB for SMI data--only 32-bit physical addr
 	 * is passed to SMI handler.
 	 */
-	buffer = (void *)__get_free_page(GFP_KERNEL | GFP_DMA32);
+	buffer = get_free_page(GFP_KERNEL | GFP_DMA32);
 	if (!buffer) {
 		ret = -ENOMEM;
 		goto fail_buffer;
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index c2d120a..10a2d5c 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -5118,7 +5118,7 @@ dasd_eckd_init(void)
 		kfree(dasd_reserve_req);
 		return -ENOMEM;
 	}
-	rawpadpage = (void *)__get_free_page(GFP_KERNEL);
+	rawpadpage = get_free_page(GFP_KERNEL);
 	if (!rawpadpage) {
 		kfree(path_verification_worker);
 		kfree(dasd_reserve_req);
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index 87d13a6..a4e3f391 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -145,7 +145,7 @@ static int xpram_present(void)
 	void *mem_page;
 	int rc;
 
-	mem_page = (void *)__get_free_page(GFP_KERNEL);
+	mem_page = get_free_page(GFP_KERNEL);
 	if (!mem_page)
 		return -ENOMEM;
 	rc = xpram_page_in(mem_page, 0);
@@ -161,7 +161,7 @@ static unsigned long xpram_highest_page_index(void)
 	unsigned int page_index, add_bit;
 	void *mem_page;
 
-	mem_page = (void *) __get_free_page(GFP_KERNEL);
+	mem_page = get_free_page(GFP_KERNEL);
 	if (!mem_page)
 		return 0;
 
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index 09b6c07..6bd6fd0 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -514,7 +514,7 @@ static int __init sclp_detect_standby_memory(void)
 	if ((sclp.facilities & 0xe00000000000ULL) != 0xe00000000000ULL)
 		return 0;
 	rc = -ENOMEM;
-	sccb = (void *) __get_free_page(GFP_KERNEL | GFP_DMA);
+	sccb = get_free_page(GFP_KERNEL | GFP_DMA);
 	if (!sccb)
 		goto out;
 	assigned = 0;
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 3974f34..02634f4c 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -524,7 +524,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count,
 		return rc;
 
 	len = min((size_t) PAGE_SIZE, count);
-	buf = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
+	buf = get_free_page(GFP_KERNEL | GFP_DMA);
 	if (!buf)
 		return -ENOMEM;
 
@@ -616,7 +616,7 @@ static int verify_uri_device(struct urdev *urd)
 	}
 
 	/* open file on virtual reader	*/
-	buf = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
+	buf = get_free_page(GFP_KERNEL | GFP_DMA);
 	if (!buf) {
 		rc = -ENOMEM;
 		goto fail_free_fcb;
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c
index 4a6f730..fe18b41 100644
--- a/drivers/s390/char/zcore.c
+++ b/drivers/s390/char/zcore.c
@@ -616,7 +616,7 @@ static int __init zcore_reipl_init(void)
 		return rc;
 	if (ipib_info.ipib == 0)
 		return 0;
-	ipl_block = (void *) __get_free_page(GFP_KERNEL);
+	ipl_block = get_free_page(GFP_KERNEL);
 	if (!ipl_block)
 		return -ENOMEM;
 	if (ipib_info.ipib < sclp.hsa_size)
diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
index 7322dd3..d842c56 100644
--- a/drivers/s390/cio/qdio_setup.c
+++ b/drivers/s390/cio/qdio_setup.c
@@ -144,7 +144,7 @@ static int __qdio_allocate_qs(struct qdio_q **irq_ptr_qs, int nr_queues)
 		if (!q)
 			return -ENOMEM;
 
-		q->slib = (struct slib *) __get_free_page(GFP_KERNEL);
+		q->slib = get_free_page(GFP_KERNEL);
 		if (!q->slib) {
 			kmem_cache_free(qdio_q_cache, q);
 			return -ENOMEM;
@@ -305,7 +305,7 @@ int qdio_setup_get_ssqd(struct qdio_irq *irq_ptr,
 
 	DBF_EVENT("getssqd:%4x", schid->sch_no);
 	if (!irq_ptr) {
-		ssqd = (struct chsc_ssqd_area *)__get_free_page(GFP_KERNEL);
+		ssqd = get_free_page(GFP_KERNEL);
 		if (!ssqd)
 			return -ENOMEM;
 	} else {
diff --git a/drivers/s390/cio/scm.c b/drivers/s390/cio/scm.c
index db1812e..90dbe36 100644
--- a/drivers/s390/cio/scm.c
+++ b/drivers/s390/cio/scm.c
@@ -226,7 +226,7 @@ int scm_update_information(void)
 	size_t num;
 	int ret;
 
-	scm_info = (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
+	scm_info = get_free_page(GFP_KERNEL | GFP_DMA);
 	if (!scm_info)
 		return -ENOMEM;
 
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 18f4db4..f6de41b 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -265,7 +265,7 @@ static int qeth_alloc_buffer_pool(struct qeth_card *card)
 			return -ENOMEM;
 		}
 		for (j = 0; j < QETH_MAX_BUFFER_ELEMENTS(card); ++j) {
-			ptr = (void *) __get_free_page(GFP_KERNEL);
+			ptr = get_free_page(GFP_KERNEL);
 			if (!ptr) {
 				while (j > 0)
 					free_page(pool_entry->elements[--j]);
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c
index ff85994..cd29652 100644
--- a/drivers/scsi/cxlflash/main.c
+++ b/drivers/scsi/cxlflash/main.c
@@ -776,7 +776,7 @@ static int alloc_mem(struct cxlflash_cfg *cfg)
 
 	for (i = 0; i < CXLFLASH_NUM_CMDS; buf += CMD_BUFSIZE, i++) {
 		if (!((u64)buf & (PAGE_SIZE - 1))) {
-			buf = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
+			buf = get_free_page(GFP_KERNEL | __GFP_ZERO);
 			if (unlikely(!buf)) {
 				dev_err(dev,
 					"%s: Allocate command buffers fail!\n",
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 1a05ba8..b80245b 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -2904,7 +2904,7 @@ static int ipr_sdt_copy(struct ipr_ioa_cfg *ioa_cfg,
 	       (ioa_dump->hdr.len + bytes_copied) < max_dump_size) {
 		if (ioa_dump->page_offset >= PAGE_SIZE ||
 		    ioa_dump->page_offset == 0) {
-			page = (__be32 *)__get_free_page(GFP_ATOMIC);
+			page = get_free_page(GFP_ATOMIC);
 
 			if (!page) {
 				ipr_trace;
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 2f93f80..1893e6c 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -707,7 +707,7 @@ static ssize_t proc_scsi_devinfo_write(struct file *file,
 
 	if (!buf || length>PAGE_SIZE)
 		return -EINVAL;
-	if (!(buffer = (char *) __get_free_page(GFP_KERNEL)))
+	if (!(buffer = get_free_page(GFP_KERNEL)))
 		return -ENOMEM;
 	if (copy_from_user(buffer, buf, length)) {
 		err =-EFAULT;
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index e0e0e5d..71bee2d 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -58,7 +58,7 @@ static ssize_t proc_scsi_host_write(struct file *file, const char __user *buf,
 	if (!shost->hostt->write_info)
 		return -EINVAL;
 
-	page = (char *)__get_free_page(GFP_KERNEL);
+	page = get_free_page(GFP_KERNEL);
 	if (page) {
 		ret = -EFAULT;
 		if (copy_from_user(page, buf, count))
@@ -315,7 +315,7 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
 	if (!buf || length > PAGE_SIZE)
 		return -EINVAL;
 
-	buffer = (char *)__get_free_page(GFP_KERNEL);
+	buffer = get_free_page(GFP_KERNEL);
 	if (!buffer)
 		return -ENOMEM;
 
diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 825759b..93dc086 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -718,7 +718,7 @@ static int scsifront_alloc_ring(struct vscsifrnt_info *info)
 	int err = -ENOMEM;
 
 	/***** Frontend to Backend ring start *****/
-	sring = (struct vscsiif_sring *)__get_free_page(GFP_KERNEL);
+	sring = get_free_page(GFP_KERNEL);
 	if (!sring) {
 		xenbus_dev_fatal(dev, err,
 			"fail to allocate shared ring (Front to Back)");
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index b8286e7..eea6e9b 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -1092,11 +1092,11 @@ static int sh_msiof_request_dma(struct sh_msiof_spi_priv *p)
 	if (!master->dma_rx)
 		goto free_tx_chan;
 
-	p->tx_dma_page = (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
+	p->tx_dma_page = get_free_page(GFP_KERNEL | GFP_DMA);
 	if (!p->tx_dma_page)
 		goto free_rx_chan;
 
-	p->rx_dma_page = (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
+	p->rx_dma_page = get_free_page(GFP_KERNEL | GFP_DMA);
 	if (!p->rx_dma_page)
 		goto free_tx_page;
 
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 92259be..f675ab3 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -2268,7 +2268,7 @@ void ll_dirty_page_discard_warn(struct page *page, int ioret)
 	struct ccc_object *obj = cl_inode2ccc(page->mapping->host);
 
 	/* this can be called inside spin lock so use GFP_ATOMIC. */
-	buf = (char *)__get_free_page(GFP_ATOMIC);
+	buf = get_free_page(GFP_ATOMIC);
 	if (buf != NULL) {
 		dentry = d_find_alias(page->mapping->host);
 		if (dentry != NULL)
diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index 486bef0..35471c4 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -279,7 +279,7 @@ visorchannel_clear(struct visorchannel *channel, ulong offset, u8 ch,
 	int written = 0;
 	u8 *buf;
 
-	buf = (u8 *)__get_free_page(GFP_KERNEL);
+	buf = get_free_page(GFP_KERNEL);
 	if (!buf)
 		return -ENOMEM;
 
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index ca682ec..86ad9ea 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -460,7 +460,7 @@ fd_do_prot_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb)
 	void *buf;
 	int rc;
 
-	buf = (void *)__get_free_page(GFP_KERNEL);
+	buf = get_free_page(GFP_KERNEL);
 	if (!buf) {
 		pr_err("Unable to allocate FILEIO prot buf\n");
 		return -ENOMEM;
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index 4f7716d..423d2cf 100644
--- a/drivers/tty/hvc/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
@@ -445,7 +445,7 @@ static int xencons_probe(struct xenbus_device *dev,
 	dev_set_drvdata(&dev->dev, info);
 	info->xbdev = dev;
 	info->vtermno = xenbus_devid_to_vtermno(devid);
-	info->intf = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
+	info->intf = get_free_page(GFP_KERNEL | __GFP_ZERO);
 	if (!info->intf)
 		goto error_nomem;
 
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c
index fb3f4cd..29320d0 100644
--- a/drivers/tty/hvc/hvcs.c
+++ b/drivers/tty/hvc/hvcs.c
@@ -1532,7 +1532,7 @@ static int hvcs_initialize(void)
 		goto register_fail;
 	}
 
-	hvcs_pi_buff = (unsigned long *) __get_free_page(GFP_KERNEL);
+	hvcs_pi_buff = get_free_page(GFP_KERNEL);
 	if (!hvcs_pi_buff) {
 		rc = -ENOMEM;
 		goto buff_alloc_fail;
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c
index ee78fc2..56bd374 100644
--- a/drivers/tty/mxser.c
+++ b/drivers/tty/mxser.c
@@ -865,7 +865,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)
 	unsigned char *page;
 	unsigned long flags;
 
-	page = (unsigned char *)__get_free_page(GFP_KERNEL);
+	page = get_free_page(GFP_KERNEL);
 	if (!page)
 		return -ENOMEM;
 
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 78f0330..fc2d1ef 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -891,7 +891,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
 		return -ENXIO;
 	port = &info->port;
 	
-	page = (unsigned char *)__get_free_page(GFP_KERNEL);
+	page = get_free_page(GFP_KERNEL);
 	if (!page)
 		return -ENOMEM;
 
diff --git a/drivers/tty/serial/68328serial.c b/drivers/tty/serial/68328serial.c
index 4485466..5fac3e7 100644
--- a/drivers/tty/serial/68328serial.c
+++ b/drivers/tty/serial/68328serial.c
@@ -379,7 +379,7 @@ static int startup(struct m68k_serial *info, struct tty_struct *tty)
 		return 0;
 
 	if (!info->xmit_buf) {
-		info->xmit_buf = (unsigned char *) __get_free_page(GFP_KERNEL);
+		info->xmit_buf = get_free_page(GFP_KERNEL);
 		if (!info->xmit_buf)
 			return -ENOMEM;
 	}
diff --git a/drivers/tty/serial/men_z135_uart.c b/drivers/tty/serial/men_z135_uart.c
index df3c6ad..534b2ed 100644
--- a/drivers/tty/serial/men_z135_uart.c
+++ b/drivers/tty/serial/men_z135_uart.c
@@ -824,7 +824,7 @@ static int men_z135_probe(struct mcb_device *mdev,
 	if (!uart)
 		return -ENOMEM;
 
-	uart->rxbuf = (unsigned char *)__get_free_page(GFP_KERNEL);
+	uart->rxbuf = get_free_page(GFP_KERNEL);
 	if (!uart->rxbuf)
 		return -ENOMEM;
 
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 7e461e0..daee5b8 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1771,7 +1771,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 	if (priv == NULL)
 		goto init_port_alloc_err;
 
-	rxbuf = (unsigned char *)__get_free_page(GFP_KERNEL);
+	rxbuf = get_free_page(GFP_KERNEL);
 	if (!rxbuf)
 		goto init_port_free_txbuf;
 
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
index 5d25934..7227efe 100644
--- a/drivers/tty/vt/vc_screen.c
+++ b/drivers/tty/vt/vc_screen.c
@@ -206,7 +206,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 	ssize_t ret;
 	char *con_buf;
 
-	con_buf = (char *) __get_free_page(GFP_KERNEL);
+	con_buf = get_free_page(GFP_KERNEL);
 	if (!con_buf)
 		return -ENOMEM;
 
@@ -384,7 +384,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 	size_t ret;
 	char *con_buf;
 
-	con_buf = (char *) __get_free_page(GFP_KERNEL);
+	con_buf = get_free_page(GFP_KERNEL);
 	if (!con_buf)
 		return -ENOMEM;
 
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c
index f03bc30..e078eeb 100644
--- a/drivers/usb/atm/cxacru.c
+++ b/drivers/usb/atm/cxacru.c
@@ -942,7 +942,7 @@ static int cxacru_fw(struct usb_device *usb_dev, enum cxacru_fw_request fw,
 	int offd, offb;
 	const int stride = CMD_PACKET_SIZE - 8;
 
-	buf = (u8 *) __get_free_page(GFP_KERNEL);
+	buf = get_free_page(GFP_KERNEL);
 	if (!buf)
 		return -ENOMEM;
 
@@ -1152,13 +1152,13 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance,
 
 	mutex_init(&instance->adsl_state_serialize);
 
-	instance->rcv_buf = (u8 *) __get_free_page(GFP_KERNEL);
+	instance->rcv_buf = get_free_page(GFP_KERNEL);
 	if (!instance->rcv_buf) {
 		usb_dbg(usbatm_instance, "cxacru_bind: no memory for rcv_buf\n");
 		ret = -ENOMEM;
 		goto fail;
 	}
-	instance->snd_buf = (u8 *) __get_free_page(GFP_KERNEL);
+	instance->snd_buf = get_free_page(GFP_KERNEL);
 	if (!instance->snd_buf) {
 		usb_dbg(usbatm_instance, "cxacru_bind: no memory for snd_buf\n");
 		ret = -ENOMEM;
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
index 681599f..e6a1ff8 100644
--- a/drivers/usb/atm/speedtch.c
+++ b/drivers/usb/atm/speedtch.c
@@ -255,7 +255,7 @@ static int speedtch_upload_firmware(struct speedtch_instance_data *instance,
 
 	usb_dbg(usbatm, "%s entered\n", __func__);
 
-	buffer = (unsigned char *)__get_free_page(GFP_KERNEL);
+	buffer = get_free_page(GFP_KERNEL);
 	if (!buffer) {
 		ret = -ENOMEM;
 		usb_dbg(usbatm, "%s: no memory for buffer!\n", __func__);
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index c2cef46..af957f0 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -988,7 +988,7 @@ static int proc_control(struct usb_dev_state *ps, void __user *arg)
 			sizeof(struct usb_ctrlrequest));
 	if (ret)
 		return ret;
-	tbuf = (unsigned char *)__get_free_page(GFP_KERNEL);
+	tbuf = get_free_page(GFP_KERNEL);
 	if (!tbuf) {
 		ret = -ENOMEM;
 		goto done;
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c
index 3c49061..f50166565 100644
--- a/drivers/usb/misc/rio500.c
+++ b/drivers/usb/misc/rio500.c
@@ -139,7 +139,7 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg)
 			retval = -EINVAL;
 			goto err_out;
 		}
-		buffer = (unsigned char *) __get_free_page(GFP_KERNEL);
+		buffer = get_free_page(GFP_KERNEL);
 		if (buffer == NULL) {
 			retval = -ENOMEM;
 			goto err_out;
@@ -210,7 +210,7 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg)
 			retval = -EINVAL;
 			goto err_out;
 		}
-		buffer = (unsigned char *) __get_free_page(GFP_KERNEL);
+		buffer = get_free_page(GFP_KERNEL);
 		if (buffer == NULL) {
 			retval = -ENOMEM;
 			goto err_out;
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index de9ff1b..fbebc5d 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -525,7 +525,7 @@ int usb_wwan_port_probe(struct usb_serial_port *port)
 	init_usb_anchor(&portdata->delayed);
 
 	for (i = 0; i < N_IN_URB; i++) {
-		buffer = (u8 *)__get_free_page(GFP_KERNEL);
+		buffer = get_free_page(GFP_KERNEL);
 		if (!buffer)
 			goto bail_out_error;
 		portdata->in_buffer[i] = buffer;
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
index 2d3334f..b92ef24 100644
--- a/drivers/uwb/hwa-rc.c
+++ b/drivers/uwb/hwa-rc.c
@@ -695,7 +695,7 @@ static int hwarc_neep_init(struct uwb_rc *rc)
 	struct usb_endpoint_descriptor *epd;
 
 	epd = &iface->cur_altsetting->endpoint[0].desc;
-	hwarc->rd_buffer = (void *) __get_free_page(GFP_KERNEL);
+	hwarc->rd_buffer = get_free_page(GFP_KERNEL);
 	if (hwarc->rd_buffer == NULL) {
 		dev_err(dev, "Unable to allocate notification's read buffer\n");
 		goto error_rd_buffer;
diff --git a/drivers/video/fbdev/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c
index b126f77..11ecb95 100644
--- a/drivers/video/fbdev/xen-fbfront.c
+++ b/drivers/video/fbdev/xen-fbfront.c
@@ -407,7 +407,7 @@ static int xenfb_probe(struct xenbus_device *dev,
 		goto error_nomem;
 
 	/* set up shared page */
-	info->page = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
+	info->page = get_free_page(GFP_KERNEL | __GFP_ZERO);
 	if (!info->page)
 		goto error_nomem;
 
diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index 0fe5889..b107c3e 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -1688,7 +1688,7 @@ void __init xen_init_IRQ(void)
 		int rc;
 		struct physdev_pirq_eoi_gmfn eoi_gmfn;
 
-		pirq_eoi_map = (void *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
+		pirq_eoi_map = get_free_page(GFP_KERNEL|__GFP_ZERO);
 		eoi_gmfn.gmfn = virt_to_gfn(pirq_eoi_map);
 		rc = HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_gmfn_v2, &eoi_gmfn);
 		/* TODO: No PVH support for PIRQ EOI */
diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c
index 722c2a0..cc3857c 100644
--- a/drivers/xen/events/events_fifo.c
+++ b/drivers/xen/events/events_fifo.c
@@ -156,7 +156,7 @@ static int evtchn_fifo_setup(struct irq_info *info)
 		/* Might already have a page if we've resumed. */
 		array_page = event_array[event_array_pages];
 		if (!array_page) {
-			array_page = (void *)__get_free_page(GFP_KERNEL);
+			array_page = get_free_page(GFP_KERNEL);
 			if (array_page == NULL) {
 				ret = -ENOMEM;
 				goto error;
@@ -391,7 +391,7 @@ static int evtchn_fifo_alloc_control_block(unsigned cpu)
 	void *control_block = NULL;
 	int ret = -ENOMEM;
 
-	control_block = (void *)__get_free_page(GFP_KERNEL);
+	control_block = get_free_page(GFP_KERNEL);
 	if (control_block == NULL)
 		goto error;
 
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
index bcd5f54..5c044a2 100644
--- a/drivers/xen/evtchn.c
+++ b/drivers/xen/evtchn.c
@@ -270,7 +270,7 @@ static ssize_t evtchn_write(struct file *file, const char __user *buf,
 			    size_t count, loff_t *ppos)
 {
 	int rc, i;
-	evtchn_port_t *kbuf = (evtchn_port_t *)__get_free_page(GFP_KERNEL);
+	evtchn_port_t *kbuf = get_free_page(GFP_KERNEL);
 	struct per_user_data *u = file->private_data;
 
 	if (kbuf == NULL)
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 29d88da..00e7130 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -577,7 +577,7 @@ static int grow_gnttab_list(unsigned int more_frames)
 	new_nr_glist_frames =
 		(new_nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;
 	for (i = nr_glist_frames; i < new_nr_glist_frames; i++) {
-		gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_ATOMIC);
+		gnttab_list[i] = get_free_page(GFP_ATOMIC);
 		if (!gnttab_list[i])
 			goto grow_nomem;
 	}
@@ -1109,7 +1109,7 @@ int gnttab_init(void)
 
 	nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP;
 	for (i = 0; i < nr_glist_frames; i++) {
-		gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL);
+		gnttab_list[i] = get_free_page(GFP_KERNEL);
 		if (gnttab_list[i] == NULL) {
 			ret = -ENOMEM;
 			goto ini_nomem;
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index a7ab050..5479f6f 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -607,7 +607,7 @@ bm_entry_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
 	ssize_t res;
 	char *page;
 
-	page = (char *) __get_free_page(GFP_KERNEL);
+	page = get_free_page(GFP_KERNEL);
 	if (!page)
 		return -ENOMEM;
 
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 37b4ae3..c3755f0 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1373,7 +1373,7 @@ static const char *fuse_follow_link(struct dentry *dentry, void **cookie)
 	char *link;
 	ssize_t ret;
 
-	link = (char *) __get_free_page(GFP_KERNEL);
+	link = get_free_page(GFP_KERNEL);
 	if (!link)
 		return ERR_PTR(-ENOMEM);
 
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a07709b..2e44926 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2458,7 +2458,7 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
 
 	err = -ENOMEM;
 	pages = kcalloc(FUSE_MAX_PAGES_PER_REQ, sizeof(pages[0]), GFP_KERNEL);
-	iov_page = (struct iovec *) __get_free_page(GFP_KERNEL);
+	iov_page = get_free_page(GFP_KERNEL);
 	if (!pages || !iov_page)
 		goto out;
 
diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index 2d495b5..63199f6 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -253,7 +253,7 @@ static int isofs_readdir(struct file *file, struct dir_context *ctx)
 	struct iso_directory_record *tmpde;
 	struct inode *inode = file_inode(file);
 
-	tmpname = (char *)__get_free_page(GFP_KERNEL);
+	tmpname = get_free_page(GFP_KERNEL);
 	if (tmpname == NULL)
 		return -ENOMEM;
 
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index 56d18de..1007b44 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -3180,7 +3180,7 @@ int jfs_readdir(struct file *file, struct dir_context *ctx)
 		}
 	}
 
-	dirent_buf = (void *)__get_free_page(GFP_KERNEL);
+	dirent_buf = get_free_page(GFP_KERNEL);
 	if (!dirent_buf) {
 		DT_PUTPAGE(mp);
 		jfs_warn("jfs_readdir: __get_free_page failed!");
diff --git a/fs/namespace.c b/fs/namespace.c
index 4bcae39..5f1245c 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2611,7 +2611,7 @@ int copy_mount_options(const void __user * data, void **where)
 	if (!data)
 		return 0;
 
-	if (!(page = (char *)__get_free_page(GFP_KERNEL)))
+	if (!(page = get_free_page(GFP_KERNEL)))
 		return -ENOMEM;
 
 	/* We only care that *some* data at the address the user
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index faa1ce5..20b38fa 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -248,7 +248,7 @@ struct vfsmount *nfs_do_submount(struct dentry *dentry, struct nfs_fh *fh,
 		.authflavor = authflavor,
 	};
 	struct vfsmount *mnt = ERR_PTR(-ENOMEM);
-	char *page = (char *) __get_free_page(GFP_USER);
+	char *page = get_free_page(GFP_USER);
 	char *devname;
 
 	dprintk("--> nfs_do_submount()\n");
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 82b1537..7a6565a 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -310,11 +310,11 @@ static struct vfsmount *nfs_follow_referral(struct dentry *dentry,
 
 	dprintk("%s: referral at %pd2\n", __func__, dentry);
 
-	page = (char *) __get_free_page(GFP_USER);
+	page = get_free_page(GFP_USER);
 	if (!page)
 		goto out;
 
-	page2 = (char *) __get_free_page(GFP_USER);
+	page2 = get_free_page(GFP_USER);
 	if (!page2)
 		goto out;
 
@@ -495,10 +495,10 @@ int nfs4_replace_transport(struct nfs_server *server,
 		goto out;
 
 	error = -ENOMEM;
-	page = (char *) __get_free_page(GFP_USER);
+	page = get_free_page(GFP_USER);
 	if (!page)
 		goto out;
-	page2 = (char *) __get_free_page(GFP_USER);
+	page2 = get_free_page(GFP_USER);
 	if (!page2)
 		goto out;
 
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index ba0ad91..427d0a9 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -779,7 +779,7 @@ static void show_implementation_id(struct seq_file *m, struct nfs_server *nfss)
 
 int nfs_show_devname(struct seq_file *m, struct dentry *root)
 {
-	char *page = (char *) __get_free_page(GFP_KERNEL);
+	char *page = get_free_page(GFP_KERNEL);
 	char *devname, *dummy;
 	int err = 0;
 	if (!page)
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index e9df47b..8a10704 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1800,7 +1800,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, nfsd_filldir_t func,
 	loff_t offset;
 	struct readdir_data buf = {
 		.ctx.actor = nfsd_buffered_filldir,
-		.dirent = (void *)__get_free_page(GFP_KERNEL)
+		.dirent = get_free_page(GFP_KERNEL)
 	};
 
 	if (!buf.dirent)
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 841d822..4a80983 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -92,7 +92,7 @@ static void **dlm_alloc_pagevec(int pages)
 		return NULL;
 
 	for (i = 0; i < pages; i++)
-		if (!(vec[i] = (void *)__get_free_page(GFP_KERNEL)))
+		if (!(vec[i] = get_free_page(GFP_KERNEL)))
 			goto out_free;
 
 	mlog(0, "Allocated DLM hash pagevec; %d pages (%lu expected), %lu buckets per page\n",
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index a0edd7e..2d5c2c38 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2498,7 +2498,7 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
 
 	/* preallocate up front. if this fails, abort */
 	ret = -ENOMEM;
-	mres = (struct dlm_migratable_lockres *) __get_free_page(GFP_NOFS);
+	mres = get_free_page(GFP_NOFS);
 	if (!mres) {
 		mlog_errno(ret);
 		goto leave;
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index 7368158..a2338d8 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -856,7 +856,7 @@ int dlm_request_all_locks_handler(struct o2net_msg *msg, u32 len, void *data,
 	}
 
 	/* this will get freed by dlm_request_all_locks_worker */
-	buf = (char *) __get_free_page(GFP_NOFS);
+	buf = get_free_page(GFP_NOFS);
 	if (!buf) {
 		kfree(item);
 		dlm_put(dlm);
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index b3f1da5..0c66579 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -134,7 +134,7 @@ static char *ovl_read_symlink(struct dentry *realdentry)
 		goto err;
 
 	res = -ENOMEM;
-	buf = (char *) __get_free_page(GFP_KERNEL);
+	buf = get_free_page(GFP_KERNEL);
 	if (!buf)
 		goto err;
 
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a9828e5..f115e58 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -224,7 +224,7 @@ static ssize_t proc_pid_cmdline_read(struct file *file, char __user *buf,
 		goto out_mmput;
 	}
 
-	page = (char *)__get_free_page(GFP_TEMPORARY);
+	page = get_free_page(GFP_TEMPORARY);
 	if (!page) {
 		rv = -ENOMEM;
 		goto out_mmput;
@@ -855,7 +855,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
 	if (!mm)
 		return 0;
 
-	page = (char *)__get_free_page(GFP_TEMPORARY);
+	page = get_free_page(GFP_TEMPORARY);
 	if (!page)
 		return -ENOMEM;
 
@@ -956,7 +956,7 @@ static ssize_t environ_read(struct file *file, char __user *buf,
 	if (!mm)
 		return 0;
 
-	page = (char *)__get_free_page(GFP_TEMPORARY);
+	page = get_free_page(GFP_TEMPORARY);
 	if (!page)
 		return -ENOMEM;
 
@@ -1586,7 +1586,7 @@ out:
 
 static int do_proc_readlink(struct path *path, char __user *buffer, int buflen)
 {
-	char *tmp = (char*)__get_free_page(GFP_TEMPORARY);
+	char *tmp = get_free_page(GFP_TEMPORARY);
 	char *pathname;
 	int len;
 
@@ -2375,7 +2375,7 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
 		goto out;
 
 	length = -ENOMEM;
-	page = (char*)__get_free_page(GFP_TEMPORARY);
+	page = get_free_page(GFP_TEMPORARY);
 	if (!page)
 		goto out;
 
diff --git a/fs/select.c b/fs/select.c
index 6acb0ae..8619de7 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -165,7 +165,7 @@ static struct poll_table_entry *poll_get_entry(struct poll_wqueues *p)
 	if (!table || POLL_TABLE_FULL(table)) {
 		struct poll_table_page *new_table;
 
-		new_table = (struct poll_table_page *) __get_free_page(GFP_KERNEL);
+		new_table = get_free_page(GFP_KERNEL);
 		if (!new_table) {
 			p->error = -ENOMEM;
 			return NULL;
diff --git a/include/linux/quicklist.h b/include/linux/quicklist.h
index bd46643..fa5ecd2 100644
--- a/include/linux/quicklist.h
+++ b/include/linux/quicklist.h
@@ -46,7 +46,7 @@ static inline void *quicklist_alloc(int nr, gfp_t flags, void (*ctor)(void *))
 	if (likely(p))
 		return p;
 
-	p = (void *)__get_free_page(flags | __GFP_ZERO);
+	p = get_free_page(flags | __GFP_ZERO);
 	if (ctor && p)
 		ctor(p);
 	return p;
diff --git a/kernel/groups.c b/kernel/groups.c
index 88f7e1a8..e978016c 100644
--- a/kernel/groups.c
+++ b/kernel/groups.c
@@ -30,7 +30,7 @@ struct group_info *groups_alloc(int gidsetsize)
 	else {
 		for (i = 0; i < nblocks; i++) {
 			kgid_t *b;
-			b = (void *)__get_free_page(GFP_USER);
+			b = get_free_page(GFP_USER);
 			if (!b)
 				goto out_undo_partial_alloc;
 			group_info->blocks[i] = b;
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 5bbe897..f64d341 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -356,7 +356,7 @@ static int write_page(void *buf, sector_t offset, struct hib_bio_batch *hb)
 		return -ENOSPC;
 
 	if (hb) {
-		src = (void *)__get_free_page(__GFP_RECLAIM | __GFP_NOWARN |
+		src = get_free_page(__GFP_RECLAIM | __GFP_NOWARN |
 		                              __GFP_NORETRY);
 		if (src) {
 			copy_page(src, buf);
@@ -364,7 +364,7 @@ static int write_page(void *buf, sector_t offset, struct hib_bio_batch *hb)
 			ret = hib_wait_io(hb); /* Free pages */
 			if (ret)
 				return ret;
-			src = (void *)__get_free_page(__GFP_RECLAIM |
+			src = get_free_page(__GFP_RECLAIM |
 			                              __GFP_NOWARN |
 			                              __GFP_NORETRY);
 			if (src) {
@@ -672,7 +672,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
 	nr_threads = num_online_cpus() - 1;
 	nr_threads = clamp_val(nr_threads, 1, LZO_THREADS);
 
-	page = (void *)__get_free_page(__GFP_RECLAIM | __GFP_HIGH);
+	page = get_free_page(__GFP_RECLAIM | __GFP_HIGH);
 	if (!page) {
 		printk(KERN_ERR "PM: Failed to allocate LZO page\n");
 		ret = -ENOMEM;
@@ -974,8 +974,7 @@ static int get_swap_reader(struct swap_map_handle *handle,
 			last->next = tmp;
 		last = tmp;
 
-		tmp->map = (struct swap_map_page *)
-			   __get_free_page(__GFP_RECLAIM | __GFP_HIGH);
+		tmp->map = get_free_page(__GFP_RECLAIM | __GFP_HIGH);
 		if (!tmp->map) {
 			release_swap_reader(handle);
 			return -ENOMEM;
@@ -1241,7 +1240,7 @@ static int load_image_lzo(struct swap_map_handle *handle,
 	read_pages = clamp_val(read_pages, LZO_MIN_RD_PAGES, LZO_MAX_RD_PAGES);
 
 	for (i = 0; i < read_pages; i++) {
-		page[i] = (void *)__get_free_page(i < LZO_CMP_PAGES ?
+		page[i] = get_free_page(i < LZO_CMP_PAGES ?
 						  __GFP_RECLAIM | __GFP_HIGH :
 						  __GFP_RECLAIM | __GFP_NOWARN |
 						  __GFP_NORETRY);
@@ -1580,7 +1579,7 @@ int swsusp_unmark(void)
 
 static int swsusp_header_init(void)
 {
-	swsusp_header = (struct swsusp_header*) __get_free_page(GFP_KERNEL);
+	swsusp_header =  get_free_page(GFP_KERNEL);
 	if (!swsusp_header)
 		panic("Could not allocate memory for swsusp_header\n");
 	return 0;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index edb7da4..b2aed2a 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2077,7 +2077,7 @@ static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
 
 		if (left > PAGE_SIZE - 1)
 			left = PAGE_SIZE - 1;
-		kbuf = (char *)__get_free_page(GFP_TEMPORARY);
+		kbuf = get_free_page(GFP_TEMPORARY);
 		if (!kbuf)
 			return -ENOMEM;
 		if (copy_from_user(kbuf, buffer, left)) {
@@ -2337,7 +2337,7 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int
 
 		if (left > PAGE_SIZE - 1)
 			left = PAGE_SIZE - 1;
-		kbuf = (char *)__get_free_page(GFP_TEMPORARY);
+		kbuf = get_free_page(GFP_TEMPORARY);
 		if (!kbuf)
 			return -ENOMEM;
 		if (copy_from_user(kbuf, buffer, left)) {
@@ -2646,7 +2646,7 @@ int proc_do_large_bitmap(struct ctl_table *table, int write,
 	}
 
 	if (write) {
-		char *kbuf = (char *)__get_free_page(GFP_TEMPORARY);
+		char *kbuf = get_free_page(GFP_TEMPORARY);
 		if (!kbuf)
 			return -ENOMEM;
 
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 0a0a08e..d32df68 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -1340,7 +1340,7 @@ event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
 	if (cnt >= PAGE_SIZE)
 		return -EINVAL;
 
-	buf = (char *)__get_free_page(GFP_TEMPORARY);
+	buf = get_free_page(GFP_TEMPORARY);
 	if (!buf)
 		return -ENOMEM;
 
@@ -1507,7 +1507,7 @@ subsystem_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
 	if (cnt >= PAGE_SIZE)
 		return -EINVAL;
 
-	buf = (char *)__get_free_page(GFP_TEMPORARY);
+	buf = get_free_page(GFP_TEMPORARY);
 	if (!buf)
 		return -ENOMEM;
 
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 234b5b9e..3889fce 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -671,7 +671,7 @@ static void append_filter_err(struct filter_parse_state *ps,
 	int pos = ps->lasterr_pos;
 	char *buf, *pbuf;
 
-	buf = (char *)__get_free_page(GFP_TEMPORARY);
+	buf = get_free_page(GFP_TEMPORARY);
 	if (!buf)
 		return;
 
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index 0796e61..af6c31d 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -237,7 +237,7 @@ static ssize_t event_trigger_regex_write(struct file *file,
 	if (cnt >= PAGE_SIZE)
 		return -EINVAL;
 
-	buf = (char *)__get_free_page(GFP_TEMPORARY);
+	buf = get_free_page(GFP_TEMPORARY);
 	if (!buf)
 		return -ENOMEM;
 
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index badce97..57eb85f0 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -639,7 +639,7 @@ static ssize_t map_write(struct file *file, const char __user *buf,
 
 	/* Get a buffer */
 	ret = -ENOMEM;
-	kbuf = (char *)__get_free_page(GFP_TEMPORARY);
+	kbuf = get_free_page(GFP_TEMPORARY);
 	if (!kbuf)
 		goto out;
 
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 6f44c3e..0752e7a 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -173,7 +173,7 @@ static struct scatterlist *sg_kmalloc(unsigned int nents, gfp_t gfp_mask)
 		 * false-positive) we need to inform kmemleak of all the
 		 * intermediate allocations.
 		 */
-		void *ptr = (void *) __get_free_page(gfp_mask);
+		void *ptr = get_free_page(gfp_mask);
 		kmemleak_alloc(ptr, PAGE_SIZE, 1, gfp_mask);
 		return ptr;
 	} else
diff --git a/mm/memory.c b/mm/memory.c
index a3c4440..8e4b375 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -371,7 +371,7 @@ void tlb_remove_table(struct mmu_gather *tlb, void *table)
 	}
 
 	if (*batch == NULL) {
-		*batch = (struct mmu_table_batch *)__get_free_page(GFP_NOWAIT | __GFP_NOWARN);
+		*batch = get_free_page(GFP_NOWAIT | __GFP_NOWARN);
 		if (*batch == NULL) {
 			tlb_remove_table_one(table);
 			return;
@@ -3762,7 +3762,7 @@ void print_vma_addr(char *prefix, unsigned long ip)
 	vma = find_vma(mm, ip);
 	if (vma && vma->vm_file) {
 		struct file *f = vma->vm_file;
-		char *buf = (char *)__get_free_page(GFP_KERNEL);
+		char *buf = get_free_page(GFP_KERNEL);
 		if (buf) {
 			char *p;
 
diff --git a/mm/migrate.c b/mm/migrate.c
index 7aeba9a..f9c2d38 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1323,7 +1323,7 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes,
 	int err;
 
 	err = -ENOMEM;
-	pm = (struct page_to_node *)__get_free_page(GFP_KERNEL);
+	pm = get_free_page(GFP_KERNEL);
 	if (!pm)
 		goto out;
 
diff --git a/mm/mincore.c b/mm/mincore.c
index 077ef0e..a6a19db 100644
--- a/mm/mincore.c
+++ b/mm/mincore.c
@@ -239,7 +239,7 @@ SYSCALL_DEFINE3(mincore, unsigned long, start, size_t, len,
 	if (!access_ok(VERIFY_WRITE, vec, pages))
 		return -EFAULT;
 
-	tmp = (void *) __get_free_page(GFP_USER);
+	tmp = get_free_page(GFP_USER);
 	if (!tmp)
 		return -EAGAIN;
 
diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c
index a2721ae..45d20cb 100644
--- a/net/atm/mpoa_proc.c
+++ b/net/atm/mpoa_proc.c
@@ -215,7 +215,7 @@ static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
 	if (nbytes >= PAGE_SIZE)
 		nbytes = PAGE_SIZE-1;
 
-	page = (char *)__get_free_page(GFP_KERNEL);
+	page = get_free_page(GFP_KERNEL);
 	if (!page)
 		return -ENOMEM;
 
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index dba9f5f..e539d0d 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1258,7 +1258,7 @@ static int selinux_genfs_get_sid(struct dentry *dentry,
 	struct super_block *sb = dentry->d_inode->i_sb;
 	char *buffer, *path;
 
-	buffer = (char *)__get_free_page(GFP_KERNEL);
+	buffer = get_free_page(GFP_KERNEL);
 	if (!buffer)
 		return -ENOMEM;
 
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index c4de69b..563ba88 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1336,7 +1336,7 @@ static ssize_t sel_read_avc_hash_stats(struct file *filp, char __user *buf,
 	char *page;
 	ssize_t length;
 
-	page = (char *)__get_free_page(GFP_KERNEL);
+	page = get_free_page(GFP_KERNEL);
 	if (!page)
 		return -ENOMEM;
 
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c
index 8aa54fc..8ce2399 100644
--- a/sound/oss/msnd_pinnacle.c
+++ b/sound/oss/msnd_pinnacle.c
@@ -899,7 +899,7 @@ static __inline__ int pack_DAPF_to_DAPQ(register int start)
 static int dsp_read(char __user *buf, size_t len)
 {
 	int count = len;
-	char *page = (char *)__get_free_page(GFP_KERNEL);
+	char *page = get_free_page(GFP_KERNEL);
 	int timeout = get_rec_delay_jiffies(DAR_BUFF_SIZE);
 
 	if (!page)
@@ -958,7 +958,7 @@ static int dsp_read(char __user *buf, size_t len)
 static int dsp_write(const char __user *buf, size_t len)
 {
 	int count = len;
-	char *page = (char *)__get_free_page(GFP_KERNEL);
+	char *page = get_free_page(GFP_KERNEL);
 	int timeout = get_play_delay_jiffies(DAP_BUFF_SIZE);
 
 	if (!page)
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ