linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] thermal/drivers/tegra: Remove a pointless call get_thermal_instance()
@ 2021-04-22 11:34 Daniel Lezcano
  2021-04-22 11:34 ` [PATCH 2/2] thermal/core: Remove unused EXPORT_SYMBOLS Daniel Lezcano
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Lezcano @ 2021-04-22 11:34 UTC (permalink / raw)
  To: daniel.lezcano
  Cc: Zhang Rui, Amit Kucheria, Thierry Reding, Jonathan Hunter,
	dingsenjie, Bhaskar Chowdhury, open list:THERMAL,
	open list:TEGRA ARCHITECTURE SUPPORT, open list

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

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/tegra/soctherm.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index 8e303e9d1dc0..355fdf32cbc1 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] thermal/core: Remove unused EXPORT_SYMBOLS
  2021-04-22 11:34 [PATCH 1/2] thermal/drivers/tegra: Remove a pointless call get_thermal_instance() Daniel Lezcano
@ 2021-04-22 11:34 ` Daniel Lezcano
  2021-04-22 11:53   ` Viresh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Lezcano @ 2021-04-22 11:34 UTC (permalink / raw)
  To: daniel.lezcano
  Cc: Jonathan Corbet, Zhang Rui, Amit Kucheria, Viresh Kumar,
	Thara Gopinath, Flavio Suligoi, open list:DOCUMENTATION,
	open list, open list:THERMAL

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.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 .../driver-api/thermal/sysfs-api.rst          | 28 +------------------
 drivers/thermal/thermal_helpers.c             |  3 --
 2 files changed, 1 insertion(+), 30 deletions(-)

diff --git a/Documentation/driver-api/thermal/sysfs-api.rst b/Documentation/driver-api/thermal/sysfs-api.rst
index 4b638c14bc16..c35266bbc119 100644
--- a/Documentation/driver-api/thermal/sysfs-api.rst
+++ b/Documentation/driver-api/thermal/sysfs-api.rst
@@ -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
diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
index 7f50f412e02a..0ecf2c66aa76 100644
--- a/drivers/thermal/thermal_helpers.c
+++ b/drivers/thermal/thermal_helpers.c
@@ -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
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] thermal/core: Remove unused EXPORT_SYMBOLS
  2021-04-22 11:34 ` [PATCH 2/2] thermal/core: Remove unused EXPORT_SYMBOLS Daniel Lezcano
@ 2021-04-22 11:53   ` Viresh Kumar
  0 siblings, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2021-04-22 11:53 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Jonathan Corbet, Zhang Rui, Amit Kucheria, Thara Gopinath,
	Flavio Suligoi, open list:DOCUMENTATION, open list,
	open list:THERMAL

On 22-04-21, 13:34, Daniel Lezcano wrote:
> 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.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  .../driver-api/thermal/sysfs-api.rst          | 28 +------------------
>  drivers/thermal/thermal_helpers.c             |  3 --
>  2 files changed, 1 insertion(+), 30 deletions(-)
> 
> diff --git a/Documentation/driver-api/thermal/sysfs-api.rst b/Documentation/driver-api/thermal/sysfs-api.rst
> index 4b638c14bc16..c35266bbc119 100644
> --- a/Documentation/driver-api/thermal/sysfs-api.rst
> +++ b/Documentation/driver-api/thermal/sysfs-api.rst
> @@ -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
> diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c
> index 7f50f412e02a..0ecf2c66aa76 100644
> --- a/drivers/thermal/thermal_helpers.c
> +++ b/drivers/thermal/thermal_helpers.c
> @@ -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

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-22 11:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22 11:34 [PATCH 1/2] thermal/drivers/tegra: Remove a pointless call get_thermal_instance() Daniel Lezcano
2021-04-22 11:34 ` [PATCH 2/2] thermal/core: Remove unused EXPORT_SYMBOLS Daniel Lezcano
2021-04-22 11:53   ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).