i2c-algo-bit: Add pre- and post-xfer hooks
[linux-2.6.git] / drivers / i2c / algos / i2c-algo-bit.c
index e25e139..e8d568c 100644 (file)
@@ -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;
 }