diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-09-27 22:16:47 (GMT) |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-09-27 22:16:47 (GMT) |
commit | 3b9f6cb8a1ec791be79c6c7595fea922f12d1e64 (patch) | |
tree | 2393a448add846e6c2ed12f68106c3018b72c6a9 /drivers/i2c/algos/i2c-algo-bit.c | |
parent | c38778c3a9aeadcd1ee319cfc8ea5a9cbf8cdafa (diff) | |
parent | a77c64c1a641950626181b4857abb701d8f38ccc (diff) | |
download | linux-fsl-qoriq-3b9f6cb8a1ec791be79c6c7595fea922f12d1e64.tar.xz |
Merge branch 'master' into upstream
Diffstat (limited to 'drivers/i2c/algos/i2c-algo-bit.c')
-rw-r--r-- | drivers/i2c/algos/i2c-algo-bit.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index ab230c0..21c36bf 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c @@ -76,17 +76,15 @@ static inline void scllo(struct i2c_algo_bit_data *adap) * Raise scl line, and do checking for delays. This is necessary for slower * devices. */ -static inline int sclhi(struct i2c_algo_bit_data *adap) +static int sclhi(struct i2c_algo_bit_data *adap) { unsigned long start; setscl(adap,1); /* Not all adapters have scl sense line... */ - if (adap->getscl == NULL ) { - udelay(adap->udelay); - return 0; - } + if (!adap->getscl) + goto done; start=jiffies; while (! getscl(adap) ) { @@ -101,6 +99,8 @@ static inline int sclhi(struct i2c_algo_bit_data *adap) cond_resched(); } DEBSTAT(printk(KERN_DEBUG "needed %ld jiffies\n", jiffies-start)); + +done: udelay(adap->udelay); return 0; } @@ -121,7 +121,6 @@ static void i2c_repstart(struct i2c_algo_bit_data *adap) DEBPROTO(printk(" Sr ")); setsda(adap,1); sclhi(adap); - udelay(adap->udelay); sdalo(adap); scllo(adap); @@ -306,7 +305,7 @@ bailout: * 0 chip did not answer * -x transmission error */ -static inline int try_address(struct i2c_adapter *i2c_adap, +static int try_address(struct i2c_adapter *i2c_adap, unsigned char addr, int retries) { struct i2c_algo_bit_data *adap = i2c_adap->algo_data; @@ -354,15 +353,11 @@ static int sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) return (retval<0)? retval : -EFAULT; /* got a better one ?? */ } -#if 0 - /* from asm/delay.h */ - __delay(adap->mdelay * (loops_per_sec / 1000) ); -#endif } return wrcount; } -static inline int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) +static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) { int inval; int rdcount=0; /* counts bytes read */ @@ -412,7 +407,7 @@ static inline int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) * -x an error occurred (like: -EREMOTEIO if the device did not answer, or * -ETIMEDOUT, for example if the lines are stuck...) */ -static inline int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) +static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) { unsigned short flags = msg->flags; unsigned short nak_ok = msg->flags & I2C_M_IGNORE_NAK; @@ -517,7 +512,7 @@ static u32 bit_func(struct i2c_adapter *adap) /* -----exported algorithm data: ------------------------------------- */ -static struct i2c_algorithm i2c_bit_algo = { +static const struct i2c_algorithm i2c_bit_algo = { .master_xfer = bit_xfer, .functionality = bit_func, }; |