aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2010-02-02 07:03:31 -0500
committerBen Dooks <ben-linux@fluff.org>2010-05-19 19:19:01 -0400
commitb5c80bc5d70a1ce5b071ed06dd95292b9de46f95 (patch)
treeb31d6cde6971b099e90d2fbffceb85b9f27158f6 /drivers/i2c
parentf0ec9e20bab214f4a26e6fdaaf5c2a6b2f2640d7 (diff)
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: d binderman <dcb314@hotmail.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Paul Mundt <lethal@linux-sh.org> Acked-by: Jean Delvare <khali@linux-fr.org> Cc: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-highlander.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c
index ce87a902c94d..3df1bc80f37a 100644
--- a/drivers/i2c/busses/i2c-highlander.c
+++ b/drivers/i2c/busses/i2c-highlander.c
@@ -282,7 +282,6 @@ static int highlander_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr,
282 union i2c_smbus_data *data) 282 union i2c_smbus_data *data)
283{ 283{
284 struct highlander_i2c_dev *dev = i2c_get_adapdata(adap); 284 struct highlander_i2c_dev *dev = i2c_get_adapdata(adap);
285 int read = read_write & I2C_SMBUS_READ;
286 u16 tmp; 285 u16 tmp;
287 286
288 init_completion(&dev->cmd_complete); 287 init_completion(&dev->cmd_complete);
@@ -337,11 +336,11 @@ static int highlander_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr,
337 highlander_i2c_done(dev); 336 highlander_i2c_done(dev);
338 337
339 /* Set slave address */ 338 /* Set slave address */
340 iowrite16((addr << 1) | read, dev->base + SMSMADR); 339 iowrite16((addr << 1) | read_write, dev->base + SMSMADR);
341 340
342 highlander_i2c_command(dev, command, dev->buf_len); 341 highlander_i2c_command(dev, command, dev->buf_len);
343 342
344 if (read) 343 if (read_write == I2C_SMBUS_READ)
345 return highlander_i2c_read(dev); 344 return highlander_i2c_read(dev);
346 else 345 else
347 return highlander_i2c_write(dev); 346 return highlander_i2c_write(dev);