From: Paul Mackerras <paulus@samba.org>
To: greg@kroah.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] timer clean up for i2c-keywest.c
Date: Mon, 7 Jul 2003 17:03:00 +1000 [thread overview]
Message-ID: <16137.6948.764603.59450@cargo.ozlabs.ibm.com> (raw)
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);
next reply other threads:[~2003-07-07 6:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-07 7:03 Paul Mackerras [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16137.6948.764603.59450@cargo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®