Commit b5c80bc5 authored by Wolfram Sang's avatar Wolfram Sang Committed by Ben Dooks

i2c-highlander: remover superflous variable

When cppcheck found this flaw

[./i2c/busses/i2c-highlander.c:284]: (style) Warning - using char variable in bit operation

it was noted that the 'read'-variable could be simply removed as read_write can
only be 0 or 1 anyhow. So, we remove the flaw and simplify the code.
Reported-by: default avatard binderman <dcb314@hotmail.com>
Signed-off-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Acked-by: default avatarPaul Mundt <lethal@linux-sh.org>
Acked-by: default avatarJean Delvare <khali@linux-fr.org>
Cc: Ben Dooks <ben-linux@fluff.org>
parent f0ec9e20
...@@ -282,7 +282,6 @@ static int highlander_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, ...@@ -282,7 +282,6 @@ static int highlander_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr,
union i2c_smbus_data *data) union i2c_smbus_data *data)
{ {
struct highlander_i2c_dev *dev = i2c_get_adapdata(adap); struct highlander_i2c_dev *dev = i2c_get_adapdata(adap);
int read = read_write & I2C_SMBUS_READ;
u16 tmp; u16 tmp;
init_completion(&dev->cmd_complete); init_completion(&dev->cmd_complete);
...@@ -337,11 +336,11 @@ static int highlander_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, ...@@ -337,11 +336,11 @@ static int highlander_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr,
highlander_i2c_done(dev); highlander_i2c_done(dev);
/* Set slave address */ /* Set slave address */
iowrite16((addr << 1) | read, dev->base + SMSMADR); iowrite16((addr << 1) | read_write, dev->base + SMSMADR);
highlander_i2c_command(dev, command, dev->buf_len); highlander_i2c_command(dev, command, dev->buf_len);
if (read) if (read_write == I2C_SMBUS_READ)
return highlander_i2c_read(dev); return highlander_i2c_read(dev);
else else
return highlander_i2c_write(dev); return highlander_i2c_write(dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment