diff options
author | Wolfram Sang <wsa@the-dreams.de> | 2014-02-13 15:36:33 -0500 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2014-03-10 12:23:23 -0400 |
commit | 485ecdf1f491af82716a3a53740962e7baa50629 (patch) | |
tree | bae60ab22707c249179fa5cf8809ad2637a59192 | |
parent | b0200abeba3134002819c92dfef5e16c8e92f7e2 (diff) |
i2c: mv64xxx: refactor initialization for new msgs
We now have a central place to put this code to.
Tested-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r-- | drivers/i2c/busses/i2c-mv64xxx.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 6cb5d2f93d59..eb76491a301e 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -178,11 +178,6 @@ mv64xxx_i2c_prepare_for_io(struct mv64xxx_i2c_data *drv_data, | |||
178 | { | 178 | { |
179 | u32 dir = 0; | 179 | u32 dir = 0; |
180 | 180 | ||
181 | drv_data->msg = msg; | ||
182 | drv_data->byte_posn = 0; | ||
183 | drv_data->bytes_left = msg->len; | ||
184 | drv_data->aborting = 0; | ||
185 | drv_data->rc = 0; | ||
186 | drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK | | 181 | drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK | |
187 | MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN; | 182 | MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN; |
188 | 183 | ||
@@ -208,11 +203,6 @@ static int mv64xxx_i2c_offload_msg(struct mv64xxx_i2c_data *drv_data) | |||
208 | if (!drv_data->offload_enabled) | 203 | if (!drv_data->offload_enabled) |
209 | return -EOPNOTSUPP; | 204 | return -EOPNOTSUPP; |
210 | 205 | ||
211 | drv_data->msg = msg; | ||
212 | drv_data->byte_posn = 0; | ||
213 | drv_data->bytes_left = msg->len; | ||
214 | drv_data->aborting = 0; | ||
215 | drv_data->rc = 0; | ||
216 | /* Only regular transactions can be offloaded */ | 206 | /* Only regular transactions can be offloaded */ |
217 | if ((msg->flags & ~(I2C_M_TEN | I2C_M_RD)) != 0) | 207 | if ((msg->flags & ~(I2C_M_TEN | I2C_M_RD)) != 0) |
218 | return -EINVAL; | 208 | return -EINVAL; |
@@ -423,6 +413,12 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) | |||
423 | 413 | ||
424 | static void mv64xxx_i2c_send_start(struct mv64xxx_i2c_data *drv_data) | 414 | static void mv64xxx_i2c_send_start(struct mv64xxx_i2c_data *drv_data) |
425 | { | 415 | { |
416 | drv_data->msg = drv_data->msgs; | ||
417 | drv_data->byte_posn = 0; | ||
418 | drv_data->bytes_left = drv_data->msg->len; | ||
419 | drv_data->aborting = 0; | ||
420 | drv_data->rc = 0; | ||
421 | |||
426 | /* Can we offload this msg ? */ | 422 | /* Can we offload this msg ? */ |
427 | if (mv64xxx_i2c_offload_msg(drv_data) < 0) { | 423 | if (mv64xxx_i2c_offload_msg(drv_data) < 0) { |
428 | /* No, switch to standard path */ | 424 | /* No, switch to standard path */ |