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 --- a/arch/mips/rb532/gpio.c
12 +++ b/arch/mips/rb532/gpio.c
13 @@ -119,13 +119,11 @@ static inline void rb532_set_bit(unsigne
17 - bitval = !!bitval; /* map parameter to {0,1} */
19 local_irq_save(flags);
22 - val &= ~( ~bitval << offset ); /* unset bit if bitval == 0 */
23 - val |= ( bitval << offset ); /* set bit if bitval == 1 */
24 + val &= ~(!bitval << offset); /* unset bit if bitval == 0 */
25 + val |= (!!bitval << offset); /* set bit if bitval == 1 */
28 local_irq_restore(flags);