[PATCH 17/29] memstick: jmb38x_ms: move "reg_data" functions together.

From: Maxim Levitsky
Date: Fri Oct 22 2010 - 19:54:50 EST


No functional changes, just group these funtions together.

Signed-off-by: Maxim Levitsky <maximlevitsky@xxxxxxxxx>
---
drivers/memstick/host/jmb38x_ms.c | 104 ++++++++++++++++++------------------
drivers/memstick/host/jmb38x_ms.h | 8 +++
2 files changed, 60 insertions(+), 52 deletions(-)

diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c
index e896a4d..2e10104 100644
--- a/drivers/memstick/host/jmb38x_ms.c
+++ b/drivers/memstick/host/jmb38x_ms.c
@@ -60,32 +60,6 @@ static unsigned int j38ms_read_data(struct j38ms_host *host,
return off;
}

-static unsigned int j38ms_read_reg_data(struct j38ms_host *host,
- unsigned char *buf,
- unsigned int length)
-{
- unsigned int off = 0;
-
- while (host->io_pos > 4 && length) {
- buf[off++] = host->io_word[0] & 0xff;
- host->io_word[0] >>= 8;
- length--;
- host->io_pos--;
- }
-
- if (!length)
- return off;
-
- while (host->io_pos && length) {
- buf[off++] = host->io_word[1] & 0xff;
- host->io_word[1] >>= 8;
- length--;
- host->io_pos--;
- }
-
- return off;
-}
-
static unsigned int j38ms_write_data(struct j38ms_host *host,
unsigned char *buf,
unsigned int length)
@@ -139,32 +113,6 @@ static unsigned int j38ms_write_data(struct j38ms_host *host,
return off;
}

-static unsigned int j38ms_write_reg_data(struct j38ms_host *host,
- unsigned char *buf,
- unsigned int length)
-{
- unsigned int off = 0;
-
- while (host->io_pos < 4 && length) {
- host->io_word[0] &= ~(0xff << (host->io_pos * 8));
- host->io_word[0] |= buf[off++] << (host->io_pos * 8);
- host->io_pos++;
- length--;
- }
-
- if (!length)
- 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_pos++;
- length--;
- }
-
- return off;
-}
-
static int j38ms_transfer_data(struct j38ms_host *host)
{
unsigned int length;
@@ -232,6 +180,58 @@ static int j38ms_transfer_data(struct j38ms_host *host)
return length;
}

+static unsigned int j38ms_read_reg_data(struct j38ms_host *host,
+ unsigned char *buf,
+ unsigned int length)
+{
+ unsigned int off = 0;
+
+ while (host->io_pos > 4 && length) {
+ buf[off++] = host->io_word[0] & 0xff;
+ host->io_word[0] >>= 8;
+ length--;
+ host->io_pos--;
+ }
+
+ if (!length)
+ return off;
+
+ while (host->io_pos && length) {
+ buf[off++] = host->io_word[1] & 0xff;
+ host->io_word[1] >>= 8;
+ length--;
+ host->io_pos--;
+ }
+
+ return off;
+}
+
+static unsigned int j38ms_write_reg_data(struct j38ms_host *host,
+ unsigned char *buf,
+ unsigned int length)
+{
+ unsigned int off = 0;
+
+ while (host->io_pos < 4 && length) {
+ host->io_word[0] &= ~(0xff << (host->io_pos * 8));
+ host->io_word[0] |= buf[off++] << (host->io_pos * 8);
+ host->io_pos++;
+ length--;
+ }
+
+ if (!length)
+ 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_pos++;
+ length--;
+ }
+
+ return off;
+}
+
static int j38ms_issue_cmd(struct memstick_host *msh)
{
struct j38ms_host *host = memstick_priv(msh);
diff --git a/drivers/memstick/host/jmb38x_ms.h b/drivers/memstick/host/jmb38x_ms.h
index c64f2e1..a940b5d 100644
--- a/drivers/memstick/host/jmb38x_ms.h
+++ b/drivers/memstick/host/jmb38x_ms.h
@@ -186,3 +186,11 @@ enum {
#define dbg(host, format, ...) __dbg(host, 1, format, ## __VA_ARGS__)
#define dbg_v(host, format, ...) __dbg(host, 2, format, ## __VA_ARGS__)
#define dbg_reg(host, format, ...) __dbg(host, 3, format, ## __VA_ARGS__)
+
+static unsigned int j38ms_read_reg_data(struct j38ms_host *host,
+ unsigned char *buf,
+ unsigned int length);
+
+static unsigned int j38ms_write_reg_data(struct j38ms_host *host,
+ unsigned char *buf,
+ unsigned int length);
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/