aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/max16065.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2011-11-04 07:00:47 -0400
committerJean Delvare <khali@endymion.delvare>2011-11-04 07:00:47 -0400
commit90f4102ce59226954edbe960b2434d8b3da5f086 (patch)
tree93fd275039932253b16ea125c1ba5eea2995b719 /drivers/hwmon/max16065.c
parent371f2e083b9b081adf68d04fba4978a27dc4e618 (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/max16065.c')
-rw-r--r--drivers/hwmon/max16065.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/max16065.c b/drivers/hwmon/max16065.c
index dd2d7b9620c2..385886a4f224 100644
--- a/drivers/hwmon/max16065.c
+++ b/drivers/hwmon/max16065.c
@@ -137,10 +137,10 @@ static int max16065_read_adc(struct i2c_client *client, int reg)
137{ 137{
138 int rv; 138 int rv;
139 139
140 rv = i2c_smbus_read_word_data(client, reg); 140 rv = i2c_smbus_read_word_swapped(client, reg);
141 if (unlikely(rv < 0)) 141 if (unlikely(rv < 0))
142 return rv; 142 return rv;
143 return ((rv & 0xff) << 2) | ((rv >> 14) & 0x03); 143 return rv >> 6;
144} 144}
145 145
146static struct max16065_data *max16065_update_device(struct device *dev) 146static struct max16065_data *max16065_update_device(struct device *dev)