aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips/lm77.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/chips/lm77.c')
-rw-r--r--drivers/i2c/chips/lm77.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/i2c/chips/lm77.c b/drivers/i2c/chips/lm77.c
index f56b7a37de75..b98f44952997 100644
--- a/drivers/i2c/chips/lm77.c
+++ b/drivers/i2c/chips/lm77.c
@@ -25,7 +25,6 @@
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26*/ 26*/
27 27
28#include <linux/config.h>
29#include <linux/module.h> 28#include <linux/module.h>
30#include <linux/init.h> 29#include <linux/init.h>
31#include <linux/slab.h> 30#include <linux/slab.h>
@@ -103,7 +102,7 @@ static inline int LM77_TEMP_FROM_REG(u16 reg)
103 102
104/* read routines for temperature limits */ 103/* read routines for temperature limits */
105#define show(value) \ 104#define show(value) \
106static ssize_t show_##value(struct device *dev, char *buf) \ 105static ssize_t show_##value(struct device *dev, struct device_attribute *attr, char *buf) \
107{ \ 106{ \
108 struct lm77_data *data = lm77_update_device(dev); \ 107 struct lm77_data *data = lm77_update_device(dev); \
109 return sprintf(buf, "%d\n", data->value); \ 108 return sprintf(buf, "%d\n", data->value); \
@@ -116,17 +115,17 @@ show(temp_max);
116show(alarms); 115show(alarms);
117 116
118/* read routines for hysteresis values */ 117/* read routines for hysteresis values */
119static ssize_t show_temp_crit_hyst(struct device *dev, char *buf) 118static ssize_t show_temp_crit_hyst(struct device *dev, struct device_attribute *attr, char *buf)
120{ 119{
121 struct lm77_data *data = lm77_update_device(dev); 120 struct lm77_data *data = lm77_update_device(dev);
122 return sprintf(buf, "%d\n", data->temp_crit - data->temp_hyst); 121 return sprintf(buf, "%d\n", data->temp_crit - data->temp_hyst);
123} 122}
124static ssize_t show_temp_min_hyst(struct device *dev, char *buf) 123static ssize_t show_temp_min_hyst(struct device *dev, struct device_attribute *attr, char *buf)
125{ 124{
126 struct lm77_data *data = lm77_update_device(dev); 125 struct lm77_data *data = lm77_update_device(dev);
127 return sprintf(buf, "%d\n", data->temp_min + data->temp_hyst); 126 return sprintf(buf, "%d\n", data->temp_min + data->temp_hyst);
128} 127}
129static ssize_t show_temp_max_hyst(struct device *dev, char *buf) 128static ssize_t show_temp_max_hyst(struct device *dev, struct device_attribute *attr, char *buf)
130{ 129{
131 struct lm77_data *data = lm77_update_device(dev); 130 struct lm77_data *data = lm77_update_device(dev);
132 return sprintf(buf, "%d\n", data->temp_max - data->temp_hyst); 131 return sprintf(buf, "%d\n", data->temp_max - data->temp_hyst);
@@ -134,7 +133,7 @@ static ssize_t show_temp_max_hyst(struct device *dev, char *buf)
134 133
135/* write routines */ 134/* write routines */
136#define set(value, reg) \ 135#define set(value, reg) \
137static ssize_t set_##value(struct device *dev, const char *buf, size_t count) \ 136static ssize_t set_##value(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
138{ \ 137{ \
139 struct i2c_client *client = to_i2c_client(dev); \ 138 struct i2c_client *client = to_i2c_client(dev); \
140 struct lm77_data *data = i2c_get_clientdata(client); \ 139 struct lm77_data *data = i2c_get_clientdata(client); \
@@ -152,7 +151,7 @@ set(temp_max, LM77_REG_TEMP_MAX);
152 151
153/* hysteresis is stored as a relative value on the chip, so it has to be 152/* hysteresis is stored as a relative value on the chip, so it has to be
154 converted first */ 153 converted first */
155static ssize_t set_temp_crit_hyst(struct device *dev, const char *buf, size_t count) 154static ssize_t set_temp_crit_hyst(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
156{ 155{
157 struct i2c_client *client = to_i2c_client(dev); 156 struct i2c_client *client = to_i2c_client(dev);
158 struct lm77_data *data = i2c_get_clientdata(client); 157 struct lm77_data *data = i2c_get_clientdata(client);
@@ -167,7 +166,7 @@ static ssize_t set_temp_crit_hyst(struct device *dev, const char *buf, size_t co
167} 166}
168 167
169/* preserve hysteresis when setting T_crit */ 168/* preserve hysteresis when setting T_crit */
170static ssize_t set_temp_crit(struct device *dev, const char *buf, size_t count) 169static ssize_t set_temp_crit(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
171{ 170{
172 struct i2c_client *client = to_i2c_client(dev); 171 struct i2c_client *client = to_i2c_client(dev);
173 struct lm77_data *data = i2c_get_clientdata(client); 172 struct lm77_data *data = i2c_get_clientdata(client);