aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/chips/adm1025.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/chips/adm1025.c')
-rw-r--r--drivers/i2c/chips/adm1025.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/i2c/chips/adm1025.c b/drivers/i2c/chips/adm1025.c
index e0771a3d05c9..e452d0daf906 100644
--- a/drivers/i2c/chips/adm1025.c
+++ b/drivers/i2c/chips/adm1025.c
@@ -45,7 +45,6 @@
45 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 45 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
46 */ 46 */
47 47
48#include <linux/config.h>
49#include <linux/module.h> 48#include <linux/module.h>
50#include <linux/init.h> 49#include <linux/init.h>
51#include <linux/slab.h> 50#include <linux/slab.h>
@@ -153,19 +152,19 @@ struct adm1025_data {
153 */ 152 */
154 153
155#define show_in(offset) \ 154#define show_in(offset) \
156static ssize_t show_in##offset(struct device *dev, char *buf) \ 155static ssize_t show_in##offset(struct device *dev, struct device_attribute *attr, char *buf) \
157{ \ 156{ \
158 struct adm1025_data *data = adm1025_update_device(dev); \ 157 struct adm1025_data *data = adm1025_update_device(dev); \
159 return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \ 158 return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \
160 in_scale[offset])); \ 159 in_scale[offset])); \
161} \ 160} \
162static ssize_t show_in##offset##_min(struct device *dev, char *buf) \ 161static ssize_t show_in##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \
163{ \ 162{ \
164 struct adm1025_data *data = adm1025_update_device(dev); \ 163 struct adm1025_data *data = adm1025_update_device(dev); \
165 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \ 164 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \
166 in_scale[offset])); \ 165 in_scale[offset])); \
167} \ 166} \
168static ssize_t show_in##offset##_max(struct device *dev, char *buf) \ 167static ssize_t show_in##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \
169{ \ 168{ \
170 struct adm1025_data *data = adm1025_update_device(dev); \ 169 struct adm1025_data *data = adm1025_update_device(dev); \
171 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \ 170 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \
@@ -180,17 +179,17 @@ show_in(4);
180show_in(5); 179show_in(5);
181 180
182#define show_temp(offset) \ 181#define show_temp(offset) \
183static ssize_t show_temp##offset(struct device *dev, char *buf) \ 182static ssize_t show_temp##offset(struct device *dev, struct device_attribute *attr, char *buf) \
184{ \ 183{ \
185 struct adm1025_data *data = adm1025_update_device(dev); \ 184 struct adm1025_data *data = adm1025_update_device(dev); \
186 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \ 185 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \
187} \ 186} \
188static ssize_t show_temp##offset##_min(struct device *dev, char *buf) \ 187static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \
189{ \ 188{ \
190 struct adm1025_data *data = adm1025_update_device(dev); \ 189 struct adm1025_data *data = adm1025_update_device(dev); \
191 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[offset-1])); \ 190 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[offset-1])); \
192} \ 191} \
193static ssize_t show_temp##offset##_max(struct device *dev, char *buf) \ 192static ssize_t show_temp##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \
194{ \ 193{ \
195 struct adm1025_data *data = adm1025_update_device(dev); \ 194 struct adm1025_data *data = adm1025_update_device(dev); \
196 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[offset-1])); \ 195 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[offset-1])); \
@@ -200,7 +199,7 @@ show_temp(1);
200show_temp(2); 199show_temp(2);
201 200
202#define set_in(offset) \ 201#define set_in(offset) \
203static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \ 202static ssize_t set_in##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \
204 size_t count) \ 203 size_t count) \
205{ \ 204{ \
206 struct i2c_client *client = to_i2c_client(dev); \ 205 struct i2c_client *client = to_i2c_client(dev); \
@@ -214,7 +213,7 @@ static ssize_t set_in##offset##_min(struct device *dev, const char *buf, \
214 up(&data->update_lock); \ 213 up(&data->update_lock); \
215 return count; \ 214 return count; \
216} \ 215} \
217static ssize_t set_in##offset##_max(struct device *dev, const char *buf, \ 216static ssize_t set_in##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \
218 size_t count) \ 217 size_t count) \
219{ \ 218{ \
220 struct i2c_client *client = to_i2c_client(dev); \ 219 struct i2c_client *client = to_i2c_client(dev); \
@@ -240,7 +239,7 @@ set_in(4);
240set_in(5); 239set_in(5);
241 240
242#define set_temp(offset) \ 241#define set_temp(offset) \
243static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \ 242static ssize_t set_temp##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \
244 size_t count) \ 243 size_t count) \
245{ \ 244{ \
246 struct i2c_client *client = to_i2c_client(dev); \ 245 struct i2c_client *client = to_i2c_client(dev); \
@@ -254,7 +253,7 @@ static ssize_t set_temp##offset##_min(struct device *dev, const char *buf, \
254 up(&data->update_lock); \ 253 up(&data->update_lock); \
255 return count; \ 254 return count; \
256} \ 255} \
257static ssize_t set_temp##offset##_max(struct device *dev, const char *buf, \ 256static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \
258 size_t count) \ 257 size_t count) \
259{ \ 258{ \
260 struct i2c_client *client = to_i2c_client(dev); \ 259 struct i2c_client *client = to_i2c_client(dev); \
@@ -275,26 +274,28 @@ static DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \
275set_temp(1); 274set_temp(1);
276set_temp(2); 275set_temp(2);
277 276
278static ssize_t show_alarms(struct device *dev, char *buf) 277static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, char *buf)
279{ 278{
280 struct adm1025_data *data = adm1025_update_device(dev); 279 struct adm1025_data *data = adm1025_update_device(dev);
281 return sprintf(buf, "%u\n", data->alarms); 280 return sprintf(buf, "%u\n", data->alarms);
282} 281}
283static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); 282static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
284 283
285static ssize_t show_vid(struct device *dev, char *buf) 284static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
286{ 285{
287 struct adm1025_data *data = adm1025_update_device(dev); 286 struct adm1025_data *data = adm1025_update_device(dev);
288 return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm)); 287 return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm));
289} 288}
289/* in1_ref is deprecated in favour of cpu0_vid, remove after 2005-11-11 */
290static DEVICE_ATTR(in1_ref, S_IRUGO, show_vid, NULL); 290static DEVICE_ATTR(in1_ref, S_IRUGO, show_vid, NULL);
291static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL);
291 292
292static ssize_t show_vrm(struct device *dev, char *buf) 293static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf)
293{ 294{
294 struct adm1025_data *data = adm1025_update_device(dev); 295 struct adm1025_data *data = adm1025_update_device(dev);
295 return sprintf(buf, "%u\n", data->vrm); 296 return sprintf(buf, "%u\n", data->vrm);
296} 297}
297static ssize_t set_vrm(struct device *dev, const char *buf, size_t count) 298static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
298{ 299{
299 struct i2c_client *client = to_i2c_client(dev); 300 struct i2c_client *client = to_i2c_client(dev);
300 struct adm1025_data *data = i2c_get_clientdata(client); 301 struct adm1025_data *data = i2c_get_clientdata(client);
@@ -437,7 +438,9 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address, int kind)
437 device_create_file(&new_client->dev, &dev_attr_temp1_max); 438 device_create_file(&new_client->dev, &dev_attr_temp1_max);
438 device_create_file(&new_client->dev, &dev_attr_temp2_max); 439 device_create_file(&new_client->dev, &dev_attr_temp2_max);
439 device_create_file(&new_client->dev, &dev_attr_alarms); 440 device_create_file(&new_client->dev, &dev_attr_alarms);
441 /* in1_ref is deprecated, remove after 2005-11-11 */
440 device_create_file(&new_client->dev, &dev_attr_in1_ref); 442 device_create_file(&new_client->dev, &dev_attr_in1_ref);
443 device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
441 device_create_file(&new_client->dev, &dev_attr_vrm); 444 device_create_file(&new_client->dev, &dev_attr_vrm);
442 445
443 /* Pin 11 is either in4 (+12V) or VID4 */ 446 /* Pin 11 is either in4 (+12V) or VID4 */