From: Al Viro <v...@zeniv.linux.org.uk> Signed-off-by: Al Viro <v...@zeniv.linux.org.uk> --- arch/m68k/include/asm/floppy.h | 4 ++-- arch/mips/include/asm/mach-generic/floppy.h | 8 ++------ arch/mips/include/asm/mach-jazz/floppy.h | 10 ++++------ arch/parisc/include/asm/floppy.h | 15 +++++---------- arch/sparc/include/asm/floppy_32.h | 2 +- arch/x86/include/asm/floppy.h | 15 +++++---------- drivers/block/floppy.c | 10 +++++----- 7 files changed, 24 insertions(+), 40 deletions(-)
diff --git a/arch/m68k/include/asm/floppy.h b/arch/m68k/include/asm/floppy.h index b5fb689..44f85da 100644 --- a/arch/m68k/include/asm/floppy.h +++ b/arch/m68k/include/asm/floppy.h @@ -141,9 +141,9 @@ static int vdma_get_dma_residue(unsigned int dummy) } -static unsigned long vdma_mem_alloc(unsigned long size) +static void *vdma_mem_alloc(unsigned long size) { - return (unsigned long) vmalloc(size); + return vmalloc(size); } diff --git a/arch/mips/include/asm/mach-generic/floppy.h b/arch/mips/include/asm/mach-generic/floppy.h index 1419f0d..5b4087f 100644 --- a/arch/mips/include/asm/mach-generic/floppy.h +++ b/arch/mips/include/asm/mach-generic/floppy.h @@ -113,13 +113,9 @@ static inline unsigned long fd_getfdaddr1(void) return 0x3f0; } -static inline unsigned long fd_dma_mem_alloc(unsigned long size) +static inline void *fd_dma_mem_alloc(unsigned long size) { - unsigned long mem; - - mem = __get_dma_pages(GFP_KERNEL, get_order(size)); - - return mem; + return get_dma_pages(GFP_KERNEL, get_order(size)); } static inline void fd_dma_mem_free(void *addr, unsigned long size) diff --git a/arch/mips/include/asm/mach-jazz/floppy.h b/arch/mips/include/asm/mach-jazz/floppy.h index 701dbfc..8aa7b85 100644 --- a/arch/mips/include/asm/mach-jazz/floppy.h +++ b/arch/mips/include/asm/mach-jazz/floppy.h @@ -102,14 +102,12 @@ static inline unsigned long fd_getfdaddr1(void) return JAZZ_FDC_BASE; } -static inline unsigned long fd_dma_mem_alloc(unsigned long size) +static inline void *fd_dma_mem_alloc(unsigned long size) { - unsigned long mem; + void *mem = get_dma_pages(GFP_KERNEL, get_order(size)); - mem = __get_dma_pages(GFP_KERNEL, get_order(size)); - if(!mem) - return 0; - vdma_alloc(CPHYSADDR(mem), size); /* XXX error checking */ + if (mem) /* XXX error checking */ + vdma_alloc(CPHYSADDR((unsigned long)mem), size); return mem; } diff --git a/arch/parisc/include/asm/floppy.h b/arch/parisc/include/asm/floppy.h index 21ea40c..92bb8c8 100644 --- a/arch/parisc/include/asm/floppy.h +++ b/arch/parisc/include/asm/floppy.h @@ -163,19 +163,14 @@ static int fd_request_irq(void) 0, "floppy", NULL); } -static unsigned long dma_mem_alloc(unsigned long size) +static void *dma_mem_alloc(unsigned long size) { - return __get_dma_pages(GFP_KERNEL, get_order(size)); + return get_dma_pages(GFP_KERNEL, get_order(size)); } -static unsigned long vdma_mem_alloc(unsigned long size) -{ - return (unsigned long) vmalloc(size); - -} - -#define nodma_mem_alloc(size) vdma_mem_alloc(size) +#define vdma_mem_alloc vmalloc +#define nodma_mem_alloc vmalloc static void _fd_dma_mem_free(void *addr, unsigned long size) { @@ -237,7 +232,7 @@ static struct fd_routine_l { int (*_request_dma)(unsigned int dmanr, const char * device_id); void (*_free_dma)(unsigned int dmanr); int (*_get_dma_residue)(unsigned int dummy); - unsigned long (*_dma_mem_alloc) (unsigned long size); + void *(*_dma_mem_alloc) (unsigned long size); int (*_dma_setup)(char *addr, unsigned long size, int mode, int io); } fd_routine[] = { { diff --git a/arch/sparc/include/asm/floppy_32.h b/arch/sparc/include/asm/floppy_32.h index dd7aa7c..6e33911 100644 --- a/arch/sparc/include/asm/floppy_32.h +++ b/arch/sparc/include/asm/floppy_32.h @@ -74,7 +74,7 @@ static struct sun_floppy_ops sun_fdops; #define fd_request_irq() sun_fd_request_irq() #define fd_free_irq() /* nothing... */ #if 0 /* P3: added by Alain, these cause a MMU corruption. 19960524 XXX */ -#define fd_dma_mem_alloc(size) ((unsigned long) vmalloc(size)) +#define fd_dma_mem_alloc(size) (vmalloc(size)) #define fd_dma_mem_free(addr,size) (vfree((addr))) #endif diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h index 31718b2..1ace831 100644 --- a/arch/x86/include/asm/floppy.h +++ b/arch/x86/include/asm/floppy.h @@ -151,19 +151,14 @@ static int fd_request_irq(void) 0, "floppy", NULL); } -static unsigned long dma_mem_alloc(unsigned long size) +static void *dma_mem_alloc(unsigned long size) { - return __get_dma_pages(GFP_KERNEL|__GFP_NORETRY, get_order(size)); + return get_dma_pages(GFP_KERNEL|__GFP_NORETRY, get_order(size)); } -static unsigned long vdma_mem_alloc(unsigned long size) -{ - return (unsigned long)vmalloc(size); - -} - -#define nodma_mem_alloc(size) vdma_mem_alloc(size) +#define vdma_mem_alloc vmalloc +#define nodma_mem_alloc vmalloc static void _fd_dma_mem_free(void *addr, unsigned long size) { @@ -225,7 +220,7 @@ static struct fd_routine_l { int (*_request_dma)(unsigned int dmanr, const char *device_id); void (*_free_dma)(unsigned int dmanr); int (*_get_dma_residue)(unsigned int dummy); - unsigned long (*_dma_mem_alloc)(unsigned long size); + void *(*_dma_mem_alloc)(unsigned long size); int (*_dma_setup)(char *addr, unsigned long size, int mode, int io); } fd_routine[] = { { diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 9f36da8..e15ab8f 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -271,7 +271,7 @@ static int set_next_request(void); #endif #ifndef fd_dma_mem_alloc -#define fd_dma_mem_alloc(size) __get_dma_pages(GFP_KERNEL, get_order(size)) +#define fd_dma_mem_alloc(size) get_dma_pages(GFP_KERNEL, get_order(size)) #endif static inline void fallback_on_nodma_alloc(char **addr, size_t l) @@ -282,7 +282,7 @@ static inline void fallback_on_nodma_alloc(char **addr, size_t l) if (can_use_virtual_dma != 2) return; /* no fallback allowed */ pr_info("DMA memory shortage. Temporarily falling back on virtual DMA\n"); - *addr = (char *)nodma_mem_alloc(l); + *addr = nodma_mem_alloc(l); #else return; #endif @@ -3148,7 +3148,7 @@ loop: if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { if (ptr->length <= 0) return -EINVAL; - ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length); + ptr->kernel_data = fd_dma_mem_alloc(ptr->length); fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); if (!ptr->kernel_data) return -ENOMEM; @@ -3672,11 +3672,11 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) else try = 32; /* Only 24 actually useful */ - tmp = (char *)fd_dma_mem_alloc(1024 * try); + tmp = fd_dma_mem_alloc(1024 * try); if (!tmp && !floppy_track_buffer) { try >>= 1; /* buffer only one side */ INFBOUND(try, 16); - tmp = (char *)fd_dma_mem_alloc(1024 * try); + tmp = fd_dma_mem_alloc(1024 * try); } if (!tmp && !floppy_track_buffer) fallback_on_nodma_alloc(&tmp, 2048 * try); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/