@@ -347,10 +347,6 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip_id)
347347{
348348 struct thermal_trip trip ;
349349
350- /* Ignore disabled trip points */
351- if (test_bit (trip_id , & tz -> trips_disabled ))
352- return ;
353-
354350 __thermal_zone_get_trip (tz , trip_id , & trip );
355351
356352 if (trip .temperature == THERMAL_TEMP_INVALID )
@@ -604,10 +600,9 @@ struct thermal_zone_device *thermal_zone_get_by_id(int id)
604600 */
605601
606602/**
607- * 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
608604 * @tz: pointer to struct thermal_zone_device
609- * @trip: indicates which trip point the cooling devices is
610- * associated with in this thermal zone.
605+ * @trip: trip point the cooling devices is associated with in this zone.
611606 * @cdev: pointer to struct thermal_cooling_device
612607 * @upper: the Maximum cooling state for this trip point.
613608 * THERMAL_NO_LIMIT means no upper limit,
@@ -625,8 +620,8 @@ struct thermal_zone_device *thermal_zone_get_by_id(int id)
625620 *
626621 * Return: 0 on success, the proper error value otherwise.
627622 */
628- int thermal_zone_bind_cooling_device (struct thermal_zone_device * tz ,
629- int trip ,
623+ int thermal_bind_cdev_to_trip (struct thermal_zone_device * tz ,
624+ const struct thermal_trip * trip ,
630625 struct thermal_cooling_device * cdev ,
631626 unsigned long upper , unsigned long lower ,
632627 unsigned int weight )
@@ -638,9 +633,6 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
638633 bool upper_no_limit ;
639634 int result ;
640635
641- if (trip >= tz -> num_trips || trip < 0 )
642- return - EINVAL ;
643-
644636 list_for_each_entry (pos1 , & thermal_tz_list , node ) {
645637 if (pos1 == tz )
646638 break ;
@@ -737,14 +729,26 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
737729 kfree (dev );
738730 return result ;
739731}
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+ }
740746EXPORT_SYMBOL_GPL (thermal_zone_bind_cooling_device );
741747
742748/**
743- * thermal_zone_unbind_cooling_device() - unbind a cooling device from a
744- * thermal zone.
749+ * thermal_unbind_cdev_from_trip - unbind a cooling device from a thermal zone.
745750 * @tz: pointer to a struct thermal_zone_device.
746- * @trip: indicates which trip point the cooling devices is
747- * associated with in this thermal zone.
751+ * @trip: trip point the cooling devices is associated with in this zone.
748752 * @cdev: pointer to a struct thermal_cooling_device.
749753 *
750754 * This interface function unbind a thermal cooling device from the certain
@@ -753,9 +757,9 @@ EXPORT_SYMBOL_GPL(thermal_zone_bind_cooling_device);
753757 *
754758 * Return: 0 on success, the proper error value otherwise.
755759 */
756- int thermal_zone_unbind_cooling_device (struct thermal_zone_device * tz ,
757- int trip ,
758- 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 )
759763{
760764 struct thermal_instance * pos , * next ;
761765
@@ -783,6 +787,17 @@ int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
783787 kfree (pos );
784788 return 0 ;
785789}
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+ }
786801EXPORT_SYMBOL_GPL (thermal_zone_unbind_cooling_device );
787802
788803static void thermal_release (struct device * dev )
@@ -1231,7 +1246,6 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t
12311246 struct thermal_zone_device * tz ;
12321247 int id ;
12331248 int result ;
1234- int count ;
12351249 struct thermal_governor * governor ;
12361250
12371251 if (!type || strlen (type ) == 0 ) {
@@ -1328,14 +1342,6 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t
13281342 if (result )
13291343 goto release_device ;
13301344
1331- for (count = 0 ; count < num_trips ; count ++ ) {
1332- struct thermal_trip trip ;
1333-
1334- result = thermal_zone_get_trip (tz , count , & trip );
1335- if (result || !trip .temperature )
1336- set_bit (count , & tz -> trips_disabled );
1337- }
1338-
13391345 /* Update 'this' zone's governor information */
13401346 mutex_lock (& thermal_governor_lock );
13411347
0 commit comments