aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorBen Gardner <bgardner@wabtec.com>2006-01-18 16:52:06 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 17:21:50 -0500
commitf933ff504f5b3f0f94b98d69d48fc8d3c1e92267 (patch)
tree8dab006c4b542ab5f856850e1884e2ac8e1c84a5 /drivers/i2c
parent16ffc5c99554bc1630bc3939e0950a75b2b1c811 (diff)
[PATCH] i2c: scx200_acb fix and speed up the poll loop
scx200_acb: Fix and speed up the poll loop Signed-off-by: Ben Gardner <bgardner@wabtec.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/scx200_acb.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
index 0ae77f84ffe8..8e646bdb556c 100644
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -47,10 +47,7 @@ static int base[MAX_DEVICES] = { 0x820, 0x840 };
47module_param_array(base, int, NULL, 0); 47module_param_array(base, int, NULL, 0);
48MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers"); 48MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers");
49 49
50/* The hardware supports interrupt driven mode too, but I haven't 50#define POLL_TIMEOUT (HZ/5)
51 implemented that. */
52#define POLLED_MODE 1
53#define POLL_TIMEOUT (HZ)
54 51
55enum scx200_acb_state { 52enum scx200_acb_state {
56 state_idle, 53 state_idle,
@@ -222,7 +219,6 @@ static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status)
222 iface->needs_reset = 1; 219 iface->needs_reset = 1;
223} 220}
224 221
225#ifdef POLLED_MODE
226static void scx200_acb_poll(struct scx200_acb_iface *iface) 222static void scx200_acb_poll(struct scx200_acb_iface *iface)
227{ 223{
228 u8 status; 224 u8 status;
@@ -235,7 +231,7 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface)
235 scx200_acb_machine(iface, status); 231 scx200_acb_machine(iface, status);
236 return; 232 return;
237 } 233 }
238 msleep(10); 234 yield();
239 } 235 }
240 236
241 dev_err(&iface->adapter.dev, "timeout in state %s\n", 237 dev_err(&iface->adapter.dev, "timeout in state %s\n",
@@ -245,7 +241,6 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface)
245 iface->result = -EIO; 241 iface->result = -EIO;
246 iface->needs_reset = 1; 242 iface->needs_reset = 1;
247} 243}
248#endif /* POLLED_MODE */
249 244
250static void scx200_acb_reset(struct scx200_acb_iface *iface) 245static void scx200_acb_reset(struct scx200_acb_iface *iface)
251{ 246{
@@ -335,12 +330,8 @@ static s32 scx200_acb_smbus_xfer(struct i2c_adapter *adapter,
335 else 330 else
336 iface->state = state_address; 331 iface->state = state_address;
337 332
338#ifdef POLLED_MODE
339 while (iface->state != state_idle) 333 while (iface->state != state_idle)
340 scx200_acb_poll(iface); 334 scx200_acb_poll(iface);
341#else /* POLLED_MODE */
342#error Interrupt driven mode not implemented
343#endif /* POLLED_MODE */
344 335
345 if (iface->needs_reset) 336 if (iface->needs_reset)
346 scx200_acb_reset(iface); 337 scx200_acb_reset(iface);