@@ -600,10 +600,9 @@ struct thermal_zone_device *thermal_zone_get_by_id(int id)
600
600
*/
601
601
602
602
/**
603
- * thermal_zone_bind_cooling_device() - bind a cooling device to a thermal zone
603
+ * thermal_bind_cdev_to_trip - bind a cooling device to a thermal zone
604
604
* @tz: pointer to struct thermal_zone_device
605
- * @trip_index: indicates which trip point the cooling devices is
606
- * associated with in this thermal zone.
605
+ * @trip: trip point the cooling devices is associated with in this zone.
607
606
* @cdev: pointer to struct thermal_cooling_device
608
607
* @upper: the Maximum cooling state for this trip point.
609
608
* THERMAL_NO_LIMIT means no upper limit,
@@ -621,8 +620,8 @@ struct thermal_zone_device *thermal_zone_get_by_id(int id)
621
620
*
622
621
* Return: 0 on success, the proper error value otherwise.
623
622
*/
624
- int thermal_zone_bind_cooling_device (struct thermal_zone_device * tz ,
625
- int trip_index ,
623
+ int thermal_bind_cdev_to_trip (struct thermal_zone_device * tz ,
624
+ const struct thermal_trip * trip ,
626
625
struct thermal_cooling_device * cdev ,
627
626
unsigned long upper , unsigned long lower ,
628
627
unsigned int weight )
@@ -631,15 +630,9 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
631
630
struct thermal_instance * pos ;
632
631
struct thermal_zone_device * pos1 ;
633
632
struct thermal_cooling_device * pos2 ;
634
- const struct thermal_trip * trip ;
635
633
bool upper_no_limit ;
636
634
int result ;
637
635
638
- if (trip_index >= tz -> num_trips || trip_index < 0 )
639
- return - EINVAL ;
640
-
641
- trip = & tz -> trips [trip_index ];
642
-
643
636
list_for_each_entry (pos1 , & thermal_tz_list , node ) {
644
637
if (pos1 == tz )
645
638
break ;
@@ -736,14 +729,26 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
736
729
kfree (dev );
737
730
return result ;
738
731
}
732
+ EXPORT_SYMBOL_GPL (thermal_bind_cdev_to_trip );
733
+
734
+ int thermal_zone_bind_cooling_device (struct thermal_zone_device * tz ,
735
+ int trip_index ,
736
+ struct thermal_cooling_device * cdev ,
737
+ unsigned long upper , unsigned long lower ,
738
+ unsigned int weight )
739
+ {
740
+ if (trip_index < 0 || trip_index >= tz -> num_trips )
741
+ return - EINVAL ;
742
+
743
+ return thermal_bind_cdev_to_trip (tz , & tz -> trips [trip_index ], cdev ,
744
+ upper , lower , weight );
745
+ }
739
746
EXPORT_SYMBOL_GPL (thermal_zone_bind_cooling_device );
740
747
741
748
/**
742
- * thermal_zone_unbind_cooling_device() - unbind a cooling device from a
743
- * thermal zone.
749
+ * thermal_unbind_cdev_from_trip - unbind a cooling device from a thermal zone.
744
750
* @tz: pointer to a struct thermal_zone_device.
745
- * @trip_index: indicates which trip point the cooling devices is
746
- * associated with in this thermal zone.
751
+ * @trip: trip point the cooling devices is associated with in this zone.
747
752
* @cdev: pointer to a struct thermal_cooling_device.
748
753
*
749
754
* This interface function unbind a thermal cooling device from the certain
@@ -752,16 +757,14 @@ EXPORT_SYMBOL_GPL(thermal_zone_bind_cooling_device);
752
757
*
753
758
* Return: 0 on success, the proper error value otherwise.
754
759
*/
755
- int thermal_zone_unbind_cooling_device (struct thermal_zone_device * tz ,
756
- int trip_index ,
757
- struct thermal_cooling_device * cdev )
760
+ int thermal_unbind_cdev_from_trip (struct thermal_zone_device * tz ,
761
+ const struct thermal_trip * trip ,
762
+ struct thermal_cooling_device * cdev )
758
763
{
759
764
struct thermal_instance * pos , * next ;
760
- const struct thermal_trip * trip ;
761
765
762
766
mutex_lock (& tz -> lock );
763
767
mutex_lock (& cdev -> lock );
764
- trip = & tz -> trips [trip_index ];
765
768
list_for_each_entry_safe (pos , next , & tz -> thermal_instances , tz_node ) {
766
769
if (pos -> tz == tz && pos -> trip == trip && pos -> cdev == cdev ) {
767
770
list_del (& pos -> tz_node );
@@ -784,6 +787,17 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
784
787
kfree (pos );
785
788
return 0 ;
786
789
}
790
+ EXPORT_SYMBOL_GPL (thermal_unbind_cdev_from_trip );
791
+
792
+ int thermal_zone_unbind_cooling_device (struct thermal_zone_device * tz ,
793
+ int trip_index ,
794
+ struct thermal_cooling_device * cdev )
795
+ {
796
+ if (trip_index < 0 || trip_index >= tz -> num_trips )
797
+ return - EINVAL ;
798
+
799
+ return thermal_unbind_cdev_from_trip (tz , & tz -> trips [trip_index ], cdev );
800
+ }
787
801
EXPORT_SYMBOL_GPL (thermal_zone_unbind_cooling_device );
788
802
789
803
static void thermal_release (struct device * dev )
0 commit comments