diff options
author | Phil Sutter <n0-1@freewrt.org> | 2008-11-12 00:09:30 +0100 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-01-30 22:32:59 +0100 |
commit | 5379a5fdf3cb2b23d00da2a1298167f9a1fb002a (patch) | |
tree | 047cf637a0da94c6d080554c6a25c05463bed4ee /arch/mips/rb532/gpio.c | |
parent | MIPS: Use hardware watchpoints on all R1 and R2 CPUs. (diff) | |
download | linux-5379a5fdf3cb2b23d00da2a1298167f9a1fb002a.tar.xz linux-5379a5fdf3cb2b23d00da2a1298167f9a1fb002a.zip |
MIPS: RB532: Fix bit swapping in rb532_set_bit()
The algorithm works unconditionally. If bitval is one, the first line is
a no op and the second line sets the bit at offset position. Vice versa,
if bitval is zero, the first line clears the bit at offset position and
the second line is a no op.
Signed-off-by: Phil Sutter <n0-1@freewrt.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/rb532/gpio.c')
-rw-r--r-- | arch/mips/rb532/gpio.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c index 0e84c8ab6a39..e35cb75a3ae7 100644 --- a/arch/mips/rb532/gpio.c +++ b/arch/mips/rb532/gpio.c @@ -119,13 +119,11 @@ static inline void rb532_set_bit(unsigned bitval, unsigned long flags; u32 val; - bitval = !!bitval; /* map parameter to {0,1} */ - local_irq_save(flags); val = readl(ioaddr); - val &= ~( ~bitval << offset ); /* unset bit if bitval == 0 */ - val |= ( bitval << offset ); /* set bit if bitval == 1 */ + val &= ~(!bitval << offset); /* unset bit if bitval == 0 */ + val |= (!!bitval << offset); /* set bit if bitval == 1 */ writel(val, ioaddr); local_irq_restore(flags); |