[<prev] [next>] [day] [month] [year] [list]
Message-Id: <201105160518.p4G5IqrK014870@jmr105.jmicron.com>
Date: Mon, 16 May 2011 13:18:52 +0800
From: "Aries Lee" <arieslee@...cron.com>
To: <linux-kernel@...r.kernel.org>
Cc: <devinchiu@...cron.com>, "'Aries Lee'" <arieslee@...cron.com>,
<oakad@...oo.com>
Subject: [PATCH 1/1] memstick: fix the bit shift problem for JMicron 38x controllers in ARM platform
If x86 architecture, an unsigned variable shift more than 31 times means a
rotation.
But in some architecture, shift 32 bit or more will give a zero value.
For example,
An unsigned int variable of 0x11223344 runs the operation "<< 32",
In x86 architecture, its value is still 0x11223344
But its value will change as 0x00000000 in ARM.
This patch try to fix those architecture-specific code, and made it both
work in x86 and the other architecture.
Signed-off-by: Aries Lee <arieslee@...cron.com>
---
diff --git a/drivers/memstick/host/jmb38x_ms.c
b/drivers/memstick/host/jmb38x_ms.c
index d89d925..272e89c 100644
--- a/drivers/memstick/host/jmb38x_ms.c
+++ b/drivers/memstick/host/jmb38x_ms.c
@@ -287,8 +287,8 @@ static unsigned int jmb38x_ms_write_reg_data(struct
jmb38x_ms_host *host,
return off;
while (host->io_pos < 8 && length) {
- host->io_word[1] &= ~(0xff << (host->io_pos * 8));
- host->io_word[1] |= buf[off++] << (host->io_pos * 8);
+ host->io_word[1] &= ~(0xff << ((host->io_pos-4) * 8));
+ host->io_word[1] |= buf[off++] << ((host->io_pos-4) * 8);
host->io_pos++;
length--;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists