i2c-algo-bit: Cleanups
i2c-algo-bit: Cleanups * Uninline long functions (saves around 1 kB or 15%) * Refactor code in sclhi() * Drop redundant udelay on repeated start Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8202632647
commit
7b288a018a
@@ -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
|
* Raise scl line, and do checking for delays. This is necessary for slower
|
||||||
* devices.
|
* devices.
|
||||||
*/
|
*/
|
||||||
static inline int sclhi(struct i2c_algo_bit_data *adap)
|
static int sclhi(struct i2c_algo_bit_data *adap)
|
||||||
{
|
{
|
||||||
unsigned long start;
|
unsigned long start;
|
||||||
|
|
||||||
setscl(adap,1);
|
setscl(adap,1);
|
||||||
|
|
||||||
/* Not all adapters have scl sense line... */
|
/* Not all adapters have scl sense line... */
|
||||||
if (adap->getscl == NULL ) {
|
if (!adap->getscl)
|
||||||
udelay(adap->udelay);
|
goto done;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
start=jiffies;
|
start=jiffies;
|
||||||
while (! getscl(adap) ) {
|
while (! getscl(adap) ) {
|
||||||
@@ -101,6 +99,8 @@ static inline int sclhi(struct i2c_algo_bit_data *adap)
|
|||||||
cond_resched();
|
cond_resched();
|
||||||
}
|
}
|
||||||
DEBSTAT(printk(KERN_DEBUG "needed %ld jiffies\n", jiffies-start));
|
DEBSTAT(printk(KERN_DEBUG "needed %ld jiffies\n", jiffies-start));
|
||||||
|
|
||||||
|
done:
|
||||||
udelay(adap->udelay);
|
udelay(adap->udelay);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,6 @@ static void i2c_repstart(struct i2c_algo_bit_data *adap)
|
|||||||
DEBPROTO(printk(" Sr "));
|
DEBPROTO(printk(" Sr "));
|
||||||
setsda(adap,1);
|
setsda(adap,1);
|
||||||
sclhi(adap);
|
sclhi(adap);
|
||||||
udelay(adap->udelay);
|
|
||||||
|
|
||||||
sdalo(adap);
|
sdalo(adap);
|
||||||
scllo(adap);
|
scllo(adap);
|
||||||
@@ -306,7 +305,7 @@ bailout:
|
|||||||
* 0 chip did not answer
|
* 0 chip did not answer
|
||||||
* -x transmission error
|
* -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)
|
unsigned char addr, int retries)
|
||||||
{
|
{
|
||||||
struct i2c_algo_bit_data *adap = i2c_adap->algo_data;
|
struct i2c_algo_bit_data *adap = i2c_adap->algo_data;
|
||||||
@@ -358,7 +357,7 @@ static int sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
|
|||||||
return wrcount;
|
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 inval;
|
||||||
int rdcount=0; /* counts bytes read */
|
int rdcount=0; /* counts bytes read */
|
||||||
@@ -408,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
|
* -x an error occurred (like: -EREMOTEIO if the device did not answer, or
|
||||||
* -ETIMEDOUT, for example if the lines are stuck...)
|
* -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 flags = msg->flags;
|
||||||
unsigned short nak_ok = msg->flags & I2C_M_IGNORE_NAK;
|
unsigned short nak_ok = msg->flags & I2C_M_IGNORE_NAK;
|
||||||
|
Reference in New Issue
Block a user