lkml.org 
[lkml]   [2004]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] I2C update for 2.6.9
Date
From
ChangeSet 1.1867.7.8, 2004/09/21 16:40:19-07:00, nacc@us.ibm.com

[PATCH] i2c/i2c-mpc: replace schedule_timeout() with msleep_interruptible()

Properly orders set_current_state() and add_wait_queue(). Uses
msleep_interruptible() in place of schedule_timeout() to guarantee the
task delays as expected. Uses set_current_state() instead of direct
assignment of current->state.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


drivers/i2c/busses/i2c-mpc.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)


diff -Nru a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
--- a/drivers/i2c/busses/i2c-mpc.c 2004-10-19 16:54:50 -07:00
+++ b/drivers/i2c/busses/i2c-mpc.c 2004-10-19 16:54:50 -07:00
@@ -23,6 +23,7 @@
#include <asm/ocp.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
+#include <linux/delay.h>

#define MPC_I2C_ADDR 0x00
#define MPC_I2C_FDR 0x04
@@ -91,9 +92,9 @@
x = readb(i2c->base + MPC_I2C_SR);
writeb(0, i2c->base + MPC_I2C_SR);
} else {
+ set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&i2c->queue, &wait);
while (!(i2c->interrupt & CSR_MIF)) {
- set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current)) {
pr_debug("I2C: Interrupted\n");
result = -EINTR;
@@ -104,9 +105,9 @@
result = -EIO;
break;
}
- schedule_timeout(timeout);
+ msleep_interruptible(jiffies_to_msecs(timeout));
}
- current->state = TASK_RUNNING;
+ set_current_state(TASK_RUNNING);
remove_wait_queue(&i2c->queue, &wait);
x = i2c->interrupt;
i2c->interrupt = 0;
-
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: 2005-03-22 14:07    [W:0.809 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site