aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/ad7314.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/ad7314.c')
-rw-r--r--drivers/hwmon/ad7314.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c
index ce43642ef03e..f85ce70d9677 100644
--- a/drivers/hwmon/ad7314.c
+++ b/drivers/hwmon/ad7314.c
@@ -47,7 +47,7 @@ struct ad7314_data {
47 u16 rx ____cacheline_aligned; 47 u16 rx ____cacheline_aligned;
48}; 48};
49 49
50static int ad7314_spi_read(struct ad7314_data *chip, s16 *data) 50static int ad7314_spi_read(struct ad7314_data *chip)
51{ 51{
52 int ret; 52 int ret;
53 53
@@ -57,9 +57,7 @@ static int ad7314_spi_read(struct ad7314_data *chip, s16 *data)
57 return ret; 57 return ret;
58 } 58 }
59 59
60 *data = be16_to_cpu(chip->rx); 60 return be16_to_cpu(chip->rx);
61
62 return ret;
63} 61}
64 62
65static ssize_t ad7314_show_temperature(struct device *dev, 63static ssize_t ad7314_show_temperature(struct device *dev,
@@ -70,12 +68,12 @@ static ssize_t ad7314_show_temperature(struct device *dev,
70 s16 data; 68 s16 data;
71 int ret; 69 int ret;
72 70
73 ret = ad7314_spi_read(chip, &data); 71 ret = ad7314_spi_read(chip);
74 if (ret < 0) 72 if (ret < 0)
75 return ret; 73 return ret;
76 switch (spi_get_device_id(chip->spi_dev)->driver_data) { 74 switch (spi_get_device_id(chip->spi_dev)->driver_data) {
77 case ad7314: 75 case ad7314:
78 data = (data & AD7314_TEMP_MASK) >> AD7314_TEMP_OFFSET; 76 data = (ret & AD7314_TEMP_MASK) >> AD7314_TEMP_OFFSET;
79 data = (data << 6) >> 6; 77 data = (data << 6) >> 6;
80 78
81 return sprintf(buf, "%d\n", 250 * data); 79 return sprintf(buf, "%d\n", 250 * data);
@@ -86,7 +84,7 @@ static ssize_t ad7314_show_temperature(struct device *dev,
86 * with a sign bit - which is a 14 bit 2's complement 84 * with a sign bit - which is a 14 bit 2's complement
87 * register. 1lsb - 31.25 milli degrees centigrade 85 * register. 1lsb - 31.25 milli degrees centigrade
88 */ 86 */
89 data &= ADT7301_TEMP_MASK; 87 data = ret & ADT7301_TEMP_MASK;
90 data = (data << 2) >> 2; 88 data = (data << 2) >> 2;
91 89
92 return sprintf(buf, "%d\n", 90 return sprintf(buf, "%d\n",