lkml.org 
[lkml]   [2007]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 067/101] Fix %100 cpu spinning on sparc64
    From: David Miller <davem@davemloft.net>

    [SPARC64] bbc_i2c: Fix kenvctrld eating %100 cpu.

    Based almost entirely upon a patch by Joerg Friedrich

    Signed-off-by: David S. Miller <davem@davemloft.net>

    ---
    drivers/sbus/char/bbc_i2c.c | 15 ++++++++-------
    1 file changed, 8 insertions(+), 7 deletions(-)

    --- linux-2.6.20.1.orig/drivers/sbus/char/bbc_i2c.c
    +++ linux-2.6.20.1/drivers/sbus/char/bbc_i2c.c
    @@ -187,19 +187,20 @@ static int wait_for_pin(struct bbc_i2c_b
    bp->waiting = 1;
    add_wait_queue(&bp->wq, &wait);
    while (limit-- > 0) {
    - u8 val;
    + unsigned long val;

    - set_current_state(TASK_INTERRUPTIBLE);
    - *status = val = readb(bp->i2c_control_regs + 0);
    - if ((val & I2C_PCF_PIN) == 0) {
    + val = wait_event_interruptible_timeout(
    + bp->wq,
    + (((*status = readb(bp->i2c_control_regs + 0))
    + & I2C_PCF_PIN) == 0),
    + msecs_to_jiffies(250));
    + if (val > 0) {
    ret = 0;
    break;
    }
    - msleep_interruptible(250);
    }
    remove_wait_queue(&bp->wq, &wait);
    bp->waiting = 0;
    - current->state = TASK_RUNNING;

    return ret;
    }
    @@ -340,7 +341,7 @@ static irqreturn_t bbc_i2c_interrupt(int
    */
    if (bp->waiting &&
    !(readb(bp->i2c_control_regs + 0x0) & I2C_PCF_PIN))
    - wake_up(&bp->wq);
    + wake_up_interruptible(&bp->wq);

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

    \
     
     \ /
      Last update: 2007-03-07 18:47    [W:4.193 / U:0.040 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site