1 The algorithm works unconditionally. If bitval is one, the first line is
2 a no op and the second line sets the bit at offset position. Vice versa,
3 if bitval is zero, the first line clears the bit at offset position and
4 the second line is a no op.
6 Signed-off-by: Phil Sutter <n0-1@freewrt.org>
8 arch/mips/rb532/gpio.c | 6 ++----
9 1 files changed, 2 insertions(+), 4 deletions(-)
11 diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
12 index 0e84c8a..e35cb75 100644
13 --- a/arch/mips/rb532/gpio.c
14 +++ b/arch/mips/rb532/gpio.c
15 @@ -119,13 +119,11 @@ static inline void rb532_set_bit(unsigned bitval,
19 - bitval = !!bitval; /* map parameter to {0,1} */
21 local_irq_save(flags);
24 - val &= ~( ~bitval << offset ); /* unset bit if bitval == 0 */
25 - val |= ( bitval << offset ); /* set bit if bitval == 1 */
26 + val &= ~(!bitval << offset); /* unset bit if bitval == 0 */
27 + val |= (!!bitval << offset); /* set bit if bitval == 1 */
30 local_irq_restore(flags);