[ARM] remove memzero()

As suggested by Andrew Morton, remove memzero() - it's not supported
on other architectures so use of it is a potential build breaking bug.
Since the compiler optimizes memset(x,0,n) to __memzero() perfectly
well, we don't miss out on the underlying benefits of memzero().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Russell King 2008-10-27 11:24:09 +00:00 committed by Russell King
parent ed313489ba
commit 59f0cb0fdd
13 changed files with 16 additions and 23 deletions

View file

@ -86,6 +86,8 @@ static void putstr(const char *ptr)
#define __ptr_t void * #define __ptr_t void *
#define memzero(s,n) __memzero(s,n)
/* /*
* Optimised C version of memzero for the ARM. * Optimised C version of memzero for the ARM.
*/ */

View file

@ -133,7 +133,7 @@ extern void __cpu_copy_user_page(void *to, const void *from,
#define clear_user_page(addr,vaddr,pg) __cpu_clear_user_page(addr, vaddr) #define clear_user_page(addr,vaddr,pg) __cpu_clear_user_page(addr, vaddr)
#define copy_user_page(to,from,vaddr,pg) __cpu_copy_user_page(to, from, vaddr) #define copy_user_page(to,from,vaddr,pg) __cpu_copy_user_page(to, from, vaddr)
#define clear_page(page) memzero((void *)(page), PAGE_SIZE) #define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
extern void copy_page(void *to, const void *from); extern void copy_page(void *to, const void *from);
#undef STRICT_MM_TYPECHECKS #undef STRICT_MM_TYPECHECKS

View file

@ -64,7 +64,7 @@ struct thread_struct {
({ \ ({ \
unsigned long *stack = (unsigned long *)sp; \ unsigned long *stack = (unsigned long *)sp; \
set_fs(USER_DS); \ set_fs(USER_DS); \
memzero(regs->uregs, sizeof(regs->uregs)); \ memset(regs->uregs, 0, sizeof(regs->uregs)); \
if (current->personality & ADDR_LIMIT_32BIT) \ if (current->personality & ADDR_LIMIT_32BIT) \
regs->ARM_cpsr = USR_MODE; \ regs->ARM_cpsr = USR_MODE; \
else \ else \

View file

@ -21,7 +21,6 @@ extern void * memmove(void *, const void *, __kernel_size_t);
#define __HAVE_ARCH_MEMCHR #define __HAVE_ARCH_MEMCHR
extern void * memchr(const void *, int, __kernel_size_t); extern void * memchr(const void *, int, __kernel_size_t);
#define __HAVE_ARCH_MEMZERO
#define __HAVE_ARCH_MEMSET #define __HAVE_ARCH_MEMSET
extern void * memset(void *, int, __kernel_size_t); extern void * memset(void *, int, __kernel_size_t);
@ -39,12 +38,4 @@ extern void __memzero(void *ptr, __kernel_size_t n);
(__p); \ (__p); \
}) })
#define memzero(p,n) \
({ \
void *__p = (p); size_t __n = n; \
if ((__n) != 0) \
__memzero((__p),(__n)); \
(__p); \
})
#endif #endif

View file

@ -400,7 +400,7 @@ static inline unsigned long __must_check copy_from_user(void *to, const void __u
if (access_ok(VERIFY_READ, from, n)) if (access_ok(VERIFY_READ, from, n))
n = __copy_from_user(to, from, n); n = __copy_from_user(to, from, n);
else /* security hole - plug it */ else /* security hole - plug it */
memzero(to, n); memset(to, 0, n);
return n; return n;
} }

View file

@ -25,7 +25,7 @@
add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3)) add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
/* /*
* The pointer is now aligned and the length is adjusted. Try doing the * The pointer is now aligned and the length is adjusted. Try doing the
* memzero again. * memset again.
*/ */
ENTRY(memset) ENTRY(memset)

View file

