lkml.org 
[lkml]   [2009]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subjectpxa2xx_spi: spi_bfin5xx: limit reaches -1 rather than 0
    vi drivers/spi/pxa2xx_spi.c +919 
    vi drivers/spi/spi_bfin5xx.c +645

    if (flush(drv_data) == 0) {
    dev_err(&drv_data->pdev->dev, "pump_transfers: flush failed\n");
    message->status = -EIO;
    giveback(drv_data);
    return;
    }

    But with a postfix decrement limit reaches -1 rather than 0.

    Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
    ---
    drivers/spi/pxa2xx_spi.c | 2 +-
    drivers/spi/spi_bfin5xx.c | 2 +-
    2 files changed, 2 insertions(+), 2 deletions(-)

    diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
    index d0fc4ca..3164741 100644
    --- a/drivers/spi/pxa2xx_spi.c
    +++ b/drivers/spi/pxa2xx_spi.c
    @@ -185,7 +185,7 @@ static int flush(struct driver_data *drv_data)
    while (read_SSSR(reg) & SSSR_RNE) {
    read_SSDR(reg);
    }
    - } while ((read_SSSR(reg) & SSSR_BSY) && limit--);
    + } while ((read_SSSR(reg) & SSSR_BSY) && --limit);
    write_SSSR(SSSR_ROR, reg);

    return limit;
    diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
    index 7fea3cf..ea94567 100644
    --- a/drivers/spi/spi_bfin5xx.c
    +++ b/drivers/spi/spi_bfin5xx.c
    @@ -162,7 +162,7 @@ static int flush(struct driver_data *drv_data)
    unsigned long limit = loops_per_jiffy << 1;

    /* wait for stop and clear stat */
    - while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && limit--)
    + while (!(read_STAT(drv_data) & BIT_STAT_SPIF) && --limit)
    cpu_relax();

    write_STAT(drv_data, BIT_STAT_CLR);

    \
     
     \ /
      Last update: 2009-02-08 16:57    [W:0.021 / U:0.604 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site