public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] timer clean up for i2c-keywest.c
@ 2003-07-07  7:03 Paul Mackerras
  2003-07-08 10:15 ` Benjamin Herrenschmidt
  2003-07-08 10:26 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Mackerras @ 2003-07-07  7:03 UTC (permalink / raw)
  To: greg; +Cc: linux-kernel

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);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-07-10  3:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-07  7:03 [PATCH] timer clean up for i2c-keywest.c Paul Mackerras
2003-07-08 10:15 ` Benjamin Herrenschmidt
2003-07-08 10:26 ` Benjamin Herrenschmidt
2003-07-09  9:48   ` Benjamin Herrenschmidt
2003-07-10  3:56     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox