diff options
| author | Jean Delvare <[email protected]> | 2010-03-13 19:56:56 +0000 |
|---|---|---|
| committer | Jean Delvare <[email protected]> | 2010-03-13 19:56:56 +0000 |
| commit | 0a9c14751377a1407f5e35791e13651d2fc7801c (patch) | |
| tree | e4e524eafda521834d3d2a7fa8a6118e1bae3c32 /drivers/i2c/algos/i2c-algo-bit.c | |
| parent | at24: Init dynamic bin_attribute structures (diff) | |
| download | kernel-0a9c14751377a1407f5e35791e13651d2fc7801c.tar.gz kernel-0a9c14751377a1407f5e35791e13651d2fc7801c.zip | |
i2c-algo-bit: Add pre- and post-xfer hooks
Drivers might have to do random things before and/or after I2C
transfers. Add hooks to the i2c-algo-bit implementation to let them do
so.
Signed-off-by: Jean Delvare <[email protected]>
Cc: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/i2c/algos/i2c-algo-bit.c')
| -rw-r--r-- | drivers/i2c/algos/i2c-algo-bit.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index e25e13980af3..e8d568c3fb09 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c @@ -522,6 +522,12 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, int i, ret; unsigned short nak_ok; + if (adap->pre_xfer) { + ret = adap->pre_xfer(i2c_adap); + if (ret < 0) + return ret; + } + bit_dbg(3, &i2c_adap->dev, "emitting start condition\n"); i2c_start(adap); for (i = 0; i < num; i++) { @@ -570,6 +576,9 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, bailout: bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n"); i2c_stop(adap); + + if (adap->post_xfer) + adap->post_xfer(i2c_adap); return ret; } |
