Skip to contentSkip to conversation

thermal/drivers/tegra: Remove a pointless call get_thermal_instance()

PATCH In review Daniel Lezcano 2 participants 3 messages Apr 22, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 thermal/drivers/tegra: Remove a pointless call get_thermal_instance()

The driver is calling get_thermal_instance() but the lookup can happen directly. Remove the call to get_thermal_instance().

---
 drivers/thermal/tegra/soctherm.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/thermal/tegra/soctherm.c +4 -6
index 8e303e9d1dc0..355fdf32cbc1 100644
@@ -621,9 +621,8 @@ static int tegra_thermctl_set_trip_temp(void *data, int trip, int temp)
 				continue;
 
 			cdev = ts->throt_cfgs[i].cdev;
-			if (get_thermal_instance(tz, cdev, trip))
-				stc = find_throttle_cfg_by_name(ts, cdev->type);
-			else
+			stc = find_throttle_cfg_by_name(ts, cdev->type);
+			if (!stc)
 				continue;
 
 			return throttrip_program(dev, sg, stc, temp);
@@ -806,9 +805,8 @@ static int tegra_soctherm_set_hwtrips(struct device *dev,
 			continue;
 
 		cdev = ts->throt_cfgs[i].cdev;
-		if (get_thermal_instance(tz, cdev, trip))
-			stc = find_throttle_cfg_by_name(ts, cdev->type);
-		else
+		stc = find_throttle_cfg_by_name(ts, cdev->type);
+		if (!stc)
 			continue;
 
 		ret = throttrip_program(dev, sg, stc, temperature);
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 thermal/core: Remove unused EXPORT_SYMBOLS

The functions exported in the thermal_helpers.c file are only used by the governors and those are not compilable as module.

Remove the EXPORT_SYMBOL as no module code needs them.

---
 .../driver-api/thermal/sysfs-api.rst          | 28 +------------------
 drivers/thermal/thermal_helpers.c             |  3 --
 2 files changed, 1 insertion(+), 30 deletions(-)
Documentation/driver-api/thermal/sysfs-api.rst +1 -27
index 4b638c14bc16..c35266bbc119 100644
@@ -711,33 +711,7 @@ method, the sys I/F structure will be built like this::
     |---temp1_input:		37000
     |---temp1_crit:		100000
 
-4. Export Symbol APIs
-=====================
-
-4.1. get_tz_trend
------------------
-
-This function returns the trend of a thermal zone, i.e the rate of change
-of temperature of the thermal zone. Ideally, the thermal sensor drivers
-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
-------------------------
-
-This function serves as an arbitrator to set the state of a cooling
-device. It sets the cooling device to the deepest cooling state if
-possible.
-
-5. thermal_emergency_poweroff
+4. thermal_emergency_poweroff
 =============================
 
 On an event of critical trip temperature crossing. Thermal framework
drivers/thermal/thermal_helpers.c +0 -3
index 7f50f412e02a..0ecf2c66aa76 100644
@@ -39,7 +39,6 @@ int get_tz_trend(struct thermal_zone_device *tz, int trip)
 
 	return trend;
 }
-EXPORT_SYMBOL(get_tz_trend);
 
 struct thermal_instance *
 get_thermal_instance(struct thermal_zone_device *tz,
@@ -63,7 +62,6 @@ get_thermal_instance(struct thermal_zone_device *tz,
 
 	return target_instance;
 }
-EXPORT_SYMBOL(get_thermal_instance);
 
 /**
  * thermal_zone_get_temp() - returns the temperature of a thermal zone
@@ -221,7 +219,6 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev)
 	trace_cdev_update(cdev, target);
 	dev_dbg(&cdev->device, "set to state %lu\n", target);
 }
-EXPORT_SYMBOL(thermal_cdev_update);
 
 /**
  * thermal_zone_get_slope - return the slope attribute of the thermal zone
Signature · 1 line
2.25.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] thermal/core: Remove unused EXPORT_SYMBOLS

Quoted 71 lines · Daniel Lezcano

The functions exported in the thermal_helpers.c file are only used by the governors and those are not compilable as module.

Remove the EXPORT_SYMBOL as no module code needs them.

---
 .../driver-api/thermal/sysfs-api.rst          | 28 +------------------
 drivers/thermal/thermal_helpers.c             |  3 --
 2 files changed, 1 insertion(+), 30 deletions(-)
Documentation/driver-api/thermal/sysfs-api.rst +1 -27
index 4b638c14bc16..c35266bbc119 100644
@@ -711,33 +711,7 @@ method, the sys I/F structure will be built like this::
     |---temp1_input:		37000
     |---temp1_crit:		100000
 
-4. Export Symbol APIs
-=====================
-
-4.1. get_tz_trend
------------------
-
-This function returns the trend of a thermal zone, i.e the rate of change
-of temperature of the thermal zone. Ideally, the thermal sensor drivers
-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
-------------------------
-
-This function serves as an arbitrator to set the state of a cooling
-device. It sets the cooling device to the deepest cooling state if
-possible.
-
-5. thermal_emergency_poweroff
+4. thermal_emergency_poweroff
 =============================
 
 On an event of critical trip temperature crossing. Thermal framework
drivers/thermal/thermal_helpers.c +0 -2
index 7f50f412e02a..0ecf2c66aa76 100644
@@ -39,7 +39,6 @@ int get_tz_trend(struct thermal_zone_device *tz, int trip)
 
 	return trend;
 }
-EXPORT_SYMBOL(get_tz_trend);
 
 struct thermal_instance *
 get_thermal_instance(struct thermal_zone_device *tz,
@@ -63,7 +62,6 @@ get_thermal_instance(struct thermal_zone_device *tz,
 
 	return target_instance;
 }
-EXPORT_SYMBOL(get_thermal_instance);
 
 /**
  * thermal_zone_get_temp() - returns the temperature of a thermal zone

drivers/thermal/thermal_helpers.c void thermal_cdev_update(struct thermal_cooling_device *cdev) · line 224

Quoted 7 lines
drivers/thermal/thermal_helpers.c +0 -1
@@ -221,7 +219,6 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev)
 	trace_cdev_update(cdev, target);
 	dev_dbg(&cdev->device, "set to state %lu\n", target);
 }
-EXPORT_SYMBOL(thermal_cdev_update);
 
 /**
  * thermal_zone_get_slope - return the slope attribute of the thermal zone
Signature · 1 line
viresh