diff mbox

[07/21] i2c: efm32: make use of i2c_8bit_addr_from_msg

Message ID 20180514145330.4857-8-peda@axentia.se (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Rosin May 14, 2018, 2:53 p.m. UTC
Because it looks neater.

Signed-off-by: Peter Rosin <peda@axentia.se>
---
 drivers/i2c/busses/i2c-efm32.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Uwe Kleine-König May 14, 2018, 6:27 p.m. UTC | #1
Hello Peter,

On Mon, May 14, 2018 at 04:53:16PM +0200, Peter Rosin wrote:
> Because it looks neater.
> 
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
>  drivers/i2c/busses/i2c-efm32.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-efm32.c b/drivers/i2c/busses/i2c-efm32.c
> index aa336ba89aa3..5f2bab878b2c 100644
> --- a/drivers/i2c/busses/i2c-efm32.c
> +++ b/drivers/i2c/busses/i2c-efm32.c
> @@ -144,8 +144,7 @@ static void efm32_i2c_send_next_msg(struct efm32_i2c_ddata *ddata)
>  	struct i2c_msg *cur_msg = &ddata->msgs[ddata->current_msg];
>  
>  	efm32_i2c_write32(ddata, REG_CMD, REG_CMD_START);
> -	efm32_i2c_write32(ddata, REG_TXDATA, cur_msg->addr << 1 |
> -			(cur_msg->flags & I2C_M_RD ? 1 : 0));
> +	efm32_i2c_write32(ddata, REG_TXDATA, i2c_8bit_addr_from_msg(cur_msg));

Nice,

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards and thanks,
Uwe
diff mbox

Patch

diff --git a/drivers/i2c/busses/i2c-efm32.c b/drivers/i2c/busses/i2c-efm32.c
index aa336ba89aa3..5f2bab878b2c 100644
--- a/drivers/i2c/busses/i2c-efm32.c
+++ b/drivers/i2c/busses/i2c-efm32.c
@@ -144,8 +144,7 @@  static void efm32_i2c_send_next_msg(struct efm32_i2c_ddata *ddata)
 	struct i2c_msg *cur_msg = &ddata->msgs[ddata->current_msg];
 
 	efm32_i2c_write32(ddata, REG_CMD, REG_CMD_START);
-	efm32_i2c_write32(ddata, REG_TXDATA, cur_msg->addr << 1 |
-			(cur_msg->flags & I2C_M_RD ? 1 : 0));
+	efm32_i2c_write32(ddata, REG_TXDATA, i2c_8bit_addr_from_msg(cur_msg));
 }
 
 static void efm32_i2c_send_next_byte(struct efm32_i2c_ddata *ddata)