[03/21] i2c: algo: pcf: make use of i2c_8bit_addr_from_msg

Message ID 20180514145330.4857-4-peda@axentia.se
State Superseded
Headers show
Series
  • i2c: make use of i2c_8bit_addr_from_msg
Related show

Commit Message

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

Signed-off-by: Peter Rosin <peda@axentia.se>
---
 drivers/i2c/algos/i2c-algo-pcf.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Andy Shevchenko May 14, 2018, 4:59 p.m. | #1
On Mon, May 14, 2018 at 5:53 PM, Peter Rosin <peda@axentia.se> wrote:
> Because it looks neater.

>  drivers/i2c/algos/i2c-algo-pcf.c | 5 +----

I guess for such trivial no functional change patches you may do them
one per folder, and not one-per driver.
Peter Rosin May 14, 2018, 5:03 p.m. | #2
On 2018-05-14 18:59, Andy Shevchenko wrote:
> On Mon, May 14, 2018 at 5:53 PM, Peter Rosin <peda@axentia.se> wrote:
>> Because it looks neater.
> 
>>  drivers/i2c/algos/i2c-algo-pcf.c | 5 +----
> 
> I guess for such trivial no functional change patches you may do them
> one per folder, and not one-per driver.

Right, will do for v2, if I don't hear anything else...

Cheers,
Peter

Patch

diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c
index 270d84bfc2c6..bb60c1bd1f2d 100644
--- a/drivers/i2c/algos/i2c-algo-pcf.c
+++ b/drivers/i2c/algos/i2c-algo-pcf.c
@@ -292,11 +292,8 @@  static int pcf_doAddress(struct i2c_algo_pcf_data *adap,
 			 struct i2c_msg *msg)
 {
 	unsigned short flags = msg->flags;
-	unsigned char addr;
+	unsigned char addr = i2c_8bit_addr_from_msg(msg);
 
-	addr = msg->addr << 1;
-	if (flags & I2C_M_RD)
-		addr |= 1;
 	if (flags & I2C_M_REV_DIR_ADDR)
 		addr ^= 1;
 	i2c_outb(adap, addr);