| To: | Ralf Baechle <ralf@linux-mips.org> |
|---|---|
| Subject: | [PATCH] MIPS: rb532: fix bit swapping in rb532_set_bit() |
| From: | Phil Sutter <n0-1@freewrt.org> |
| Date: | Mon, 3 Nov 2008 15:30:25 +0100 |
| Cc: | Sergei Shtylyov <sshtylyov@ru.mvista.com>, linux-mips@linux-mips.org |
| In-reply-to: | <20081103142942.GA13461@nuty> |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| References: | <20081103142942.GA13461@nuty> |
| Sender: | linux-mips-bounce@linux-mips.org |
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 | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
index 0e84c8a..ba9a0c4 100644
--- a/arch/mips/rb532/gpio.c
+++ b/arch/mips/rb532/gpio.c
@@ -124,8 +124,8 @@ static inline void rb532_set_bit(unsigned bitval,
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);
--
1.5.6.4
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH] provide functions for gpio configuration, Phil Sutter |
|---|---|
| Next by Date: | Re: [PATCH] MIPS: rb532: fix bit swapping in rb532_set_bit(), Atsushi Nemoto |
| Previous by Thread: | Re: [PATCH] provide functions for gpio configuration, Phil Sutter |
| Next by Thread: | Re: [PATCH] MIPS: rb532: fix bit swapping in rb532_set_bit(), Atsushi Nemoto |
| Indexes: | [Date] [Thread] [Top] [All Lists] |