Messages in this thread Patch in this message | | | Date | Mon, 7 Jul 2003 17:03:00 +1000 | From | Paul Mackerras <> | Subject | [PATCH] timer clean up for i2c-keywest.c |
| |
This patch changes i2c-keywest.c to use mod_timer instead of a two-line sequence to compute .expires and call add_timer in 3 places. Without this patch I get a BUG from time to time in add_timer.
Paul.
diff -urN linux-2.5/drivers/i2c/i2c-keywest.c pmac-2.5/drivers/i2c/i2c-keywest.c --- linux-2.5/drivers/i2c/i2c-keywest.c 2003-05-07 14:25:43.000000000 +1000 +++ pmac-2.5/drivers/i2c/i2c-keywest.c 2003-06-15 13:26:59.000000000 +1000 @@ -220,10 +220,8 @@ spin_lock(&iface->lock); del_timer(&iface->timeout_timer); handle_interrupt(iface, read_reg(reg_isr)); - if (iface->state != state_idle) { - iface->timeout_timer.expires = jiffies + POLL_TIMEOUT; - add_timer(&iface->timeout_timer); - } + if (iface->state != state_idle) + mod_timer(&iface->timeout_timer, jiffies + POLL_TIMEOUT); spin_unlock(&iface->lock); return IRQ_HANDLED; } @@ -331,8 +329,7 @@ write_reg(reg_subaddr, command); /* Arm timeout */ - iface->timeout_timer.expires = jiffies + POLL_TIMEOUT; - add_timer(&iface->timeout_timer); + mod_timer(&iface->timeout_timer, jiffies + POLL_TIMEOUT); /* Start sending address & enable interrupt*/ write_reg(reg_control, read_reg(reg_control) | KW_I2C_CTL_XADDR); @@ -421,8 +418,7 @@ ((iface->read_write == I2C_SMBUS_READ) ? 0x01 : 0x00)); /* Arm timeout */ - iface->timeout_timer.expires = jiffies + POLL_TIMEOUT; - add_timer(&iface->timeout_timer); + mod_timer(&iface->timeout_timer, jiffies + POLL_TIMEOUT); /* Start sending address & enable interrupt*/ write_reg(reg_control, read_reg(reg_control) | KW_I2C_CTL_XADDR); - 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/
| |