[packages] turn some of the kernel dependencies the other way around to make it easie...
[openwrt.git] / target / linux / rb532 / patches-2.6.27 / 003-gpio_bit_setting.patch
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.
5
6 Signed-off-by: Phil Sutter <n0-1@freewrt.org>
7 ---
8 arch/mips/rb532/gpio.c | 6 ++----
9 1 files changed, 2 insertions(+), 4 deletions(-)
10
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,
16 unsigned long flags;
17 u32 val;
18
19 - bitval = !!bitval; /* map parameter to {0,1} */
20 -
21 local_irq_save(flags);
22
23 val = readl(ioaddr);
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 */
28 writel(val, ioaddr);
29
30 local_irq_restore(flags);
31 --
32 1.5.6.4
33
34
35
This page took 0.041907 seconds and 5 git commands to generate.