diff options
Diffstat (limited to 'arch/mips/lib')
| -rw-r--r-- | arch/mips/lib/bitops.c | 57 | ||||
| -rw-r--r-- | arch/mips/lib/csum_partial.S | 4 | 
2 files changed, 15 insertions, 46 deletions
diff --git a/arch/mips/lib/bitops.c b/arch/mips/lib/bitops.c index 3b2a1e78a543..116d0bd8b2ae 100644 --- a/arch/mips/lib/bitops.c +++ b/arch/mips/lib/bitops.c @@ -7,6 +7,7 @@   * Copyright (c) 1999, 2000  Silicon Graphics, Inc.   */  #include <linux/bitops.h> +#include <linux/bits.h>  #include <linux/irqflags.h>  #include <linux/export.h> @@ -19,12 +20,11 @@   */  void __mips_set_bit(unsigned long nr, volatile unsigned long *addr)  { -	unsigned long *a = (unsigned long *)addr; -	unsigned bit = nr & SZLONG_MASK; +	volatile unsigned long *a = &addr[BIT_WORD(nr)]; +	unsigned int bit = nr % BITS_PER_LONG;  	unsigned long mask;  	unsigned long flags; -	a += nr >> SZLONG_LOG;  	mask = 1UL << bit;  	raw_local_irq_save(flags);  	*a |= mask; @@ -41,12 +41,11 @@ EXPORT_SYMBOL(__mips_set_bit);   */  void __mips_clear_bit(unsigned long nr, volatile unsigned long *addr)  { -	unsigned long *a = (unsigned long *)addr; -	unsigned bit = nr & SZLONG_MASK; +	volatile unsigned long *a = &addr[BIT_WORD(nr)]; +	unsigned int bit = nr % BITS_PER_LONG;  	unsigned long mask;  	unsigned long flags; -	a += nr >> SZLONG_LOG;  	mask = 1UL << bit;  	raw_local_irq_save(flags);  	*a &= ~mask; @@ -63,12 +62,11 @@ EXPORT_SYMBOL(__mips_clear_bit);   */  void __mips_change_bit(unsigned long nr, volatile unsigned long *addr)  { -	unsigned long *a = (unsigned long *)addr; -	unsigned bit = nr & SZLONG_MASK; +	volatile unsigned long *a = &addr[BIT_WORD(nr)]; +	unsigned int bit = nr % BITS_PER_LONG;  	unsigned long mask;  	unsigned long flags; -	a += nr >> SZLONG_LOG;  	mask = 1UL << bit;  	raw_local_irq_save(flags);  	*a ^= mask; @@ -78,32 +76,6 @@ EXPORT_SYMBOL(__mips_change_bit);  /** - * __mips_test_and_set_bit - Set a bit and return its old value.  This is - * called by test_and_set_bit() if it cannot find a faster solution. - * @nr: Bit to set - * @addr: Address to count from - */ -int __mips_test_and_set_bit(unsigned long nr, -			    volatile unsigned long *addr) -{ -	unsigned long *a = (unsigned long *)addr; -	unsigned bit = nr & SZLONG_MASK; -	unsigned long mask; -	unsigned long flags; -	int res; - -	a += nr >> SZLONG_LOG; -	mask = 1UL << bit; -	raw_local_irq_save(flags); -	res = (mask & *a) != 0; -	*a |= mask; -	raw_local_irq_restore(flags); -	return res; -} -EXPORT_SYMBOL(__mips_test_and_set_bit); - - -/**   * __mips_test_and_set_bit_lock - Set a bit and return its old value.  This is   * called by test_and_set_bit_lock() if it cannot find a faster solution.   * @nr: Bit to set @@ -112,13 +84,12 @@ EXPORT_SYMBOL(__mips_test_and_set_bit);  int __mips_test_and_set_bit_lock(unsigned long nr,  				 volatile unsigned long *addr)  { -	unsigned long *a = (unsigned long *)addr; -	unsigned bit = nr & SZLONG_MASK; +	volatile unsigned long *a = &addr[BIT_WORD(nr)]; +	unsigned int bit = nr % BITS_PER_LONG;  	unsigned long mask;  	unsigned long flags;  	int res; -	a += nr >> SZLONG_LOG;  	mask = 1UL << bit;  	raw_local_irq_save(flags);  	res = (mask & *a) != 0; @@ -137,13 +108,12 @@ EXPORT_SYMBOL(__mips_test_and_set_bit_lock);   */  int __mips_test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)  { -	unsigned long *a = (unsigned long *)addr; -	unsigned bit = nr & SZLONG_MASK; +	volatile unsigned long *a = &addr[BIT_WORD(nr)]; +	unsigned int bit = nr % BITS_PER_LONG;  	unsigned long mask;  	unsigned long flags;  	int res; -	a += nr >> SZLONG_LOG;  	mask = 1UL << bit;  	raw_local_irq_save(flags);  	res = (mask & *a) != 0; @@ -162,13 +132,12 @@ EXPORT_SYMBOL(__mips_test_and_clear_bit);   */  int __mips_test_and_change_bit(unsigned long nr, volatile unsigned long *addr)  { -	unsigned long *a = (unsigned long *)addr; -	unsigned bit = nr & SZLONG_MASK; +	volatile unsigned long *a = &addr[BIT_WORD(nr)]; +	unsigned int bit = nr % BITS_PER_LONG;  	unsigned long mask;  	unsigned long flags;  	int res; -	a += nr >> SZLONG_LOG;  	mask = 1UL << bit;  	raw_local_irq_save(flags);  	res = (mask & *a) != 0; diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S index 2ff84f4b1717..fda7b57b826e 100644 --- a/arch/mips/lib/csum_partial.S +++ b/arch/mips/lib/csum_partial.S @@ -279,7 +279,7 @@ EXPORT_SYMBOL(csum_partial)  #endif  	/* odd buffer alignment? */ -#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_LOONGSON3) +#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_LOONGSON64)  	.set	push  	.set	arch=mips32r2  	wsbh	v1, sum @@ -732,7 +732,7 @@ EXPORT_SYMBOL(csum_partial)  	addu	sum, v1  #endif -#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_LOONGSON3) +#if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_LOONGSON64)  	.set	push  	.set	arch=mips32r2  	wsbh	v1, sum  |