lkml.org 
[lkml]   [2010]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 17/29] memstick: jmb38x_ms: move "reg_data" functions together.
    Date
    No functional changes, just group these funtions together.

    Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
    ---
    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


    \
     
     \ /
      Last update: 2010-10-23 01:59    [W:0.027 / U:62.728 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site