thermal: helpers: Drop get_thermal_instance()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 2 Aug 2024 11:56:04 +0000 (13:56 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 2 Aug 2024 11:57:04 +0000 (13:57 +0200)
There are no more users of get_thermal_instance(), so drop it.

While at it, replace get_instance() returning a pointer to struct
thermal_instance with thermal_instance_present() returning a bool
which is more straightforward.

No functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/2014591.usQuhbGJ8B@rjwysocki.net
[ rjw: Dropped get_thermal_instance() documentation ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Documentation/driver-api/thermal/sysfs-api.rst
drivers/thermal/thermal_core.h
drivers/thermal/thermal_helpers.c

index 978198f8a18bed3e1aa19d8f4009b524583feed4..15fb59a9365d163be0387619f4c8f81273ac0aaf 100644 (file)
@@ -459,14 +459,7 @@ are supposed to implement the callback. If they don't, the thermal
 framework calculated the trend by comparing the previous and the current
 temperature values.
 
-4.2. get_thermal_instance
--------------------------
-
-This function returns the thermal_instance corresponding to a given
-{thermal_zone, cooling_device, trip_point} combination. Returns NULL
-if such an instance does not exist.
-
-4.3. thermal_cdev_update
+4.2. thermal_cdev_update
 ------------------------
 
 This function serves as an arbitrator to set the state of a cooling
index 4cf2b7230d04bb6578328661e82b26ec8795fdc4..e03079708b6c513deea156e1d88f7a0bb3bf73b0 100644 (file)
@@ -204,11 +204,6 @@ void __thermal_cdev_update(struct thermal_cooling_device *cdev);
 
 int get_tz_trend(struct thermal_zone_device *tz, const struct thermal_trip *trip);
 
-struct thermal_instance *
-get_thermal_instance(struct thermal_zone_device *tz,
-                    struct thermal_cooling_device *cdev,
-                    int trip);
-
 /*
  * This structure is used to describe the behavior of
  * a certain cooling device on a certain trip point
index aedb8369e2aa2dc84455841609388c9738fa4a5f..be477b153addf9fd3c07ded082282a5ffb6d10b4 100644 (file)
@@ -39,18 +39,18 @@ int get_tz_trend(struct thermal_zone_device *tz, const struct thermal_trip *trip
        return trend;
 }
 
-static struct thermal_instance *get_instance(struct thermal_zone_device *tz,
-                                            struct thermal_cooling_device *cdev,
-                                            const struct thermal_trip *trip)
+static bool thermal_instance_present(struct thermal_zone_device *tz,
+                                    struct thermal_cooling_device *cdev,
+                                    const struct thermal_trip *trip)
 {
        struct thermal_instance *ti;
 
        list_for_each_entry(ti, &tz->thermal_instances, tz_node) {
                if (ti->trip == trip && ti->cdev == cdev)
-                       return ti;
+                       return true;
        }
 
-       return NULL;
+       return false;
 }
 
 bool thermal_trip_is_bound_to_cdev(struct thermal_zone_device *tz,
@@ -62,7 +62,7 @@ bool thermal_trip_is_bound_to_cdev(struct thermal_zone_device *tz,
        mutex_lock(&tz->lock);
        mutex_lock(&cdev->lock);
 
-       ret = !!get_instance(tz, cdev, trip);
+       ret = thermal_instance_present(tz, cdev, trip);
 
        mutex_unlock(&cdev->lock);
        mutex_unlock(&tz->lock);
@@ -71,24 +71,6 @@ bool thermal_trip_is_bound_to_cdev(struct thermal_zone_device *tz,
 }
 EXPORT_SYMBOL_GPL(thermal_trip_is_bound_to_cdev);
 
-struct thermal_instance *
-get_thermal_instance(struct thermal_zone_device *tz,
-                    struct thermal_cooling_device *cdev, int trip_index)
-{
-       struct thermal_instance *ti;
-
-       mutex_lock(&tz->lock);
-       mutex_lock(&cdev->lock);
-
-       ti = get_instance(tz, cdev, &tz->trips[trip_index].trip);
-
-       mutex_unlock(&cdev->lock);
-       mutex_unlock(&tz->lock);
-
-       return ti;
-}
-EXPORT_SYMBOL(get_thermal_instance);
-
 /**
  * __thermal_zone_get_temp() - returns the temperature of a thermal zone
  * @tz: a valid pointer to a struct thermal_zone_device