diff options
author | Jim Cromie <jim.cromie@gmail.com> | 2005-09-02 16:52:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-09-05 12:26:54 -0400 |
commit | f0986bd8f390392948db85dac526fb238752372b (patch) | |
tree | 2d4851d8d17ac9576ca8dbd223ee378700475bbe /drivers | |
parent | a89923fff79f8eeed0ccdf51e13453754e48a71e (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')
-rw-r--r-- | drivers/hwmon/pc87360.c | 775 |
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 | ||
248 | static ssize_t set_fan_min(struct device *dev, const char *buf, | 249 | static 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 | ||
278 | static 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 | } | ||
285 | static 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 | } | ||
292 | static 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 | } | ||
299 | static 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 | } | ||
306 | static 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) \ |
278 | static ssize_t show_fan##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ | 314 | static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \ |
279 | { \ | 315 | show_fan_input, NULL, offset); \ |
280 | struct pc87360_data *data = pc87360_update_device(dev); \ | 316 | static 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]))); \ | 318 | static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO, \ |
283 | } \ | 319 | show_fan_div, NULL, offset); \ |
284 | static ssize_t show_fan##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ | 320 | static 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 | } \ | ||
290 | static 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 | } \ | ||
296 | static 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 | } \ | ||
302 | static 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 | } \ | ||
307 | static DEVICE_ATTR(fan##offset##_input, S_IRUGO, \ | ||
308 | show_fan##offset##_input, NULL); \ | ||
309 | static DEVICE_ATTR(fan##offset##_min, S_IWUSR | S_IRUGO, \ | ||
310 | show_fan##offset##_min, set_fan##offset##_min); \ | ||
311 | static DEVICE_ATTR(fan##offset##_div, S_IRUGO, \ | ||
312 | show_fan##offset##_div, NULL); \ | ||
313 | static DEVICE_ATTR(fan##offset##_status, S_IRUGO, \ | ||
314 | show_fan##offset##_status, NULL); | ||
315 | show_and_set_fan(1) | 322 | show_and_set_fan(1) |
316 | show_and_set_fan(2) | 323 | show_and_set_fan(2) |
317 | show_and_set_fan(3) | 324 | show_and_set_fan(3) |
318 | 325 | ||
326 | static 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 | } | ||
335 | static 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) \ |
320 | static ssize_t show_pwm##offset(struct device *dev, struct device_attribute *attr, char *buf) \ | 353 | static 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 | } \ | ||
328 | static 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 | } \ | ||
343 | static DEVICE_ATTR(pwm##offset, S_IWUSR | S_IRUGO, \ | ||
344 | show_pwm##offset, set_pwm##offset); | ||
345 | show_and_set_pwm(1) | 355 | show_and_set_pwm(1) |
346 | show_and_set_pwm(2) | 356 | show_and_set_pwm(2) |
347 | show_and_set_pwm(3) | 357 | show_and_set_pwm(3) |
348 | 358 | ||
359 | static 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 | } | ||
366 | static 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 | } | ||
373 | static 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 | } | ||
380 | static 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 | } | ||
386 | static 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 | } | ||
401 | static 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) \ |
350 | static ssize_t show_in##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ | 419 | static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \ |
351 | { \ | 420 | show_in_input, NULL, offset); \ |
352 | struct pc87360_data *data = pc87360_update_device(dev); \ | 421 | static 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)); \ | 423 | static SENSOR_DEVICE_ATTR(in##offset##_max, S_IWUSR | S_IRUGO, \ |
355 | } \ | 424 | show_in_max, set_in_max, offset); \ |
356 | static ssize_t show_in##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ | 425 | static 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 | } \ | ||
362 | static 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 | } \ | ||
368 | static 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 | } \ | ||
373 | static 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 | } \ | ||
387 | static 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 | } \ | ||
402 | static DEVICE_ATTR(in##offset##_input, S_IRUGO, \ | ||
403 | show_in##offset##_input, NULL); \ | ||
404 | static DEVICE_ATTR(in##offset##_min, S_IWUSR | S_IRUGO, \ | ||
405 | show_in##offset##_min, set_in##offset##_min); \ | ||
406 | static DEVICE_ATTR(in##offset##_max, S_IWUSR | S_IRUGO, \ | ||
407 | show_in##offset##_max, set_in##offset##_max); \ | ||
408 | static DEVICE_ATTR(in##offset##_status, S_IRUGO, \ | ||
409 | show_in##offset##_status, NULL); | ||
410 | show_and_set_in(0) | 427 | show_and_set_in(0) |
411 | show_and_set_in(1) | 428 | show_and_set_in(1) |
412 | show_and_set_in(2) | 429 | show_and_set_in(2) |
@@ -419,88 +436,97 @@ show_and_set_in(8) | |||
419 | show_and_set_in(9) | 436 | show_and_set_in(9) |
420 | show_and_set_in(10) | 437 | show_and_set_in(10) |
421 | 438 | ||
439 | static 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 | } | ||
446 | static 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 | } | ||
453 | static 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 | } | ||
460 | static 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 | } | ||
467 | static 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 | } | ||
473 | static 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 | } | ||
488 | static 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 | } | ||
503 | static 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) \ |
423 | static ssize_t show_temp##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ | 520 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ |
424 | { \ | 521 | show_therm_input, NULL, offset); \ |
425 | struct pc87360_data *data = pc87360_update_device(dev); \ | 522 | static 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)); \ | 524 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \ |
428 | } \ | 525 | show_therm_max, set_therm_max, offset); \ |
429 | static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ | 526 | static 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); \ | 528 | static 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 | } \ | ||
435 | static 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 | } \ | ||
441 | static 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 | } \ | ||
447 | static 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 | } \ | ||
452 | static 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 | } \ | ||
466 | static 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 | } \ | ||
480 | static 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 | } \ | ||
494 | static DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ | ||
495 | show_temp##offset##_input, NULL); \ | ||
496 | static DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \ | ||
497 | show_temp##offset##_min, set_temp##offset##_min); \ | ||
498 | static DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \ | ||
499 | show_temp##offset##_max, set_temp##offset##_max); \ | ||
500 | static DEVICE_ATTR(temp##offset##_crit, S_IWUSR | S_IRUGO, \ | ||
501 | show_temp##offset##_crit, set_temp##offset##_crit); \ | ||
502 | static DEVICE_ATTR(temp##offset##_status, S_IRUGO, \ | ||
503 | show_temp##offset##_status, NULL); | ||
504 | show_and_set_therm(4) | 530 | show_and_set_therm(4) |
505 | show_and_set_therm(5) | 531 | show_and_set_therm(5) |
506 | show_and_set_therm(6) | 532 | show_and_set_therm(6) |
@@ -533,84 +559,93 @@ static ssize_t show_in_alarms(struct device *dev, struct device_attribute *attr, | |||
533 | } | 559 | } |
534 | static DEVICE_ATTR(alarms_in, S_IRUGO, show_in_alarms, NULL); | 560 | static DEVICE_ATTR(alarms_in, S_IRUGO, show_in_alarms, NULL); |
535 | 561 | ||
562 | static 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 | } | ||
568 | static 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 | } | ||
574 | static 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 | } | ||
580 | static 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 | } | ||
586 | static 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 | } | ||
592 | static 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 | } | ||
607 | static 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 | } | ||
622 | static 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) \ |
537 | static ssize_t show_temp##offset##_input(struct device *dev, struct device_attribute *attr, char *buf) \ | 639 | static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ |
538 | { \ | 640 | show_temp_input, NULL, offset); \ |
539 | struct pc87360_data *data = pc87360_update_device(dev); \ | 641 | static 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 | } \ | 643 | static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \ |
542 | static ssize_t show_temp##offset##_min(struct device *dev, struct device_attribute *attr, char *buf) \ | 644 | show_temp_max, set_temp_max, offset); \ |
543 | { \ | 645 | static 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])); \ | 647 | static SENSOR_DEVICE_ATTR(temp##offset##_status, S_IRUGO, \ |
546 | } \ | 648 | show_temp_status, NULL, offset); |
547 | static 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 | }\ | ||
552 | static 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 | }\ | ||
557 | static 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 | }\ | ||
562 | static 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 | } \ | ||
576 | static 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 | } \ | ||
590 | static 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 | } \ | ||
604 | static DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ | ||
605 | show_temp##offset##_input, NULL); \ | ||
606 | static DEVICE_ATTR(temp##offset##_min, S_IWUSR | S_IRUGO, \ | ||
607 | show_temp##offset##_min, set_temp##offset##_min); \ | ||
608 | static DEVICE_ATTR(temp##offset##_max, S_IWUSR | S_IRUGO, \ | ||
609 | show_temp##offset##_max, set_temp##offset##_max); \ | ||
610 | static DEVICE_ATTR(temp##offset##_crit, S_IWUSR | S_IRUGO, \ | ||
611 | show_temp##offset##_crit, set_temp##offset##_crit); \ | ||
612 | static DEVICE_ATTR(temp##offset##_status, S_IRUGO, \ | ||
613 | show_temp##offset##_status, NULL); | ||
614 | show_and_set_temp(1) | 649 | show_and_set_temp(1) |
615 | show_and_set_temp(2) | 650 | show_and_set_temp(2) |
616 | show_and_set_temp(3) | 651 | show_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; |