@ -896,7 +896,7 @@ void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc)
* allocate the zero page. Note that we count on this going ok. * allocate the zero page. Note that we count on this going ok.
*/ */
zero_page = alloc_bootmem_low_pages(PAGE_SIZE); zero_page = alloc_bootmem_low_pages(PAGE_SIZE);
memzero(zero_page, PAGE_SIZE); memset(zero_page, 0, PAGE_SIZE);
empty_zero_page = virt_to_page(zero_page); empty_zero_page = virt_to_page(zero_page);
flush_dcache_page(empty_zero_page); flush_dcache_page(empty_zero_page);
} }

View file

@ -31,7 +31,7 @@ pgd_t *get_pgd_slow(struct mm_struct *mm)
if (!new_pgd) if (!new_pgd)
goto no_pgd; goto no_pgd;
memzero(new_pgd, FIRST_KERNEL_PGD_NR * sizeof(pgd_t)); memset(new_pgd, 0, FIRST_KERNEL_PGD_NR * sizeof(pgd_t));
/* /*
* Copy over the kernel and IO PGD entries * Copy over the kernel and IO PGD entries

View file

@ -474,9 +474,9 @@ static __init int asic3_gpio_probe(struct platform_device *pdev,
u16 dir_reg[ASIC3_NUM_GPIO_BANKS]; u16 dir_reg[ASIC3_NUM_GPIO_BANKS];
int i; int i;
memzero(alt_reg, ASIC3_NUM_GPIO_BANKS * sizeof(u16)); memset(alt_reg, 0, ASIC3_NUM_GPIO_BANKS * sizeof(u16));
memzero(out_reg, ASIC3_NUM_GPIO_BANKS * sizeof(u16)); memset(out_reg, 0, ASIC3_NUM_GPIO_BANKS * sizeof(u16));
memzero(dir_reg, ASIC3_NUM_GPIO_BANKS * sizeof(u16)); memset(dir_reg, 0, ASIC3_NUM_GPIO_BANKS * sizeof(u16));
/* Enable all GPIOs */ /* Enable all GPIOs */
asic3_write_register(asic, ASIC3_GPIO_OFFSET(A, MASK), 0xffff); asic3_write_register(asic, ASIC3_GPIO_OFFSET(A, MASK), 0xffff);

View file

@ -170,7 +170,7 @@ static int ixp2000_flash_probe(struct platform_device *dev)
err = -ENOMEM; err = -ENOMEM;
goto Error; goto Error;
} }
memzero(info, sizeof(struct ixp2000_flash_info)); memset(info, 0, sizeof(struct ixp2000_flash_info));
platform_set_drvdata(dev, info); platform_set_drvdata(dev, info);

View file

@ -201,7 +201,7 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
err = -ENOMEM; err = -ENOMEM;
goto Error; goto Error;
} }
memzero(info, sizeof(struct ixp4xx_flash_info)); memset(info, 0, sizeof(struct ixp4xx_flash_info));
platform_set_drvdata(dev, info); platform_set_drvdata(dev, info);

View file

@ -818,7 +818,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev,
goto exit_error; goto exit_error;
} }
memzero(info, sizeof(*info)); memset(info, 0, sizeof(*info));
platform_set_drvdata(pdev, info); platform_set_drvdata(pdev, info);
spin_lock_init(&info->controller.lock); spin_lock_init(&info->controller.lock);
@ -883,7 +883,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev,
goto exit_error; goto exit_error;
} }
memzero(info->mtds, size); memset(info->mtds, 0, size);
/* initialise all possible chips */ /* initialise all possible chips */

View file

@ -114,7 +114,7 @@
* - convert dma address types to dma_addr_t * - convert dma address types to dma_addr_t
* - remove unused 'montype' stuff * - remove unused 'montype' stuff
* - remove redundant zero inits of init_var after the initial * - remove redundant zero inits of init_var after the initial
* memzero. * memset.
* - remove allow_modeset (acornfb idea does not belong here) * - remove allow_modeset (acornfb idea does not belong here)
* *
* 2001/05/28: <rmk@arm.linux.org.uk> * 2001/05/28: <rmk@arm.linux.org.uk>