diff options
| author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-04-27 08:44:34 +0100 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-04-27 08:44:34 +0100 |
| commit | 167f829752f9cef51f59cc500abc0ad6ba69f5cb (patch) | |
| tree | d3ec172cdd864c748bea2c014943fc13873fefc0 /drivers/i2c/algos/i2c-algo-bit.c | |
| parent | e04d6c53a58cee3380adaa66fe2eeffbd82d213c (diff) | |
| parent | 45b146d746ea1b7f87b023a79d5186d0e87793eb (diff) | |
| download | olio-linux-3.10-167f829752f9cef51f59cc500abc0ad6ba69f5cb.tar.xz olio-linux-3.10-167f829752f9cef51f59cc500abc0ad6ba69f5cb.zip | |
Merge branch 'davinci-fixes' of git://gitorious.org/linux-davinci/linux-davinci into fixes
Diffstat (limited to 'drivers/i2c/algos/i2c-algo-bit.c')
| -rw-r--r-- | drivers/i2c/algos/i2c-algo-bit.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index 38319a69bd0..d6d58684712 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c @@ -232,9 +232,17 @@ static int i2c_inb(struct i2c_adapter *i2c_adap) * Sanity check for the adapter hardware - check the reaction of * the bus lines only if it seems to be idle. */ -static int test_bus(struct i2c_algo_bit_data *adap, char *name) +static int test_bus(struct i2c_adapter *i2c_adap) { - int scl, sda; + struct i2c_algo_bit_data *adap = i2c_adap->algo_data; + const char *name = i2c_adap->name; + int scl, sda, ret; + + if (adap->pre_xfer) { + ret = adap->pre_xfer(i2c_adap); + if (ret < 0) + return -ENODEV; + } if (adap->getscl == NULL) pr_info("%s: Testing SDA only, SCL is not readable\n", name); @@ -297,11 +305,19 @@ static int test_bus(struct i2c_algo_bit_data *adap, char *name) "while pulling SCL high!\n", name); goto bailout; } + + if (adap->post_xfer) + adap->post_xfer(i2c_adap); + pr_info("%s: Test OK\n", name); return 0; bailout: sdahi(adap); sclhi(adap); + + if (adap->post_xfer) + adap->post_xfer(i2c_adap); + return -ENODEV; } @@ -607,7 +623,7 @@ static int __i2c_bit_add_bus(struct i2c_adapter *adap, int ret; if (bit_test) { - ret = test_bus(bit_adap, adap->name); + ret = test_bus(adap); if (ret < 0) return -ENODEV; } |