Commit 404596e8 authored by Dave Jiang's avatar Dave Jiang Committed by Greg Kroah-Hartman

[PATCH] I2C: IOP3xx i2c driver update

  Here's a small patch update to the i2c-iop3xx.c in
drivers/i2c/busses/. It fixes some functions' return value and updated
the irq handler to be compatible with kernel 2.6. Thanks!
parent 30678638
...@@ -129,7 +129,7 @@ static void iop3xx_adap_final_cleanup(struct i2c_algo_iop3xx_data *iop3xx_adap) ...@@ -129,7 +129,7 @@ static void iop3xx_adap_final_cleanup(struct i2c_algo_iop3xx_data *iop3xx_adap)
* NB: the handler has to clear the source of the interrupt! * NB: the handler has to clear the source of the interrupt!
* Then it passes the SR flags of interest to BH via adap data * Then it passes the SR flags of interest to BH via adap data
*/ */
static void iop3xx_i2c_handler(int this_irq, static irqreturn_t iop3xx_i2c_handler(int this_irq,
void *dev_id, void *dev_id,
struct pt_regs *regs) struct pt_regs *regs)
{ {
...@@ -142,6 +142,7 @@ static void iop3xx_i2c_handler(int this_irq, ...@@ -142,6 +142,7 @@ static void iop3xx_i2c_handler(int this_irq,
iop3xx_adap->biu->SR_received |= sr; iop3xx_adap->biu->SR_received |= sr;
wake_up_interruptible(&iop3xx_adap->waitq); wake_up_interruptible(&iop3xx_adap->waitq);
} }
return IRQ_HANDLED;
} }
/* check all error conditions, clear them , report most important */ /* check all error conditions, clear them , report most important */
...@@ -185,7 +186,7 @@ static int iop3xx_adap_wait_event(struct i2c_algo_iop3xx_data *iop3xx_adap, ...@@ -185,7 +186,7 @@ static int iop3xx_adap_wait_event(struct i2c_algo_iop3xx_data *iop3xx_adap,
unsigned sr = 0; unsigned sr = 0;
int interrupted; int interrupted;
int done; int done;
int rc; int rc = 0;
do { do {
interrupted = wait_event_interruptible_timeout ( interrupted = wait_event_interruptible_timeout (
...@@ -198,13 +199,13 @@ static int iop3xx_adap_wait_event(struct i2c_algo_iop3xx_data *iop3xx_adap, ...@@ -198,13 +199,13 @@ static int iop3xx_adap_wait_event(struct i2c_algo_iop3xx_data *iop3xx_adap,
return rc; return rc;
}else if (!interrupted) { }else if (!interrupted) {
*status = sr; *status = sr;
return rc = -ETIMEDOUT; return -ETIMEDOUT;
} }
} while(!done); } while(!done);
*status = sr; *status = sr;
return rc = 0; return 0;
} }
/* /*
...@@ -284,7 +285,7 @@ static int iop3xx_adap_write_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char ...@@ -284,7 +285,7 @@ static int iop3xx_adap_write_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char
{ {
unsigned cr = *iop3xx_adap->biu->CR; unsigned cr = *iop3xx_adap->biu->CR;
int status; int status;
int rc; int rc = 0;
*iop3xx_adap->biu->DBR = byte; *iop3xx_adap->biu->DBR = byte;
cr &= ~IOP321_ICR_MSTART; cr &= ~IOP321_ICR_MSTART;
...@@ -304,7 +305,7 @@ static int iop3xx_adap_read_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, ...@@ -304,7 +305,7 @@ static int iop3xx_adap_read_byte(struct i2c_algo_iop3xx_data *iop3xx_adap,
{ {
unsigned cr = *iop3xx_adap->biu->CR; unsigned cr = *iop3xx_adap->biu->CR;
int status; int status;
int rc; int rc = 0;
cr &= ~IOP321_ICR_MSTART; cr &= ~IOP321_ICR_MSTART;
...@@ -386,13 +387,16 @@ static int iop3xx_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[ ...@@ -386,13 +387,16 @@ static int iop3xx_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[
iop3xx_adap_reset(iop3xx_adap); iop3xx_adap_reset(iop3xx_adap);
iop3xx_adap_enable(iop3xx_adap); iop3xx_adap_enable(iop3xx_adap);
for (im = 0; ret == 0 && im != num; ++im) { for (im = 0; ret == 0 && im != num; im++) {
ret = iop3xx_handle_msg(i2c_adap, &msgs[im]); ret = iop3xx_handle_msg(i2c_adap, &msgs[im]);
} }
iop3xx_adap_transaction_cleanup(iop3xx_adap); iop3xx_adap_transaction_cleanup(iop3xx_adap);
if(ret)
return ret; return ret;
return im;
} }
static int algo_control(struct i2c_adapter *adapter, unsigned int cmd, static int algo_control(struct i2c_adapter *adapter, unsigned int cmd,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment