aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/pc87360.c
diff options
context:
space:
mode:
authorJim Cromie <jim.cromie@gmail.com>2005-09-02 16:52:43 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-05 12:26:54 -0400
commitf0986bd8f390392948db85dac526fb238752372b (patch)
tree2d4851d8d17ac9576ca8dbd223ee378700475bbe /drivers/hwmon/pc87360.c
parenta89923fff79f8eeed0ccdf51e13453754e48a71e (diff)
[PATCH] hwmon: (1/3) pc87360 driver update
Use the new "dynamic sysfs callbacks", as introduced recently by Yani Ioannou, in pc87360. Note that this change isn't indiscriminate. Only those attributes that would benefit from having an index (i.e., those which are macro-repeated) have been converted. This significantly shrinks the size of the module: before: 49235 drivers/hwmon/pc87360.ko after: 32532 drivers/hwmon/pc87360.ko Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/pc87360.c')
-rw-r--r--drivers/hwmon/pc87360.c775
1 files changed, 405 insertions, 370 deletions
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c
index 08fcb5aea764..2e5a659db58c 100644
--- a/drivers/hwmon/pc87360.c
+++ b/drivers/hwmon/pc87360.c
@@ -40,6 +40,7 @@
40#include <linux/i2c.h> 40#include <linux/i2c.h>
41#include <linux/i2c-isa.h> 41#include <linux/i2c-isa.h>
42#include <linux/hwmon.h> 42#include <linux/hwmon.h>
43#include <linux/hwmon-sysfs.h>
43#include <linux/hwmon-vid.h> 44#include <linux/hwmon-vid.h>
44#include <linux/err.h> 45#include <linux/err.h>
45#include <asm/io.h> 46#include <asm/io.h>
@@ -245,7 +246,7 @@ static struct i2c_driver pc87360_driver = {
245 * Sysfs stuff 246 * Sysfs stuff
246 */ 247 */
247 248
248static ssize_t set_fan_min(struct device *dev, const char *buf, 249static ssize_t _set_fan_min(struct device *dev, const char *buf,
249 size_t count, int nr) 250 size_t count, int nr)
250{ 251{
251 struct i2c_client *client = to_i2c_client(dev); 252 struct i2c_client *client = to_i2c_client(dev);
@@ -274,139 +275,155 @@ static ssize_t set_fan_min(struct device *dev, const char *buf,
274 return count; 275 return count;
275} 276}
276 277
278static ssize_t show_fan_input(struct device *dev, struct device_attribute *devattr, char *buf)
279{
280 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
281 struct pc87360_data *data = pc87360_update_device(dev);
282 return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan[attr->index-1],
283 FAN_DIV_FROM_REG(data->fan_status[attr->index-1])));
284}
285static ssize_t show_fan_min(struct device *dev, struct device_attribute *devattr, char *buf)
286{
287 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
288 struct pc87360_data *data = pc87360_update_device(dev);
289 return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan_min[attr->index-1],
290 FAN_DIV_FROM_REG(data->fan_status[attr->index-1])));
291}
292static ssize_t show_fan_div(struct device *dev, struct device_attribute *devattr, char *buf)
293{
294 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
295 struct pc87360_data *data = pc87360_update_device(dev);
296 return sprintf(buf, "%u\n",
297 FAN_DIV_FROM_REG(data->fan_status[attr->index-1]));
298}
299static ssize_t show_fan_status(struct device *dev, struct device_attribute *devattr, char *buf)
300{
301 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
302 struct pc87360_data *data = pc87360_update_device(dev);
303 return sprintf(buf, "%u\n",
304 FAN_STATUS_FROM_REG(data->fan_status[attr->index-1]));
305}
306static ssize_t set_fan_min(struct device *dev, struct device_attribute *devattr, const char *buf,
307 size_t count)
308{
309 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
310 return _set_fan_min(dev, buf, count, attr->index-1);
311}
312
277#define show_and_set_fan(offset) \ 313#define show_and_set_fan(offset) \
278static ssize_t show_fan##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ 314static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \
279{ \ 315 show_fan_input, NULL, offset); \
280 struct pc87360_data *data = pc87360_update_device(dev); \ 316static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IWUSR | S_IRUGO, \
281 return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan[offset-1], \ 317 show_fan_min, set_fan_min, offset); \
282 FAN_DIV_FROM_REG(data->fan_status[offset-1]))); \ 318static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO, \
283} \ 319 show_fan_div, NULL, offset); \
284static ssize_t show_fan##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ 320static SENSOR_DEVICE_ATTR(fan##offset##_status, S_IRUGO, \
285{ \ 321 show_fan_status, NULL, offset);
286 struct pc87360_data *data = pc87360_update_device(dev); \
287 return sprintf(buf, "%u\n", FAN_FROM_REG(data->fan_min[offset-1], \
288 FAN_DIV_FROM_REG(data->fan_status[offset-1]))); \
289} \
290static ssize_t show_fan##offset##_div(struct device *dev, struct device_attribute *attr, char *buf) \
291{ \
292 struct pc87360_data *data = pc87360_update_device(dev); \
293 return sprintf(buf, "%u\n", \
294 FAN_DIV_FROM_REG(data->fan_status[offset-1])); \
295} \
296static ssize_t show_fan##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \
297{ \
298 struct pc87360_data *data = pc87360_update_device(dev); \
299 return sprintf(buf, "%u\n", \
300 FAN_STATUS_FROM_REG(data->fan_status[offset-1])); \
301} \
302static ssize_t set_fan##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \
303 size_t count) \
304{ \
305 return set_fan_min(dev, buf, count, offset-1); \
306} \
307static DEVICE_ATTR(fan##offset##_input, S_IRUGO, \
308 show_fan##offset##_input, NULL); \
309static DEVICE_ATTR(fan##offset##_min, S_IWUSR | S_IRUGO, \
310 show_fan##offset##_min, set_fan##offset##_min); \
311static DEVICE_ATTR(fan##offset##_div, S_IRUGO, \
312 show_fan##offset##_div, NULL); \
313static DEVICE_ATTR(fan##offset##_status, S_IRUGO, \
314 show_fan##offset##_status, NULL);
315show_and_set_fan(1) 322show_and_set_fan(1)
316show_and_set_fan(2) 323show_and_set_fan(2)
317show_and_set_fan(3) 324show_and_set_fan(3)
318 325
326static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr, char *buf)
327{
328 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
329 struct pc87360_data *data = pc87360_update_device(dev);
330 return sprintf(buf, "%u\n",
331 PWM_FROM_REG(data->pwm[attr->index-1],
332 FAN_CONFIG_INVERT(data->fan_conf,
333 attr->index-1)));
334}
335static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr, const char *buf,
336 size_t count)
337{
338 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
339 struct i2c_client *client = to_i2c_client(dev);
340 struct pc87360_data *data = i2c_get_clientdata(client);
341 long val = simple_strtol(buf, NULL, 10);
342
343 down(&data->update_lock);
344 data->pwm[attr->index-1] = PWM_TO_REG(val,
345 FAN_CONFIG_INVERT(data->fan_conf, attr->index-1));
346 pc87360_write_value(data, LD_FAN, NO_BANK, PC87360_REG_PWM(attr->index-1),
347 data->pwm[attr->index-1]);
348 up(&data->update_lock);
349 return count;
350}
351
319#define show_and_set_pwm(offset) \ 352#define show_and_set_pwm(offset) \
320static ssize_t show_pwm##offset(struct device *dev, struct device_attribute *attr, char *buf) \ 353static SENSOR_DEVICE_ATTR(pwm##offset, S_IWUSR | S_IRUGO, \
321{ \ 354 show_pwm, set_pwm, offset);
322 struct pc87360_data *data = pc87360_update_device(dev); \
323 return sprintf(buf, "%u\n", \
324 PWM_FROM_REG(data->pwm[offset-1], \
325 FAN_CONFIG_INVERT(data->fan_conf, \
326 offset-1))); \
327} \
328static ssize_t set_pwm##offset(struct device *dev, struct device_attribute *attr, const char *buf, \
329 size_t count) \
330{ \
331 struct i2c_client *client = to_i2c_client(dev); \
332 struct pc87360_data *data = i2c_get_clientdata(client); \
333 long val = simple_strtol(buf, NULL, 10); \
334 \
335 down(&data->update_lock); \
336 data->pwm[offset-1] = PWM_TO_REG(val, \
337 FAN_CONFIG_INVERT(data->fan_conf, offset-1)); \
338 pc87360_write_value(data, LD_FAN, NO_BANK, PC87360_REG_PWM(offset-1), \
339 data->pwm[offset-1]); \
340 up(&data->update_lock); \
341 return count; \
342} \
343static DEVICE_ATTR(pwm##offset, S_IWUSR | S_IRUGO, \
344 show_pwm##offset, set_pwm##offset);
345show_and_set_pwm(1) 355show_and_set_pwm(1)
346show_and_set_pwm(2) 356show_and_set_pwm(2)
347show_and_set_pwm(3) 357show_and_set_pwm(3)
348 358
359static ssize_t show_in_input(struct device *dev, struct device_attribute *devattr, char *buf)
360{
361 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
362 struct pc87360_data *data = pc87360_update_device(dev);
363 return sprintf(buf, "%u\n", IN_FROM_REG(data->in[attr->index],
364 data->in_vref));
365}
366static ssize_t show_in_min(struct device *dev, struct device_attribute *devattr, char *buf)
367{
368 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
369 struct pc87360_data *data = pc87360_update_device(dev);
370 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[attr->index],
371 data->in_vref));
372}
373static ssize_t show_in_max(struct device *dev, struct device_attribute *devattr, char *buf)
374{
375 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
376 struct pc87360_data *data = pc87360_update_device(dev);
377 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[attr->index],
378 data->in_vref));
379}
380static ssize_t show_in_status(struct device *dev, struct device_attribute *devattr, char *buf)
381{
382 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
383 struct pc87360_data *data = pc87360_update_device(dev);
384 return sprintf(buf, "%u\n", data->in_status[attr->index]);
385}
386static ssize_t set_in_min(struct device *dev, struct device_attribute *devattr, const char *buf,
387 size_t count)
388{
389 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
390 struct i2c_client *client = to_i2c_client(dev);
391 struct pc87360_data *data = i2c_get_clientdata(client);
392 long val = simple_strtol(buf, NULL, 10);
393
394 down(&data->update_lock);
395 data->in_min[attr->index] = IN_TO_REG(val, data->in_vref);
396 pc87360_write_value(data, LD_IN, attr->index, PC87365_REG_IN_MIN,
397 data->in_min[attr->index]);
398 up(&data->update_lock);
399 return count;
400}
401static ssize_t set_in_max(struct device *dev, struct device_attribute *devattr, const char *buf,
402 size_t count)
403{
404 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
405 struct i2c_client *client = to_i2c_client(dev);
406 struct pc87360_data *data = i2c_get_clientdata(client);
407 long val = simple_strtol(buf, NULL, 10);
408
409 down(&data->update_lock);
410 data->in_max[attr->index] = IN_TO_REG(val,
411 data->in_vref);
412 pc87360_write_value(data, LD_IN, attr->index, PC87365_REG_IN_MAX,
413 data->in_max[attr->index]);
414 up(&data->update_lock);
415 return count;
416}
417
349#define show_and_set_in(offset) \ 418#define show_and_set_in(offset) \
350static ssize_t show_in##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ 419static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \
351{ \ 420 show_in_input, NULL, offset); \
352 struct pc87360_data *data = pc87360_update_device(dev); \ 421static SENSOR_DEVICE_ATTR(in##offset##_min, S_IWUSR | S_IRUGO, \
353 return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset], \ 422 show_in_min, set_in_min, offset); \
354 data->in_vref)); \ 423static SENSOR_DEVICE_ATTR(in##offset##_max, S_IWUSR | S_IRUGO, \
355} \ 424 show_in_max, set_in_max, offset); \
356static ssize_t show_in##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ 425static SENSOR_DEVICE_ATTR(in##offset##_status, S_IRUGO, \
357{ \ 426 show_in_status, NULL, offset);
358 struct pc87360_data *data = pc87360_update_device(dev); \
359 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset], \
360 data->in_vref)); \
361} \
362static ssize_t show_in##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \
363{ \
364 struct pc87360_data *data = pc87360_update_device(dev); \
365 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset], \
366 data->in_vref)); \
367} \
368static ssize_t show_in##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \
369{ \
370 struct pc87360_data *data = pc87360_update_device(dev); \
371 return sprintf(buf, "%u\n", data->in_status[offset]); \
372} \
373static ssize_t set_in##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \
374 size_t count) \
375{ \
376 struct i2c_client *client = to_i2c_client(dev); \
377 struct pc87360_data *data = i2c_get_clientdata(client); \
378 long val = simple_strtol(buf, NULL, 10); \
379 \
380 down(&data->update_lock); \
381 data->in_min[offset] = IN_TO_REG(val, data->in_vref); \
382 pc87360_write_value(data, LD_IN, offset, PC87365_REG_IN_MIN, \
383 data->in_min[offset]); \
384 up(&data->update_lock); \
385 return count; \
386} \
387static ssize_t set_in##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \
388 size_t count) \
389{ \
390 struct i2c_client *client = to_i2c_client(dev); \
391 struct pc87360_data *data = i2c_get_clientdata(client); \
392 long val = simple_strtol(buf, NULL, 10); \
393 \
394 down(&data->update_lock); \
395 data->in_max[offset] = IN_TO_REG(val, \
396 data->in_vref); \
397 pc87360_write_value(data, LD_IN, offset, PC87365_REG_IN_MAX, \
398 data->in_max[offset]); \
399 up(&data->update_lock); \
400 return count; \
401} \
402static DEVICE_ATTR(in##offset##_input, S_IRUGO, \
403 show_in##offset##_input, NULL); \
404static DEVICE_ATTR(in##offset##_min, S_IWUSR | S_IRUGO, \
405 show_in##offset##_min, set_in##offset##_min); \
406static DEVICE_ATTR(in##offset##_max, S_IWUSR | S_IRUGO, \
407 show_in##offset##_max, set_in##offset##_max); \
408static DEVICE_ATTR(in##offset##_status, S_IRUGO, \
409 show_in##offset##_status, NULL);
410show_and_set_in(0) 427show_and_set_in(0)
411show_and_set_in(1) 428show_and_set_in(1)
412show_and_set_in(2) 429show_and_set_in(2)
@@ -419,88 +436,97 @@ show_and_set_in(8)
419show_and_set_in(9) 436show_and_set_in(9)
420show_and_set_in(10) 437show_and_set_in(10)
421 438
439static ssize_t show_therm_input(struct device *dev, struct device_attribute *devattr, char *buf)
440{
441 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
442 struct pc87360_data *data = pc87360_update_device(dev);
443 return sprintf(buf, "%u\n", IN_FROM_REG(data->in[attr->index+7],
444 data->in_vref));
445}
446static ssize_t show_therm_min(struct device *dev, struct device_attribute *devattr, char *buf)
447{
448 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
449 struct pc87360_data *data = pc87360_update_device(dev);
450 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[attr->index+7],
451 data->in_vref));
452}
453static ssize_t show_therm_max(struct device *dev, struct device_attribute *devattr, char *buf)
454{
455 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
456 struct pc87360_data *data = pc87360_update_device(dev);
457 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[attr->index+7],
458 data->in_vref));
459}
460static ssize_t show_therm_crit(struct device *dev, struct device_attribute *devattr, char *buf)
461{
462 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
463 struct pc87360_data *data = pc87360_update_device(dev);
464 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_crit[attr->index-4],
465 data->in_vref));
466}
467static ssize_t show_therm_status(struct device *dev, struct device_attribute *devattr, char *buf)
468{
469 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
470 struct pc87360_data *data = pc87360_update_device(dev);
471 return sprintf(buf, "%u\n", data->in_status[attr->index+7]);
472}
473static ssize_t set_therm_min(struct device *dev, struct device_attribute *devattr, const char *buf,
474 size_t count)
475{
476 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
477 struct i2c_client *client = to_i2c_client(dev);
478 struct pc87360_data *data = i2c_get_clientdata(client);
479 long val = simple_strtol(buf, NULL, 10);
480
481 down(&data->update_lock);
482 data->in_min[attr->index+7] = IN_TO_REG(val, data->in_vref);
483 pc87360_write_value(data, LD_IN, attr->index+7, PC87365_REG_TEMP_MIN,
484 data->in_min[attr->index+7]);
485 up(&data->update_lock);
486 return count;
487}
488static ssize_t set_therm_max(struct device *dev, struct device_attribute *devattr, const char *buf,
489 size_t count)
490{
491 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
492 struct i2c_client *client = to_i2c_client(dev);
493 struct pc87360_data *data = i2c_get_clientdata(client);
494 long val = simple_strtol(buf, NULL, 10);
495
496 down(&data->update_lock);
497 data->in_max[attr->index+7] = IN_TO_REG(val, data->in_vref);
498 pc87360_write_value(data, LD_IN, attr->index+7, PC87365_REG_TEMP_MAX,
499 data->in_max[attr->index+7]);
500 up(&data->update_lock);
501 return count;
502}
503static ssize_t set_therm_crit(struct device *dev, struct device_attribute *devattr, const char *buf,
504 size_t count)
505{
506 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
507 struct i2c_client *client = to_i2c_client(dev);
508 struct pc87360_data *data = i2c_get_clientdata(client);
509 long val = simple_strtol(buf, NULL, 10);
510
511 down(&data->update_lock);
512 data->in_crit[attr->index-4] = IN_TO_REG(val, data->in_vref);
513 pc87360_write_value(data, LD_IN, attr->index+7, PC87365_REG_TEMP_CRIT,
514 data->in_crit[attr->index-4]);
515 up(&data->update_lock);
516 return count;
517}
518
422#define show_and_set_therm(offset) \ 519#define show_and_set_therm(offset) \
423static ssize_t show_temp##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ 520static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
424{ \ 521 show_therm_input, NULL, offset); \
425 struct pc87360_data *data = pc87360_update_device(dev); \ 522static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \
426 return sprintf(buf, "%u\n", IN_FROM_REG(data->in[offset+7], \ 523 show_therm_min, set_therm_min, offset); \
427 data->in_vref)); \ 524static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \
428} \ 525 show_therm_max, set_therm_max, offset); \
429static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ 526static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IWUSR | S_IRUGO, \
430{ \ 527 show_therm_crit, set_therm_crit, offset); \
431 struct pc87360_data *data = pc87360_update_device(dev); \ 528static SENSOR_DEVICE_ATTR(temp##offset##_status, S_IRUGO, \
432 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_min[offset+7], \ 529 show_therm_status, NULL, offset);
433 data->in_vref)); \
434} \
435static ssize_t show_temp##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \
436{ \
437 struct pc87360_data *data = pc87360_update_device(dev); \
438 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_max[offset+7], \
439 data->in_vref)); \
440} \
441static ssize_t show_temp##offset##_crit(struct device *dev, struct device_attribute *attr, char *buf) \
442{ \
443 struct pc87360_data *data = pc87360_update_device(dev); \
444 return sprintf(buf, "%u\n", IN_FROM_REG(data->in_crit[offset-4], \
445 data->in_vref)); \
446} \
447static ssize_t show_temp##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \
448{ \
449 struct pc87360_data *data = pc87360_update_device(dev); \
450 return sprintf(buf, "%u\n", data->in_status[offset+7]); \
451} \
452static ssize_t set_temp##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \
453 size_t count) \
454{ \
455 struct i2c_client *client = to_i2c_client(dev); \
456 struct pc87360_data *data = i2c_get_clientdata(client); \
457 long val = simple_strtol(buf, NULL, 10); \
458 \
459 down(&data->update_lock); \
460 data->in_min[offset+7] = IN_TO_REG(val, data->in_vref); \
461 pc87360_write_value(data, LD_IN, offset+7, PC87365_REG_TEMP_MIN, \
462 data->in_min[offset+7]); \
463 up(&data->update_lock); \
464 return count; \
465} \
466static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \
467 size_t count) \
468{ \
469 struct i2c_client *client = to_i2c_client(dev); \
470 struct pc87360_data *data = i2c_get_clientdata(client); \
471 long val = simple_strtol(buf, NULL, 10); \
472 \
473 down(&data->update_lock); \
474 data->in_max[offset+7] = IN_TO_REG(val, data->in_vref); \
475 pc87360_write_value(data, LD_IN, offset+7, PC87365_REG_TEMP_MAX, \
476 data->in_max[offset+7]); \
477 up(&data->update_lock); \
478 return count; \
479} \
480static ssize_t set_temp##offset##_crit(struct device *dev, struct device_attribute *attr, const char *buf, \
481 size_t count) \
482{ \
483 struct i2c_client *client = to_i2c_client(dev); \
484 struct pc87360_data *data = i2c_get_clientdata(client); \
485 long val = simple_strtol(buf, NULL, 10); \
486 \
487 down(&data->update_lock); \
488 data->in_crit[offset-4] = IN_TO_REG(val, data->in_vref); \
489 pc87360_write_value(data, LD_IN, offset+7, PC87365_REG_TEMP_CRIT, \
490 data->in_crit[offset-4]); \
491 up(&data->update_lock); \
492 return count; \
493} \
494static DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
495 show_temp##offset##_input, NULL); \
496static DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \
497 show_temp##offset##_min, set_temp##offset##_min); \
498static DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \
499 show_temp##offset##_max, set_temp##offset##_max); \
500static DEVICE_ATTR(temp##offset##_crit, S_IWUSR | S_IRUGO, \
501 show_temp##offset##_crit, set_temp##offset##_crit); \
502static DEVICE_ATTR(temp##offset##_status, S_IRUGO, \
503 show_temp##offset##_status, NULL);
504show_and_set_therm(4) 530show_and_set_therm(4)
505show_and_set_therm(5) 531show_and_set_therm(5)
506show_and_set_therm(6) 532show_and_set_therm(6)
@@ -533,84 +559,93 @@ static ssize_t show_in_alarms(struct device *dev, struct device_attribute *attr,
533} 559}
534static DEVICE_ATTR(alarms_in, S_IRUGO, show_in_alarms, NULL); 560static DEVICE_ATTR(alarms_in, S_IRUGO, show_in_alarms, NULL);
535 561
562static ssize_t show_temp_input(struct device *dev, struct device_attribute *devattr, char *buf)
563{
564 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
565 struct pc87360_data *data = pc87360_update_device(dev);
566 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[attr->index-1]));
567}
568static ssize_t show_temp_min(struct device *dev, struct device_attribute *devattr, char *buf)
569{
570 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
571 struct pc87360_data *data = pc87360_update_device(dev);
572 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[attr->index-1]));
573}
574static ssize_t show_temp_max(struct device *dev, struct device_attribute *devattr, char *buf)
575{
576 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
577 struct pc87360_data *data = pc87360_update_device(dev);
578 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[attr->index-1]));
579}
580static ssize_t show_temp_crit(struct device *dev, struct device_attribute *devattr, char *buf)
581{
582 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
583 struct pc87360_data *data = pc87360_update_device(dev);
584 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit[attr->index-1]));
585}
586static ssize_t show_temp_status(struct device *dev, struct device_attribute *devattr, char *buf)
587{
588 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
589 struct pc87360_data *data = pc87360_update_device(dev);
590 return sprintf(buf, "%d\n", data->temp_status[attr->index-1]);
591}
592static ssize_t set_temp_min(struct device *dev, struct device_attribute *devattr, const char *buf,
593 size_t count)
594{
595 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
596 struct i2c_client *client = to_i2c_client(dev);
597 struct pc87360_data *data = i2c_get_clientdata(client);
598 long val = simple_strtol(buf, NULL, 10);
599
600 down(&data->update_lock);
601 data->temp_min[attr->index-1] = TEMP_TO_REG(val);
602 pc87360_write_value(data, LD_TEMP, attr->index-1, PC87365_REG_TEMP_MIN,
603 data->temp_min[attr->index-1]);
604 up(&data->update_lock);
605 return count;
606}
607static ssize_t set_temp_max(struct device *dev, struct device_attribute *devattr, const char *buf,
608 size_t count)
609{
610 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
611 struct i2c_client *client = to_i2c_client(dev);
612 struct pc87360_data *data = i2c_get_clientdata(client);
613 long val = simple_strtol(buf, NULL, 10);
614
615 down(&data->update_lock);
616 data->temp_max[attr->index-1] = TEMP_TO_REG(val);
617 pc87360_write_value(data, LD_TEMP, attr->index-1, PC87365_REG_TEMP_MAX,
618 data->temp_max[attr->index-1]);
619 up(&data->update_lock);
620 return count;
621}
622static ssize_t set_temp_crit(struct device *dev, struct device_attribute *devattr, const char *buf,
623 size_t count)
624{
625 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
626 struct i2c_client *client = to_i2c_client(dev);
627 struct pc87360_data *data = i2c_get_clientdata(client);
628 long val = simple_strtol(buf, NULL, 10);
629
630 down(&data->update_lock);
631 data->temp_crit[attr->index-1] = TEMP_TO_REG(val);
632 pc87360_write_value(data, LD_TEMP, attr->index-1, PC87365_REG_TEMP_CRIT,
633 data->temp_crit[attr->index-1]);
634 up(&data->update_lock);
635 return count;
636}
637
536#define show_and_set_temp(offset) \ 638#define show_and_set_temp(offset) \
537static ssize_t show_temp##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ 639static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
538{ \ 640 show_temp_input, NULL, offset); \
539 struct pc87360_data *data = pc87360_update_device(dev); \ 641static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \
540 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[offset-1])); \ 642 show_temp_min, set_temp_min, offset); \
541} \ 643static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \
542static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ 644 show_temp_max, set_temp_max, offset); \
543{ \ 645static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IWUSR | S_IRUGO, \
544 struct pc87360_data *data = pc87360_update_device(dev); \ 646 show_temp_crit, set_temp_crit, offset); \
545 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_min[offset-1])); \ 647static SENSOR_DEVICE_ATTR(temp##offset##_status, S_IRUGO, \
546} \ 648 show_temp_status, NULL, offset);
547static ssize_t show_temp##offset##_max(struct device *dev, struct device_attribute *attr, char *buf) \
548{ \
549 struct pc87360_data *data = pc87360_update_device(dev); \
550 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[offset-1])); \
551}\
552static ssize_t show_temp##offset##_crit(struct device *dev, struct device_attribute *attr, char *buf) \
553{ \
554 struct pc87360_data *data = pc87360_update_device(dev); \
555 return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_crit[offset-1])); \
556}\
557static ssize_t show_temp##offset##_status(struct device *dev, struct device_attribute *attr, char *buf) \
558{ \
559 struct pc87360_data *data = pc87360_update_device(dev); \
560 return sprintf(buf, "%d\n", data->temp_status[offset-1]); \
561}\
562static ssize_t set_temp##offset##_min(struct device *dev, struct device_attribute *attr, const char *buf, \
563 size_t count) \
564{ \
565 struct i2c_client *client = to_i2c_client(dev); \
566 struct pc87360_data *data = i2c_get_clientdata(client); \
567 long val = simple_strtol(buf, NULL, 10); \
568 \
569 down(&data->update_lock); \
570 data->temp_min[offset-1] = TEMP_TO_REG(val); \
571 pc87360_write_value(data, LD_TEMP, offset-1, PC87365_REG_TEMP_MIN, \
572 data->temp_min[offset-1]); \
573 up(&data->update_lock); \
574 return count; \
575} \
576static ssize_t set_temp##offset##_max(struct device *dev, struct device_attribute *attr, const char *buf, \
577 size_t count) \
578{ \
579 struct i2c_client *client = to_i2c_client(dev); \
580 struct pc87360_data *data = i2c_get_clientdata(client); \
581 long val = simple_strtol(buf, NULL, 10); \
582 \
583 down(&data->update_lock); \
584 data->temp_max[offset-1] = TEMP_TO_REG(val); \
585 pc87360_write_value(data, LD_TEMP, offset-1, PC87365_REG_TEMP_MAX, \
586 data->temp_max[offset-1]); \
587 up(&data->update_lock); \
588 return count; \
589} \
590static ssize_t set_temp##offset##_crit(struct device *dev, struct device_attribute *attr, const char *buf, \
591 size_t count) \
592{ \
593 struct i2c_client *client = to_i2c_client(dev); \
594 struct pc87360_data *data = i2c_get_clientdata(client); \
595 long val = simple_strtol(buf, NULL, 10); \
596 \
597 down(&data->update_lock); \
598 data->temp_crit[offset-1] = TEMP_TO_REG(val); \
599 pc87360_write_value(data, LD_TEMP, offset-1, PC87365_REG_TEMP_CRIT, \
600 data->temp_crit[offset-1]); \
601 up(&data->update_lock); \
602 return count; \
603} \
604static DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
605 show_temp##offset##_input, NULL); \
606static DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \
607 show_temp##offset##_min, set_temp##offset##_min); \
608static DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \
609 show_temp##offset##_max, set_temp##offset##_max); \
610static DEVICE_ATTR(temp##offset##_crit, S_IWUSR | S_IRUGO, \
611 show_temp##offset##_crit, set_temp##offset##_crit); \
612static DEVICE_ATTR(temp##offset##_status, S_IRUGO, \
613 show_temp##offset##_status, NULL);
614show_and_set_temp(1) 649show_and_set_temp(1)
615show_and_set_temp(2) 650show_and_set_temp(2)
616show_and_set_temp(3) 651show_and_set_temp(3)
@@ -829,50 +864,50 @@ static int pc87360_detect(struct i2c_adapter *adapter)
829 } 864 }
830 865
831 if (data->innr) { 866 if (data->innr) {
832 device_create_file(&new_client->dev, &dev_attr_in0_input); 867 device_create_file(&new_client->dev, &sensor_dev_attr_in0_input.dev_attr);
833 device_create_file(&new_client->dev, &dev_attr_in1_input); 868 device_create_file(&new_client->dev, &sensor_dev_attr_in1_input.dev_attr);
834 device_create_file(&new_client->dev, &dev_attr_in2_input); 869 device_create_file(&new_client->dev, &sensor_dev_attr_in2_input.dev_attr);
835 device_create_file(&new_client->dev, &dev_attr_in3_input); 870 device_create_file(&new_client->dev, &sensor_dev_attr_in3_input.dev_attr);
836 device_create_file(&new_client->dev, &dev_attr_in4_input); 871 device_create_file(&new_client->dev, &sensor_dev_attr_in4_input.dev_attr);
837 device_create_file(&new_client->dev, &dev_attr_in5_input); 872 device_create_file(&new_client->dev, &sensor_dev_attr_in5_input.dev_attr);
838 device_create_file(&new_client->dev, &dev_attr_in6_input); 873 device_create_file(&new_client->dev, &sensor_dev_attr_in6_input.dev_attr);
839 device_create_file(&new_client->dev, &dev_attr_in7_input); 874 device_create_file(&new_client->dev, &sensor_dev_attr_in7_input.dev_attr);
840 device_create_file(&new_client->dev, &dev_attr_in8_input); 875 device_create_file(&new_client->dev, &sensor_dev_attr_in8_input.dev_attr);
841 device_create_file(&new_client->dev, &dev_attr_in9_input); 876 device_create_file(&new_client->dev, &sensor_dev_attr_in9_input.dev_attr);
842 device_create_file(&new_client->dev, &dev_attr_in10_input); 877 device_create_file(&new_client->dev, &sensor_dev_attr_in10_input.dev_attr);
843 device_create_file(&new_client->dev, &dev_attr_in0_min); 878 device_create_file(&new_client->dev, &sensor_dev_attr_in0_min.dev_attr);
844 device_create_file(&new_client->dev, &dev_attr_in1_min); 879 device_create_file(&new_client->dev, &sensor_dev_attr_in1_min.dev_attr);
845 device_create_file(&new_client->dev, &dev_attr_in2_min); 880 device_create_file(&new_client->dev, &sensor_dev_attr_in2_min.dev_attr);
846 device_create_file(&new_client->dev, &dev_attr_in3_min); 881 device_create_file(&new_client->dev, &sensor_dev_attr_in3_min.dev_attr);
847 device_create_file(&new_client->dev, &dev_attr_in4_min); 882 device_create_file(&new_client->dev, &sensor_dev_attr_in4_min.dev_attr);
848 device_create_file(&new_client->dev, &dev_attr_in5_min); 883 device_create_file(&new_client->dev, &sensor_dev_attr_in5_min.dev_attr);
849 device_create_file(&new_client->dev, &dev_attr_in6_min); 884 device_create_file(&new_client->dev, &sensor_dev_attr_in6_min.dev_attr);
850 device_create_file(&new_client->dev, &dev_attr_in7_min); 885 device_create_file(&new_client->dev, &sensor_dev_attr_in7_min.dev_attr);
851 device_create_file(&new_client->dev, &dev_attr_in8_min); 886 device_create_file(&new_client->dev, &sensor_dev_attr_in8_min.dev_attr);
852 device_create_file(&new_client->dev, &dev_attr_in9_min); 887 device_create_file(&new_client->dev, &sensor_dev_attr_in9_min.dev_attr);
853 device_create_file(&new_client->dev, &dev_attr_in10_min); 888 device_create_file(&new_client->dev, &sensor_dev_attr_in10_min.dev_attr);
854 device_create_file(&new_client->dev, &dev_attr_in0_max); 889 device_create_file(&new_client->dev, &sensor_dev_attr_in0_max.dev_attr);
855 device_create_file(&new_client->dev, &dev_attr_in1_max); 890 device_create_file(&new_client->dev, &sensor_dev_attr_in1_max.dev_attr);
856 device_create_file(&new_client->dev, &dev_attr_in2_max); 891 device_create_file(&new_client->dev, &sensor_dev_attr_in2_max.dev_attr);
857 device_create_file(&new_client->dev, &dev_attr_in3_max); 892 device_create_file(&new_client->dev, &sensor_dev_attr_in3_max.dev_attr);
858 device_create_file(&new_client->dev, &dev_attr_in4_max); 893 device_create_file(&new_client->dev, &sensor_dev_attr_in4_max.dev_attr);
859 device_create_file(&new_client->dev, &dev_attr_in5_max); 894 device_create_file(&new_client->dev, &sensor_dev_attr_in5_max.dev_attr);
860 device_create_file(&new_client->dev, &dev_attr_in6_max); 895 device_create_file(&new_client->dev, &sensor_dev_attr_in6_max.dev_attr);
861 device_create_file(&new_client->dev, &dev_attr_in7_max); 896 device_create_file(&new_client->dev, &sensor_dev_attr_in7_max.dev_attr);
862 device_create_file(&new_client->dev, &dev_attr_in8_max); 897 device_create_file(&new_client->dev, &sensor_dev_attr_in8_max.dev_attr);
863 device_create_file(&new_client->dev, &dev_attr_in9_max); 898 device_create_file(&new_client->dev, &sensor_dev_attr_in9_max.dev_attr);
864 device_create_file(&new_client->dev, &dev_attr_in10_max); 899 device_create_file(&new_client->dev, &sensor_dev_attr_in10_max.dev_attr);
865 device_create_file(&new_client->dev, &dev_attr_in0_status); 900 device_create_file(&new_client->dev, &sensor_dev_attr_in0_status.dev_attr);
866 device_create_file(&new_client->dev, &dev_attr_in1_status); 901 device_create_file(&new_client->dev, &sensor_dev_attr_in1_status.dev_attr);
867 device_create_file(&new_client->dev, &dev_attr_in2_status); 902 device_create_file(&new_client->dev, &sensor_dev_attr_in2_status.dev_attr);
868 device_create_file(&new_client->dev, &dev_attr_in3_status); 903 device_create_file(&new_client->dev, &sensor_dev_attr_in3_status.dev_attr);
869 device_create_file(&new_client->dev, &dev_attr_in4_status); 904 device_create_file(&new_client->dev, &sensor_dev_attr_in4_status.dev_attr);
870 device_create_file(&new_client->dev, &dev_attr_in5_status); 905 device_create_file(&new_client->dev, &sensor_dev_attr_in5_status.dev_attr);
871 device_create_file(&new_client->dev, &dev_attr_in6_status); 906 device_create_file(&new_client->dev, &sensor_dev_attr_in6_status.dev_attr);
872 device_create_file(&new_client->dev, &dev_attr_in7_status); 907 device_create_file(&new_client->dev, &sensor_dev_attr_in7_status.dev_attr);
873 device_create_file(&new_client->dev, &dev_attr_in8_status); 908 device_create_file(&new_client->dev, &sensor_dev_attr_in8_status.dev_attr);
874 device_create_file(&new_client->dev, &dev_attr_in9_status); 909 device_create_file(&new_client->dev, &sensor_dev_attr_in9_status.dev_attr);
875 device_create_file(&new_client->dev, &dev_attr_in10_status); 910 device_create_file(&new_client->dev, &sensor_dev_attr_in10_status.dev_attr);
876 911
877 device_create_file(&new_client->dev, &dev_attr_cpu0_vid); 912 device_create_file(&new_client->dev, &dev_attr_cpu0_vid);
878 device_create_file(&new_client->dev, &dev_attr_vrm); 913 device_create_file(&new_client->dev, &dev_attr_vrm);
@@ -880,86 +915,86 @@ static int pc87360_detect(struct i2c_adapter *adapter)
880 } 915 }
881 916
882 if (data->tempnr) { 917 if (data->tempnr) {
883 device_create_file(&new_client->dev, &dev_attr_temp1_input); 918 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_input.dev_attr);
884 device_create_file(&new_client->dev, &dev_attr_temp2_input); 919 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_input.dev_attr);
885 device_create_file(&new_client->dev, &dev_attr_temp1_min); 920 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_min.dev_attr);
886 device_create_file(&new_client->dev, &dev_attr_temp2_min); 921 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_min.dev_attr);
887 device_create_file(&new_client->dev, &dev_attr_temp1_max); 922 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_max.dev_attr);
888 device_create_file(&new_client->dev, &dev_attr_temp2_max); 923 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_max.dev_attr);
889 device_create_file(&new_client->dev, &dev_attr_temp1_crit); 924 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_crit.dev_attr);
890 device_create_file(&new_client->dev, &dev_attr_temp2_crit); 925 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_crit.dev_attr);
891 device_create_file(&new_client->dev, &dev_attr_temp1_status); 926 device_create_file(&new_client->dev, &sensor_dev_attr_temp1_status.dev_attr);
892 device_create_file(&new_client->dev, &dev_attr_temp2_status); 927 device_create_file(&new_client->dev, &sensor_dev_attr_temp2_status.dev_attr);
893 928
894 device_create_file(&new_client->dev, &dev_attr_alarms_temp); 929 device_create_file(&new_client->dev, &dev_attr_alarms_temp);
895 } 930 }
896 if (data->tempnr == 3) { 931 if (data->tempnr == 3) {
897 device_create_file(&new_client->dev, &dev_attr_temp3_input); 932 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_input.dev_attr);
898 device_create_file(&new_client->dev, &dev_attr_temp3_min); 933 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_min.dev_attr);
899 device_create_file(&new_client->dev, &dev_attr_temp3_max); 934 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_max.dev_attr);
900 device_create_file(&new_client->dev, &dev_attr_temp3_crit); 935 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_crit.dev_attr);
901 device_create_file(&new_client->dev, &dev_attr_temp3_status); 936 device_create_file(&new_client->dev, &sensor_dev_attr_temp3_status.dev_attr);
902 } 937 }
903 if (data->innr == 14) { 938 if (data->innr == 14) {
904 device_create_file(&new_client->dev, &dev_attr_temp4_input); 939 device_create_file(&new_client->dev, &sensor_dev_attr_temp4_input.dev_attr);
905 device_create_file(&new_client->dev, &dev_attr_temp5_input); 940 device_create_file(&new_client->dev, &sensor_dev_attr_temp5_input.dev_attr);
906 device_create_file(&new_client->dev, &dev_attr_temp6_input); 941 device_create_file(&new_client->dev, &sensor_dev_attr_temp6_input.dev_attr);
907 device_create_file(&new_client->dev, &dev_attr_temp4_min); 942 device_create_file(&new_client->dev, &sensor_dev_attr_temp4_min.dev_attr);
908 device_create_file(&new_client->dev, &dev_attr_temp5_min); 943 device_create_file(&new_client->dev, &sensor_dev_attr_temp5_min.dev_attr);
909 device_create_file(&new_client->dev, &dev_attr_temp6_min); 944 device_create_file(&new_client->dev, &sensor_dev_attr_temp6_min.dev_attr);
910 device_create_file(&new_client->dev, &dev_attr_temp4_max); 945 device_create_file(&new_client->dev, &sensor_dev_attr_temp4_max.dev_attr);
911 device_create_file(&new_client->dev, &dev_attr_temp5_max); 946 device_create_file(&new_client->dev, &sensor_dev_attr_temp5_max.dev_attr);
912 device_create_file(&new_client->dev, &dev_attr_temp6_max); 947 device_create_file(&new_client->dev, &sensor_dev_attr_temp6_max.dev_attr);
913 device_create_file(&new_client->dev, &dev_attr_temp4_crit); 948 device_create_file(&new_client->dev, &sensor_dev_attr_temp4_crit.dev_attr);
914 device_create_file(&new_client->dev, &dev_attr_temp5_crit); 949 device_create_file(&new_client->dev, &sensor_dev_attr_temp5_crit.dev_attr);
915 device_create_file(&new_client->dev, &dev_attr_temp6_crit); 950 device_create_file(&new_client->dev, &sensor_dev_attr_temp6_crit.dev_attr);
916 device_create_file(&new_client->dev, &dev_attr_temp4_status); 951 device_create_file(&new_client->dev, &sensor_dev_attr_temp4_status.dev_attr);
917 device_create_file(&new_client->dev, &dev_attr_temp5_status); 952 device_create_file(&new_client->dev, &sensor_dev_attr_temp5_status.dev_attr);
918 device_create_file(&new_client->dev, &dev_attr_temp6_status); 953 device_create_file(&new_client->dev, &sensor_dev_attr_temp6_status.dev_attr);
919 } 954 }
920 955
921 if (data->fannr) { 956 if (data->fannr) {
922 if (FAN_CONFIG_MONITOR(data->fan_conf, 0)) { 957 if (FAN_CONFIG_MONITOR(data->fan_conf, 0)) {
923 device_create_file(&new_client->dev, 958 device_create_file(&new_client->dev,
924 &dev_attr_fan1_input); 959 &sensor_dev_attr_fan1_input.dev_attr);
925 device_create_file(&new_client->dev, 960 device_create_file(&new_client->dev,
926 &dev_attr_fan1_min); 961 &sensor_dev_attr_fan1_min.dev_attr);
927 device_create_file(&new_client->dev, 962 device_create_file(&new_client->dev,
928 &dev_attr_fan1_div); 963 &sensor_dev_attr_fan1_div.dev_attr);
929 device_create_file(&new_client->dev, 964 device_create_file(&new_client->dev,
930 &dev_attr_fan1_status); 965 &sensor_dev_attr_fan1_status.dev_attr);
931 } 966 }
932 967
933 if (FAN_CONFIG_MONITOR(data->fan_conf, 1)) { 968 if (FAN_CONFIG_MONITOR(data->fan_conf, 1)) {
934 device_create_file(&new_client->dev, 969 device_create_file(&new_client->dev,
935 &dev_attr_fan2_input); 970 &sensor_dev_attr_fan2_input.dev_attr);
936 device_create_file(&new_client->dev, 971 device_create_file(&new_client->dev,
937 &dev_attr_fan2_min); 972 &sensor_dev_attr_fan2_min.dev_attr);
938 device_create_file(&new_client->dev, 973 device_create_file(&new_client->dev,
939 &dev_attr_fan2_div); 974 &sensor_dev_attr_fan2_div.dev_attr);
940 device_create_file(&new_client->dev, 975 device_create_file(&new_client->dev,
941 &dev_attr_fan2_status); 976 &sensor_dev_attr_fan2_status.dev_attr);
942 } 977 }
943 978
944 if (FAN_CONFIG_CONTROL(data->fan_conf, 0)) 979 if (FAN_CONFIG_CONTROL(data->fan_conf, 0))
945 device_create_file(&new_client->dev, &dev_attr_pwm1); 980 device_create_file(&new_client->dev, &sensor_dev_attr_pwm1.dev_attr);
946 if (FAN_CONFIG_CONTROL(data->fan_conf, 1)) 981 if (FAN_CONFIG_CONTROL(data->fan_conf, 1))
947 device_create_file(&new_client->dev, &dev_attr_pwm2); 982 device_create_file(&new_client->dev, &sensor_dev_attr_pwm2.dev_attr);
948 } 983 }
949 if (data->fannr == 3) { 984 if (data->fannr == 3) {
950 if (FAN_CONFIG_MONITOR(data->fan_conf, 2)) { 985 if (FAN_CONFIG_MONITOR(data->fan_conf, 2)) {
951 device_create_file(&new_client->dev, 986 device_create_file(&new_client->dev,
952 &dev_attr_fan3_input); 987 &sensor_dev_attr_fan3_input.dev_attr);
953 device_create_file(&new_client->dev, 988 device_create_file(&new_client->dev,
954 &dev_attr_fan3_min); 989 &sensor_dev_attr_fan3_min.dev_attr);
955 device_create_file(&new_client->dev, 990 device_create_file(&new_client->dev,
956 &dev_attr_fan3_div); 991 &sensor_dev_attr_fan3_div.dev_attr);
957 device_create_file(&new_client->dev, 992 device_create_file(&new_client->dev,
958 &dev_attr_fan3_status); 993 &sensor_dev_attr_fan3_status.dev_attr);
959 } 994 }
960 995
961 if (FAN_CONFIG_CONTROL(data->fan_conf, 2)) 996 if (FAN_CONFIG_CONTROL(data->fan_conf, 2))
962 device_create_file(&new_client->dev, &dev_attr_pwm3); 997 device_create_file(&new_client->dev, &sensor_dev_attr_pwm3.dev_attr);
963 } 998 }
964 999
965 return 0; 1000 return 0;