* [PATCH v1] thermal: core: Drop unused .get_trip_*() callbacks
@ 2023-08-25 16:16 Rafael J. Wysocki
2023-08-25 16:42 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2023-08-25 16:16 UTC (permalink / raw)
To: Linux PM
Cc: Linux ACPI, LKML, Daniel Lezcano, Zhang Rui, Srinivas Pandruvada,
Amit Kucheria
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
After recent changes in the ACPI thermal driver and in the Intel DTS
IOSF thermal driver, all thermal zone drivers are expected to use trip
tables for initialization and none of them should implement
.get_trip_type(), .get_trip_temp() or .get_trip_hyst() callbacks, so
drop these callbacks entirely from the core.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/thermal/thermal_core.c | 2 +-
drivers/thermal/thermal_trip.c | 22 +++-------------------
include/linux/thermal.h | 4 ----
3 files changed, 4 insertions(+), 24 deletions(-)
Index: linux-pm/include/linux/thermal.h
===================================================================
--- linux-pm.orig/include/linux/thermal.h
+++ linux-pm/include/linux/thermal.h
@@ -76,11 +76,7 @@ struct thermal_zone_device_ops {
int (*set_trips) (struct thermal_zone_device *, int, int);
int (*change_mode) (struct thermal_zone_device *,
enum thermal_device_mode);
- int (*get_trip_type) (struct thermal_zone_device *, int,
- enum thermal_trip_type *);
- int (*get_trip_temp) (struct thermal_zone_device *, int, int *);
int (*set_trip_temp) (struct thermal_zone_device *, int, int);
- int (*get_trip_hyst) (struct thermal_zone_device *, int, int *);
int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
int (*get_crit_temp) (struct thermal_zone_device *, int *);
int (*set_emul_temp) (struct thermal_zone_device *, int);
Index: linux-pm/drivers/thermal/thermal_trip.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_trip.c
+++ linux-pm/drivers/thermal/thermal_trip.c
@@ -118,27 +118,11 @@ int __thermal_zone_get_trip(struct therm
{
int ret;
- if (!tz || trip_id < 0 || trip_id >= tz->num_trips || !trip)
+ if (!tz || !tz->trips || trip_id < 0 || trip_id >= tz->num_trips || !trip)
return -EINVAL;
- if (tz->trips) {
- *trip = tz->trips[trip_id];
- return 0;
- }
-
- if (tz->ops->get_trip_hyst) {
- ret = tz->ops->get_trip_hyst(tz, trip_id, &trip->hysteresis);
- if (ret)
- return ret;
- } else {
- trip->hysteresis = 0;
- }
-
- ret = tz->ops->get_trip_temp(tz, trip_id, &trip->temperature);
- if (ret)
- return ret;
-
- return tz->ops->get_trip_type(tz, trip_id, &trip->type);
+ *trip = tz->trips[trip_id];
+ return 0;
}
EXPORT_SYMBOL_GPL(__thermal_zone_get_trip);
Index: linux-pm/drivers/thermal/thermal_core.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_core.c
+++ linux-pm/drivers/thermal/thermal_core.c
@@ -1266,7 +1266,7 @@ thermal_zone_device_register_with_trips(
return ERR_PTR(-EINVAL);
}
- if (num_trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp) && !trips)
+ if (num_trips > 0 && !trips)
return ERR_PTR(-EINVAL);
if (!thermal_class)
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v1] thermal: core: Drop unused .get_trip_*() callbacks
2023-08-25 16:16 [PATCH v1] thermal: core: Drop unused .get_trip_*() callbacks Rafael J. Wysocki
@ 2023-08-25 16:42 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2023-08-25 16:42 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Linux PM, Linux ACPI, LKML, Daniel Lezcano, Zhang Rui,
Srinivas Pandruvada, Amit Kucheria
On Fri, Aug 25, 2023 at 6:17 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> After recent changes in the ACPI thermal driver and in the Intel DTS
> IOSF thermal driver, all thermal zone drivers are expected to use trip
> tables for initialization and none of them should implement
> .get_trip_type(), .get_trip_temp() or .get_trip_hyst() callbacks, so
> drop these callbacks entirely from the core.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/thermal/thermal_core.c | 2 +-
> drivers/thermal/thermal_trip.c | 22 +++-------------------
> include/linux/thermal.h | 4 ----
> 3 files changed, 4 insertions(+), 24 deletions(-)
>
> Index: linux-pm/include/linux/thermal.h
> ===================================================================
> --- linux-pm.orig/include/linux/thermal.h
> +++ linux-pm/include/linux/thermal.h
> @@ -76,11 +76,7 @@ struct thermal_zone_device_ops {
> int (*set_trips) (struct thermal_zone_device *, int, int);
> int (*change_mode) (struct thermal_zone_device *,
> enum thermal_device_mode);
> - int (*get_trip_type) (struct thermal_zone_device *, int,
> - enum thermal_trip_type *);
> - int (*get_trip_temp) (struct thermal_zone_device *, int, int *);
> int (*set_trip_temp) (struct thermal_zone_device *, int, int);
> - int (*get_trip_hyst) (struct thermal_zone_device *, int, int *);
> int (*set_trip_hyst) (struct thermal_zone_device *, int, int);
> int (*get_crit_temp) (struct thermal_zone_device *, int *);
> int (*set_emul_temp) (struct thermal_zone_device *, int);
> Index: linux-pm/drivers/thermal/thermal_trip.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_trip.c
> +++ linux-pm/drivers/thermal/thermal_trip.c
> @@ -118,27 +118,11 @@ int __thermal_zone_get_trip(struct therm
> {
> int ret;
The above needs to be dropped from this function too, but I'll fix it
up when applying the patch.
Hopefully, that will be fine with everyone.
>
> - if (!tz || trip_id < 0 || trip_id >= tz->num_trips || !trip)
> + if (!tz || !tz->trips || trip_id < 0 || trip_id >= tz->num_trips || !trip)
> return -EINVAL;
>
> - if (tz->trips) {
> - *trip = tz->trips[trip_id];
> - return 0;
> - }
> -
> - if (tz->ops->get_trip_hyst) {
> - ret = tz->ops->get_trip_hyst(tz, trip_id, &trip->hysteresis);
> - if (ret)
> - return ret;
> - } else {
> - trip->hysteresis = 0;
> - }
> -
> - ret = tz->ops->get_trip_temp(tz, trip_id, &trip->temperature);
> - if (ret)
> - return ret;
> -
> - return tz->ops->get_trip_type(tz, trip_id, &trip->type);
> + *trip = tz->trips[trip_id];
> + return 0;
> }
> EXPORT_SYMBOL_GPL(__thermal_zone_get_trip);
>
> Index: linux-pm/drivers/thermal/thermal_core.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.c
> +++ linux-pm/drivers/thermal/thermal_core.c
> @@ -1266,7 +1266,7 @@ thermal_zone_device_register_with_trips(
> return ERR_PTR(-EINVAL);
> }
>
> - if (num_trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp) && !trips)
> + if (num_trips > 0 && !trips)
> return ERR_PTR(-EINVAL);
>
> if (!thermal_class)
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-25 16:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-25 16:16 [PATCH v1] thermal: core: Drop unused .get_trip_*() callbacks Rafael J. Wysocki
2023-08-25 16:42 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®