[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>
This commit is contained in:
parent
16ffc5c995
commit
f933ff504f
1 changed files with 2 additions and 11 deletions
|
@ -47,10 +47,7 @@ static int base[MAX_DEVICES] = { 0x820, 0x840 };
|
||||||
module_param_array(base, int, NULL, 0);
|
module_param_array(base, int, NULL, 0);
|
||||||
MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers");
|
MODULE_PARM_DESC(base, "Base addresses for the ACCESS.bus controllers");
|
||||||
|
|
||||||
/* The hardware supports interrupt driven mode too, but I haven't
|
#define POLL_TIMEOUT (HZ/5)
|
||||||
implemented that. */
|
|
||||||
#define POLLED_MODE 1
|
|
||||||
#define POLL_TIMEOUT (HZ)
|
|
||||||
|
|
||||||
enum scx200_acb_state {
|
enum scx200_acb_state {
|
||||||
state_idle,
|
state_idle,
|
||||||
|
@ -222,7 +219,6 @@ static void scx200_acb_machine(struct scx200_acb_iface *iface, u8 status)
|
||||||
iface->needs_reset = 1;
|
iface->needs_reset = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef POLLED_MODE
|
|
||||||
static void scx200_acb_poll(struct scx200_acb_iface *iface)
|
static void scx200_acb_poll(struct scx200_acb_iface *iface)
|
||||||
{
|
{
|
||||||
u8 status;
|
u8 status;
|
||||||
|
@ -235,7 +231,7 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface)
|
||||||
scx200_acb_machine(iface, status);
|
scx200_acb_machine(iface, status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
msleep(10);
|
yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_err(&iface->adapter.dev, "timeout in state %s\n",
|
dev_err(&iface->adapter.dev, "timeout in state %s\n",
|
||||||
|
@ -245,7 +241,6 @@ static void scx200_acb_poll(struct scx200_acb_iface *iface)
|
||||||
iface->result = -EIO;
|
iface->result = -EIO;
|
||||||
iface->needs_reset = 1;
|
iface->needs_reset = 1;
|
||||||
}
|
}
|
||||||
#endif /* POLLED_MODE */
|
|
||||||
|
|
||||||
static void scx200_acb_reset(struct scx200_acb_iface *iface)
|
static void scx200_acb_reset(struct scx200_acb_iface *iface)
|
||||||
{
|
{
|
||||||
|
@ -335,12 +330,8 @@ static s32 scx200_acb_smbus_xfer(struct i2c_adapter *adapter,
|
||||||
else
|
else
|
||||||
iface->state = state_address;
|
iface->state = state_address;
|
||||||
|
|
||||||
#ifdef POLLED_MODE
|
|
||||||
while (iface->state != state_idle)
|
while (iface->state != state_idle)
|
||||||
scx200_acb_poll(iface);
|
scx200_acb_poll(iface);
|
||||||
#else /* POLLED_MODE */
|
|
||||||
#error Interrupt driven mode not implemented
|
|
||||||
#endif /* POLLED_MODE */
|
|
||||||
|
|
||||||
if (iface->needs_reset)
|
if (iface->needs_reset)
|
||||||
scx200_acb_reset(iface);
|
scx200_acb_reset(iface);
|
||||||
|
|
Loading…
Add table
Reference in a new issue