diff options
author | Len Brown <len.brown@intel.com> | 2008-02-07 16:55:08 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-02-07 23:48:04 -0500 |
commit | 543a956140e1f57331c0e528d2367106057aeca0 (patch) | |
tree | 41cbe361027a982dc80c1e952a28152af6d89ce6 /drivers/thermal | |
parent | 9f2eef25e044603527e121066284d22f51d853cc (diff) |
ACPI: thermal: syntax, spelling, kernel-doc
Reviewed-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/Kconfig | 4 | ||||
-rw-r--r-- | drivers/thermal/thermal.c | 49 |
2 files changed, 30 insertions, 23 deletions
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 9b3f61200000..69f19f224875 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig | |||
@@ -9,7 +9,7 @@ menuconfig THERMAL | |||
9 | Generic Thermal Sysfs driver offers a generic mechanism for | 9 | Generic Thermal Sysfs driver offers a generic mechanism for |
10 | thermal management. Usually it's made up of one or more thermal | 10 | thermal management. Usually it's made up of one or more thermal |
11 | zone and cooling device. | 11 | zone and cooling device. |
12 | each thermal zone contains its own temperature, trip points, | 12 | Each thermal zone contains its own temperature, trip points, |
13 | cooling devices. | 13 | cooling devices. |
14 | All platforms with ACPI thermal support can use this driver. | 14 | All platforms with ACPI thermal support can use this driver. |
15 | If you want this support, you should say Y here | 15 | If you want this support, you should say Y here. |
diff --git a/drivers/thermal/thermal.c b/drivers/thermal/thermal.c index 3273e348fd14..e782b3e7fcdb 100644 --- a/drivers/thermal/thermal.c +++ b/drivers/thermal/thermal.c | |||
@@ -267,7 +267,7 @@ thermal_cooling_device_cur_state_store(struct device *dev, | |||
267 | } | 267 | } |
268 | 268 | ||
269 | static struct device_attribute dev_attr_cdev_type = | 269 | static struct device_attribute dev_attr_cdev_type = |
270 | __ATTR(type, 0444, thermal_cooling_device_type_show, NULL); | 270 | __ATTR(type, 0444, thermal_cooling_device_type_show, NULL); |
271 | static DEVICE_ATTR(max_state, 0444, | 271 | static DEVICE_ATTR(max_state, 0444, |
272 | thermal_cooling_device_max_state_show, NULL); | 272 | thermal_cooling_device_max_state_show, NULL); |
273 | static DEVICE_ATTR(cur_state, 0644, | 273 | static DEVICE_ATTR(cur_state, 0644, |
@@ -276,7 +276,7 @@ static DEVICE_ATTR(cur_state, 0644, | |||
276 | 276 | ||
277 | static ssize_t | 277 | static ssize_t |
278 | thermal_cooling_device_trip_point_show(struct device *dev, | 278 | thermal_cooling_device_trip_point_show(struct device *dev, |
279 | struct device_attribute *attr, char *buf) | 279 | struct device_attribute *attr, char *buf) |
280 | { | 280 | { |
281 | struct thermal_cooling_device_instance *instance; | 281 | struct thermal_cooling_device_instance *instance; |
282 | 282 | ||
@@ -293,11 +293,12 @@ thermal_cooling_device_trip_point_show(struct device *dev, | |||
293 | 293 | ||
294 | /** | 294 | /** |
295 | * thermal_zone_bind_cooling_device - bind a cooling device to a thermal zone | 295 | * thermal_zone_bind_cooling_device - bind a cooling device to a thermal zone |
296 | * this function is usually called in the thermal zone device .bind callback. | ||
297 | * @tz: thermal zone device | 296 | * @tz: thermal zone device |
298 | * @trip: indicates which trip point the cooling devices is | 297 | * @trip: indicates which trip point the cooling devices is |
299 | * associated with in this thermal zone. | 298 | * associated with in this thermal zone. |
300 | * @cdev: thermal cooling device | 299 | * @cdev: thermal cooling device |
300 | * | ||
301 | * This function is usually called in the thermal zone device .bind callback. | ||
301 | */ | 302 | */ |
302 | int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, | 303 | int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, |
303 | int trip, | 304 | int trip, |
@@ -307,8 +308,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, | |||
307 | struct thermal_cooling_device_instance *pos; | 308 | struct thermal_cooling_device_instance *pos; |
308 | int result; | 309 | int result; |
309 | 310 | ||
310 | if (trip >= tz->trips || | 311 | if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) |
311 | (trip < 0 && trip != THERMAL_TRIPS_NONE)) | ||
312 | return -EINVAL; | 312 | return -EINVAL; |
313 | 313 | ||
314 | if (!tz || !cdev) | 314 | if (!tz || !cdev) |
@@ -361,15 +361,17 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, | |||
361 | kfree(dev); | 361 | kfree(dev); |
362 | return result; | 362 | return result; |
363 | } | 363 | } |
364 | |||
364 | EXPORT_SYMBOL(thermal_zone_bind_cooling_device); | 365 | EXPORT_SYMBOL(thermal_zone_bind_cooling_device); |
365 | 366 | ||
366 | /** | 367 | /** |
367 | * thermal_zone_unbind_cooling_device - unbind a cooling device from a thermal zone | 368 | * thermal_zone_unbind_cooling_device - unbind a cooling device from a thermal zone |
368 | * this function is usually called in the thermal zone device .unbind callback. | ||
369 | * @tz: thermal zone device | 369 | * @tz: thermal zone device |
370 | * @trip: indicates which trip point the cooling devices is | 370 | * @trip: indicates which trip point the cooling devices is |
371 | * associated with in this thermal zone. | 371 | * associated with in this thermal zone. |
372 | * @cdev: thermal cooling device | 372 | * @cdev: thermal cooling device |
373 | * | ||
374 | * This function is usually called in the thermal zone device .unbind callback. | ||
373 | */ | 375 | */ |
374 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, | 376 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, |
375 | int trip, | 377 | int trip, |
@@ -379,8 +381,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, | |||
379 | 381 | ||
380 | mutex_lock(&tz->lock); | 382 | mutex_lock(&tz->lock); |
381 | list_for_each_entry_safe(pos, next, &tz->cooling_devices, node) { | 383 | list_for_each_entry_safe(pos, next, &tz->cooling_devices, node) { |
382 | if (pos->tz == tz && pos->trip == trip | 384 | if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { |
383 | && pos->cdev == cdev) { | ||
384 | list_del(&pos->node); | 385 | list_del(&pos->node); |
385 | mutex_unlock(&tz->lock); | 386 | mutex_unlock(&tz->lock); |
386 | goto unbind; | 387 | goto unbind; |
@@ -397,6 +398,7 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, | |||
397 | kfree(pos); | 398 | kfree(pos); |
398 | return 0; | 399 | return 0; |
399 | } | 400 | } |
401 | |||
400 | EXPORT_SYMBOL(thermal_zone_unbind_cooling_device); | 402 | EXPORT_SYMBOL(thermal_zone_unbind_cooling_device); |
401 | 403 | ||
402 | static void thermal_release(struct device *dev) | 404 | static void thermal_release(struct device *dev) |
@@ -425,7 +427,10 @@ static struct class thermal_class = { | |||
425 | * @ops: standard thermal cooling devices callbacks. | 427 | * @ops: standard thermal cooling devices callbacks. |
426 | */ | 428 | */ |
427 | struct thermal_cooling_device *thermal_cooling_device_register(char *type, | 429 | struct thermal_cooling_device *thermal_cooling_device_register(char *type, |
428 | void *devdata, struct thermal_cooling_device_ops *ops) | 430 | void *devdata, |
431 | struct | ||
432 | thermal_cooling_device_ops | ||
433 | *ops) | ||
429 | { | 434 | { |
430 | struct thermal_cooling_device *cdev; | 435 | struct thermal_cooling_device *cdev; |
431 | struct thermal_zone_device *pos; | 436 | struct thermal_zone_device *pos; |
@@ -435,7 +440,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type, | |||
435 | return NULL; | 440 | return NULL; |
436 | 441 | ||
437 | if (!ops || !ops->get_max_state || !ops->get_cur_state || | 442 | if (!ops || !ops->get_max_state || !ops->get_cur_state || |
438 | !ops->set_cur_state) | 443 | !ops->set_cur_state) |
439 | return NULL; | 444 | return NULL; |
440 | 445 | ||
441 | cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL); | 446 | cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL); |
@@ -462,8 +467,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type, | |||
462 | 467 | ||
463 | /* sys I/F */ | 468 | /* sys I/F */ |
464 | if (type) { | 469 | if (type) { |
465 | result = device_create_file(&cdev->device, | 470 | result = device_create_file(&cdev->device, &dev_attr_cdev_type); |
466 | &dev_attr_cdev_type); | ||
467 | if (result) | 471 | if (result) |
468 | goto unregister; | 472 | goto unregister; |
469 | } | 473 | } |
@@ -496,11 +500,11 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type, | |||
496 | device_unregister(&cdev->device); | 500 | device_unregister(&cdev->device); |
497 | return NULL; | 501 | return NULL; |
498 | } | 502 | } |
503 | |||
499 | EXPORT_SYMBOL(thermal_cooling_device_register); | 504 | EXPORT_SYMBOL(thermal_cooling_device_register); |
500 | 505 | ||
501 | /** | 506 | /** |
502 | * thermal_cooling_device_unregister - removes the registered thermal cooling device | 507 | * thermal_cooling_device_unregister - removes the registered thermal cooling device |
503 | * | ||
504 | * @cdev: the thermal cooling device to remove. | 508 | * @cdev: the thermal cooling device to remove. |
505 | * | 509 | * |
506 | * thermal_cooling_device_unregister() must be called when the device is no | 510 | * thermal_cooling_device_unregister() must be called when the device is no |
@@ -533,8 +537,7 @@ void thermal_cooling_device_unregister(struct | |||
533 | } | 537 | } |
534 | mutex_unlock(&thermal_list_lock); | 538 | mutex_unlock(&thermal_list_lock); |
535 | if (cdev->type[0]) | 539 | if (cdev->type[0]) |
536 | device_remove_file(&cdev->device, | 540 | device_remove_file(&cdev->device, &dev_attr_cdev_type); |
537 | &dev_attr_cdev_type); | ||
538 | device_remove_file(&cdev->device, &dev_attr_max_state); | 541 | device_remove_file(&cdev->device, &dev_attr_max_state); |
539 | device_remove_file(&cdev->device, &dev_attr_cur_state); | 542 | device_remove_file(&cdev->device, &dev_attr_cur_state); |
540 | 543 | ||
@@ -542,6 +545,7 @@ void thermal_cooling_device_unregister(struct | |||
542 | device_unregister(&cdev->device); | 545 | device_unregister(&cdev->device); |
543 | return; | 546 | return; |
544 | } | 547 | } |
548 | |||
545 | EXPORT_SYMBOL(thermal_cooling_device_unregister); | 549 | EXPORT_SYMBOL(thermal_cooling_device_unregister); |
546 | 550 | ||
547 | /** | 551 | /** |
@@ -555,8 +559,10 @@ EXPORT_SYMBOL(thermal_cooling_device_unregister); | |||
555 | * longer needed. | 559 | * longer needed. |
556 | */ | 560 | */ |
557 | struct thermal_zone_device *thermal_zone_device_register(char *type, | 561 | struct thermal_zone_device *thermal_zone_device_register(char *type, |
558 | int trips, void *devdata, | 562 | int trips, |
559 | struct thermal_zone_device_ops *ops) | 563 | void *devdata, struct |
564 | thermal_zone_device_ops | ||
565 | *ops) | ||
560 | { | 566 | { |
561 | struct thermal_zone_device *tz; | 567 | struct thermal_zone_device *tz; |
562 | struct thermal_cooling_device *pos; | 568 | struct thermal_cooling_device *pos; |
@@ -625,9 +631,9 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, | |||
625 | list_add_tail(&tz->node, &thermal_tz_list); | 631 | list_add_tail(&tz->node, &thermal_tz_list); |
626 | if (ops->bind) | 632 | if (ops->bind) |
627 | list_for_each_entry(pos, &thermal_cdev_list, node) { | 633 | list_for_each_entry(pos, &thermal_cdev_list, node) { |
628 | result = ops->bind(tz, pos); | 634 | result = ops->bind(tz, pos); |
629 | if (result) | 635 | if (result) |
630 | break; | 636 | break; |
631 | } | 637 | } |
632 | mutex_unlock(&thermal_list_lock); | 638 | mutex_unlock(&thermal_list_lock); |
633 | 639 | ||
@@ -639,11 +645,11 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, | |||
639 | device_unregister(&tz->device); | 645 | device_unregister(&tz->device); |
640 | return NULL; | 646 | return NULL; |
641 | } | 647 | } |
648 | |||
642 | EXPORT_SYMBOL(thermal_zone_device_register); | 649 | EXPORT_SYMBOL(thermal_zone_device_register); |
643 | 650 | ||
644 | /** | 651 | /** |
645 | * thermal_device_unregister - removes the registered thermal zone device | 652 | * thermal_device_unregister - removes the registered thermal zone device |
646 | * | ||
647 | * @tz: the thermal zone device to remove | 653 | * @tz: the thermal zone device to remove |
648 | */ | 654 | */ |
649 | void thermal_zone_device_unregister(struct thermal_zone_device *tz) | 655 | void thermal_zone_device_unregister(struct thermal_zone_device *tz) |
@@ -685,6 +691,7 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) | |||
685 | device_unregister(&tz->device); | 691 | device_unregister(&tz->device); |
686 | return; | 692 | return; |
687 | } | 693 | } |
694 | |||
688 | EXPORT_SYMBOL(thermal_zone_device_unregister); | 695 | EXPORT_SYMBOL(thermal_zone_device_unregister); |
689 | 696 | ||
690 | static int __init thermal_init(void) | 697 | static int __init thermal_init(void) |