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>
This commit is contained in:

committed by
Jean Delvare

vanhempi
371f2e083b
commit
90f4102ce5
@@ -58,10 +58,9 @@ static inline int ad7414_temp_from_reg(s16 reg)
|
||||
|
||||
static inline int ad7414_read(struct i2c_client *client, u8 reg)
|
||||
{
|
||||
if (reg == AD7414_REG_TEMP) {
|
||||
int value = i2c_smbus_read_word_data(client, reg);
|
||||
return (value < 0) ? value : swab16(value);
|
||||
} else
|
||||
if (reg == AD7414_REG_TEMP)
|
||||
return i2c_smbus_read_word_swapped(client, reg);
|
||||
else
|
||||
return i2c_smbus_read_byte_data(client, reg);
|
||||
}
|
||||
|
||||
|
Viittaa uudesa ongelmassa
Block a user