diff options
author | Jean Delvare <khali@linux-fr.org> | 2011-11-04 07:00:47 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2011-11-04 07:00:47 -0400 |
commit | 90f4102ce59226954edbe960b2434d8b3da5f086 (patch) | |
tree | 93fd275039932253b16ea125c1ba5eea2995b719 /drivers/hwmon/lm75.c | |
parent | 371f2e083b9b081adf68d04fba4978a27dc4e618 (diff) |
hwmon: Use i2c_smbus_{read,write}_word_swapped
Make use of the new i2c_smbus_{read,write}_word_swapped functions.
This makes the driver code more compact and readable. It also ensures
proper error handling.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Dirk Eibach <eibach@gdsys.de>
Cc: "Mark M. Hoffman" <mhoffman@lightlink.com>
Cc: Guillaume Ligneul <guillaume.ligneul@gmail.com>
Diffstat (limited to 'drivers/hwmon/lm75.c')
-rw-r--r-- | drivers/hwmon/lm75.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 90126a2a1e44..1888dd0fc05f 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c | |||
@@ -384,13 +384,10 @@ static struct i2c_driver lm75_driver = { | |||
384 | */ | 384 | */ |
385 | static int lm75_read_value(struct i2c_client *client, u8 reg) | 385 | static int lm75_read_value(struct i2c_client *client, u8 reg) |
386 | { | 386 | { |
387 | int value; | ||
388 | |||
389 | if (reg == LM75_REG_CONF) | 387 | if (reg == LM75_REG_CONF) |
390 | return i2c_smbus_read_byte_data(client, reg); | 388 | return i2c_smbus_read_byte_data(client, reg); |
391 | 389 | else | |
392 | value = i2c_smbus_read_word_data(client, reg); | 390 | return i2c_smbus_read_word_swapped(client, reg); |
393 | return (value < 0) ? value : swab16(value); | ||
394 | } | 391 | } |
395 | 392 | ||
396 | static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) | 393 | static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) |
@@ -398,7 +395,7 @@ static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value) | |||
398 | if (reg == LM75_REG_CONF) | 395 | if (reg == LM75_REG_CONF) |
399 | return i2c_smbus_write_byte_data(client, reg, value); | 396 | return i2c_smbus_write_byte_data(client, reg, value); |
400 | else | 397 | else |
401 | return i2c_smbus_write_word_data(client, reg, swab16(value)); | 398 | return i2c_smbus_write_word_swapped(client, reg, value); |
402 | } | 399 | } |
403 | 400 | ||
404 | static struct lm75_data *lm75_update_device(struct device *dev) | 401 | static struct lm75_data *lm75_update_device(struct device *dev) |