2009-03-15 14:56:39 +02:00
|
|
|
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>
|
|
|
|
---
|
|
|
|
arch/mips/rb532/gpio.c | 6 ++----
|
|
|
|
1 files changed, 2 insertions(+), 4 deletions(-)
|
|
|
|
|
|
|
|
--- a/arch/mips/rb532/gpio.c
|
|
|
|
+++ b/arch/mips/rb532/gpio.c
|
2009-05-04 14:35:08 +03:00
|
|
|
@@ -119,13 +119,11 @@ static inline void rb532_set_bit(unsigne
|
2009-03-15 14:56:39 +02:00
|
|
|
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);
|