Message ID | 20220507125443.2766939-2-daniel.lezcano@linexp.org |
---|---|
State | New |
Headers | show |
Series | [v2,01/14] thermal/core: Change thermal_zone_ops to thermal_sensor_ops | expand |
On Sat, May 07, 2022 at 02:54:29PM +0200, Daniel Lezcano wrote: > A thermal zone is software abstraction of a sensor associated with > properties and cooling devices if any. > > The fact that we have thermal_zone and thermal_zone_ops mixed is > confusing and does not clearly identify the different components > entering in the thermal management process. A thermal zone appears to > be a sensor while it is not. > > In order to set the scene for multiple thermal sensors aggregated into > a single thermal zone. Rename the thermal_zone_ops to > thermal_sensor_ops, that will appear clearyl the thermal zone is not a > sensor but an abstraction of one [or multiple] sensor(s). Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> for whatever drivers in this series I have somehow been involved into.
Hi Daniel, Thanks for your patch! On Sat, May 7, 2022 at 3:03 PM Daniel Lezcano <daniel.lezcano@linexp.org> wrote: > A thermal zone is software abstraction of a sensor associated with > properties and cooling devices if any. > > The fact that we have thermal_zone and thermal_zone_ops mixed is > confusing and does not clearly identify the different components > entering in the thermal management process. A thermal zone appears to > be a sensor while it is not. > > In order to set the scene for multiple thermal sensors aggregated into > a single thermal zone. Rename the thermal_zone_ops to > thermal_sensor_ops, that will appear clearyl the thermal zone is not a to make it clear > sensor but an abstraction of one [or multiple] sensor(s). > > Cc: Alexandre Bailon <abailon@baylibre.com> > Cc: Kevin Hilman <khilman@baylibre.com> > Cc; Eduardo Valentin <eduval@amazon.com> > Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org> > drivers/thermal/rcar_thermal.c | 4 ++-- Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
On Sat, May 7, 2022 at 2:55 PM Daniel Lezcano <daniel.lezcano@linexp.org> wrote: > > A thermal zone is software abstraction of a sensor associated with > properties and cooling devices if any. > > The fact that we have thermal_zone and thermal_zone_ops mixed is > confusing and does not clearly identify the different components > entering in the thermal management process. A thermal zone appears to > be a sensor while it is not. Well, the majority of the operations in thermal_zone_ops don't apply to thermal sensors. For example, ->set_trips(), ->get_trip_type(), ->get_trip_temp(). > In order to set the scene for multiple thermal sensors aggregated into > a single thermal zone. Rename the thermal_zone_ops to > thermal_sensor_ops, that will appear clearyl the thermal zone is not a > sensor but an abstraction of one [or multiple] sensor(s). So I'm not convinced that the renaming mentioned above is particularly clean either. IMV the way to go would be to split the thermal sensor operations, like ->get_temp(), out of thermal_zone_ops. But then it is not clear what a thermal zone with multiple sensors in it really means. I guess it would require an aggregation function to combine the thermal sensors in it that would produce an effective temperature to check against the trip points. Honestly, I don't think that setting a separate set of trips for each sensor in a thermal zone would make a lot of sense.
On Tue, 2022-05-17 at 17:42 +0200, Rafael J. Wysocki wrote: > On Sat, May 7, 2022 at 2:55 PM Daniel Lezcano > <daniel.lezcano@linexp.org> wrote: > > > > A thermal zone is software abstraction of a sensor associated with > > properties and cooling devices if any. > > > > The fact that we have thermal_zone and thermal_zone_ops mixed is > > confusing and does not clearly identify the different components > > entering in the thermal management process. A thermal zone appears > > to > > be a sensor while it is not. > > Well, the majority of the operations in thermal_zone_ops don't apply > to thermal sensors. For example, ->set_trips(), ->get_trip_type(), > ->get_trip_temp(). > In past we discussed adding thermal sensor sysfs with threshold to notify temperature. So sensor can have set/get_threshold() functions instead of the set/get_trip for zones. Like we have /sys/class/thermal_zone* we can have /sys/class/thermal_sensor*. Thermal sensor(s) are bound to thermal zones. This can also include multiple sensors in a zone and can create a virtual sensor also. Thanks, Srinivas > > In order to set the scene for multiple thermal sensors aggregated > > into > > a single thermal zone. Rename the thermal_zone_ops to > > thermal_sensor_ops, that will appear clearyl the thermal zone is > > not a > > sensor but an abstraction of one [or multiple] sensor(s). > > So I'm not convinced that the renaming mentioned above is > particularly > clean either. > > IMV the way to go would be to split the thermal sensor operations, > like ->get_temp(), out of thermal_zone_ops. > > But then it is not clear what a thermal zone with multiple sensors in > it really means. I guess it would require an aggregation function to > combine the thermal sensors in it that would produce an effective > temperature to check against the trip points. > > Honestly, I don't think that setting a separate set of trips for each > sensor in a thermal zone would make a lot of sense.
On Tue, May 17, 2022 at 6:51 PM srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote: > > On Tue, 2022-05-17 at 17:42 +0200, Rafael J. Wysocki wrote: > > On Sat, May 7, 2022 at 2:55 PM Daniel Lezcano > > <daniel.lezcano@linexp.org> wrote: > > > > > > A thermal zone is software abstraction of a sensor associated with > > > properties and cooling devices if any. > > > > > > The fact that we have thermal_zone and thermal_zone_ops mixed is > > > confusing and does not clearly identify the different components > > > entering in the thermal management process. A thermal zone appears > > > to > > > be a sensor while it is not. > > > > Well, the majority of the operations in thermal_zone_ops don't apply > > to thermal sensors. For example, ->set_trips(), ->get_trip_type(), > > ->get_trip_temp(). > > > In past we discussed adding thermal sensor sysfs with threshold to > notify temperature. > > So sensor can have set/get_threshold() functions instead of the > set/get_trip for zones. > > Like we have /sys/class/thermal_zone* we can have > /sys/class/thermal_sensor*. Exactly, so renaming thermal_zone_ops as thermal_sensor_ops isn't quite helpful in this respect. IMO there should be operations for sensors and there should be operations for thermal zones and those two sets of operations should be different. > Thermal sensor(s) are bound to thermal zones. So I think that this binding should be analogous to the binding between thermal zones and cooling devices. > This can also include multiple sensors in a zone and can create a virtual sensor also. It can. However, what's the difference between a thermal zone with multiple sensors and a thermal zone with one virtual sensor being an aggregate of multiple physical sensors? Both involve some type of aggregation of temperature values measured by the physical sensors. > > > In order to set the scene for multiple thermal sensors aggregated > > > into > > > a single thermal zone. Rename the thermal_zone_ops to > > > thermal_sensor_ops, that will appear clearyl the thermal zone is > > > not a > > > sensor but an abstraction of one [or multiple] sensor(s). > > > > So I'm not convinced that the renaming mentioned above is > > particularly > > clean either. > > > > IMV the way to go would be to split the thermal sensor operations, > > like ->get_temp(), out of thermal_zone_ops. > > > > But then it is not clear what a thermal zone with multiple sensors in > > it really means. I guess it would require an aggregation function to > > combine the thermal sensors in it that would produce an effective > > temperature to check against the trip points. > > > > Honestly, I don't think that setting a separate set of trips for each > > sensor in a thermal zone would make a lot of sense. >
On Tue, 2022-05-17 at 20:53 +0200, Rafael J. Wysocki wrote: > On Tue, May 17, 2022 at 6:51 PM srinivas pandruvada > <srinivas.pandruvada@linux.intel.com> wrote: > > > > On Tue, 2022-05-17 at 17:42 +0200, Rafael J. Wysocki wrote: > > > On Sat, May 7, 2022 at 2:55 PM Daniel Lezcano > > > <daniel.lezcano@linexp.org> wrote: > > > > > > > > A thermal zone is software abstraction of a sensor associated > > > > with > > > > properties and cooling devices if any. > > > > > > > > The fact that we have thermal_zone and thermal_zone_ops mixed > > > > is > > > > confusing and does not clearly identify the different > > > > components > > > > entering in the thermal management process. A thermal zone > > > > appears > > > > to > > > > be a sensor while it is not. > > > > > > Well, the majority of the operations in thermal_zone_ops don't > > > apply > > > to thermal sensors. For example, ->set_trips(), - > > > >get_trip_type(), > > > ->get_trip_temp(). > > > > > In past we discussed adding thermal sensor sysfs with threshold to > > notify temperature. > > > > So sensor can have set/get_threshold() functions instead of the > > set/get_trip for zones. > > > > Like we have /sys/class/thermal_zone* we can have > > /sys/class/thermal_sensor*. > > Exactly, so renaming thermal_zone_ops as thermal_sensor_ops isn't > quite helpful in this respect. > > IMO there should be operations for sensors and there should be > operations for thermal zones and those two sets of operations should > be different. > > > Thermal sensor(s) are bound to thermal zones. > > So I think that this binding should be analogous to the binding > between thermal zones and cooling devices. > > > This can also include multiple sensors in a zone and can create a > > virtual sensor also. > > It can. > > However, what's the difference between a thermal zone with multiple > sensors and a thermal zone with one virtual sensor being an aggregate > of multiple physical sensors? > Either way is fine. A thermal sensor can be aggregate of other sensors. > Both involve some type of aggregation of temperature values measured > by the physical sensors. > > > > > In order to set the scene for multiple thermal sensors > > > > aggregated > > > > into > > > > a single thermal zone. Rename the thermal_zone_ops to > > > > thermal_sensor_ops, that will appear clearyl the thermal zone > > > > is > > > > not a > > > > sensor but an abstraction of one [or multiple] sensor(s). > > > > > > So I'm not convinced that the renaming mentioned above is > > > particularly > > > clean either. > > > > > > IMV the way to go would be to split the thermal sensor > > > operations, > > > like ->get_temp(), out of thermal_zone_ops. > > > > > > But then it is not clear what a thermal zone with multiple > > > sensors in > > > it really means. I guess it would require an aggregation > > > function to > > > combine the thermal sensors in it that would produce an effective > > > temperature to check against the trip points. > > > > > > Honestly, I don't think that setting a separate set of trips for > > > each > > > sensor in a thermal zone would make a lot of sense. > >
On Tue, May 17, 2022 at 9:02 PM srinivas pandruvada <srinivas.pandruvada@linux.intel.com> wrote: > > On Tue, 2022-05-17 at 20:53 +0200, Rafael J. Wysocki wrote: > > On Tue, May 17, 2022 at 6:51 PM srinivas pandruvada > > <srinivas.pandruvada@linux.intel.com> wrote: > > > > > > On Tue, 2022-05-17 at 17:42 +0200, Rafael J. Wysocki wrote: > > > > On Sat, May 7, 2022 at 2:55 PM Daniel Lezcano > > > > <daniel.lezcano@linexp.org> wrote: > > > > > > > > > > A thermal zone is software abstraction of a sensor associated > > > > > with > > > > > properties and cooling devices if any. > > > > > > > > > > The fact that we have thermal_zone and thermal_zone_ops mixed > > > > > is > > > > > confusing and does not clearly identify the different > > > > > components > > > > > entering in the thermal management process. A thermal zone > > > > > appears > > > > > to > > > > > be a sensor while it is not. > > > > > > > > Well, the majority of the operations in thermal_zone_ops don't > > > > apply > > > > to thermal sensors. For example, ->set_trips(), - > > > > >get_trip_type(), > > > > ->get_trip_temp(). > > > > > > > In past we discussed adding thermal sensor sysfs with threshold to > > > notify temperature. > > > > > > So sensor can have set/get_threshold() functions instead of the > > > set/get_trip for zones. > > > > > > Like we have /sys/class/thermal_zone* we can have > > > /sys/class/thermal_sensor*. > > > > Exactly, so renaming thermal_zone_ops as thermal_sensor_ops isn't > > quite helpful in this respect. > > > > IMO there should be operations for sensors and there should be > > operations for thermal zones and those two sets of operations should > > be different. > > > > > Thermal sensor(s) are bound to thermal zones. > > > > So I think that this binding should be analogous to the binding > > between thermal zones and cooling devices. > > > > > This can also include multiple sensors in a zone and can create a > > > virtual sensor also. > > > > It can. > > > > However, what's the difference between a thermal zone with multiple > > sensors and a thermal zone with one virtual sensor being an aggregate > > of multiple physical sensors? > > > Either way is fine. A thermal sensor can be aggregate of other sensors. Agreed. But the point is that if we go with thermal zones bound to multiple physical sensors, I don't see much point in using virtual sensors. And the other way around. Daniel seems to be preferring the thermal zones bound to multiple physical sensors approach. > > Both involve some type of aggregation of temperature values measured > > by the physical sensors. > > > > > > > In order to set the scene for multiple thermal sensors > > > > > aggregated > > > > > into > > > > > a single thermal zone. Rename the thermal_zone_ops to > > > > > thermal_sensor_ops, that will appear clearyl the thermal zone > > > > > is > > > > > not a > > > > > sensor but an abstraction of one [or multiple] sensor(s). > > > > > > > > So I'm not convinced that the renaming mentioned above is > > > > particularly > > > > clean either. > > > > > > > > IMV the way to go would be to split the thermal sensor > > > > operations, > > > > like ->get_temp(), out of thermal_zone_ops. > > > > > > > > But then it is not clear what a thermal zone with multiple > > > > sensors in > > > > it really means. I guess it would require an aggregation > > > > function to > > > > combine the thermal sensors in it that would produce an effective > > > > temperature to check against the trip points. > > > > > > > > Honestly, I don't think that setting a separate set of trips for > > > > each > > > > sensor in a thermal zone would make a lot of sense. > > > >
Hi Rafael, sorry for the delay, I was OoO. On 17/05/2022 17:42, Rafael J. Wysocki wrote: > On Sat, May 7, 2022 at 2:55 PM Daniel Lezcano <daniel.lezcano@linexp.org> wrote: >> >> A thermal zone is software abstraction of a sensor associated with >> properties and cooling devices if any. >> >> The fact that we have thermal_zone and thermal_zone_ops mixed is >> confusing and does not clearly identify the different components >> entering in the thermal management process. A thermal zone appears to >> be a sensor while it is not. > > Well, the majority of the operations in thermal_zone_ops don't apply > to thermal sensors. For example, ->set_trips(), ->get_trip_type(), > ->get_trip_temp(). The set_trips is necessary to set the sensor interrupt to fire when the trip temperature is crossed the way up or down. >> In order to set the scene for multiple thermal sensors aggregated into >> a single thermal zone. Rename the thermal_zone_ops to >> thermal_sensor_ops, that will appear clearyl the thermal zone is not a >> sensor but an abstraction of one [or multiple] sensor(s). > > So I'm not convinced that the renaming mentioned above is particularly > clean either. > > IMV the way to go would be to split the thermal sensor operations, > like ->get_temp(), out of thermal_zone_ops. Probably, we should first replace all the calls to ops->get_temp with a function. Then create the ops for the sensor: - get_trend - get_temp - set_trips - bind / unbind > But then it is not clear what a thermal zone with multiple sensors in > it really means. I guess it would require an aggregation function to > combine the thermal sensors in it that would produce an effective > temperature to check against the trip points. Yes, that is why the above ops->get_temp should be wrapped into a function which can evolve to an aggregation function. > Honestly, I don't think that setting a separate set of trips for each > sensor in a thermal zone would make a lot of sense. I agree the set_trips is for the interrupt mode only.
diff --git a/Documentation/driver-api/thermal/sysfs-api.rst b/Documentation/driver-api/thermal/sysfs-api.rst index 2e0f79a9e2ee..6dff5e6e1166 100644 --- a/Documentation/driver-api/thermal/sysfs-api.rst +++ b/Documentation/driver-api/thermal/sysfs-api.rst @@ -41,7 +41,7 @@ temperature) and throttle appropriate devices. struct thermal_zone_device *thermal_zone_device_register(char *type, int trips, int mask, void *devdata, - struct thermal_zone_device_ops *ops, + struct thermal_sensor_ops *ops, const struct thermal_zone_params *tzp, int passive_delay, int polling_delay)) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 539660ef93c7..c2b8100f9cd8 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -774,7 +774,7 @@ acpi_thermal_unbind_cooling_device(struct thermal_zone_device *thermal, return acpi_thermal_cooling_device_cb(thermal, cdev, false); } -static struct thermal_zone_device_ops acpi_thermal_zone_ops = { +static struct thermal_sensor_ops acpi_thermal_sensor_ops = { .bind = acpi_thermal_bind_cooling_device, .unbind = acpi_thermal_unbind_cooling_device, .get_temp = thermal_get_temp, @@ -808,13 +808,13 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) if (tz->trips.passive.flags.valid) tz->thermal_zone = thermal_zone_device_register("acpitz", trips, 0, tz, - &acpi_thermal_zone_ops, NULL, + &acpi_thermal_sensor_ops, NULL, tz->trips.passive.tsp*100, tz->polling_frequency*100); else tz->thermal_zone = thermal_zone_device_register("acpitz", trips, 0, tz, - &acpi_thermal_zone_ops, NULL, + &acpi_thermal_sensor_ops, NULL, 0, tz->polling_frequency*100); if (IS_ERR(tz->thermal_zone)) return -ENODEV; diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c index 9a6d65243334..239824e90fbe 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c @@ -53,7 +53,7 @@ static int cxgb4_thermal_get_trip_temp(struct thermal_zone_device *tzdev, return 0; } -static struct thermal_zone_device_ops cxgb4_thermal_ops = { +static struct thermal_sensor_ops cxgb4_thermal_ops = { .get_temp = cxgb4_thermal_get_temp, .get_trip_type = cxgb4_thermal_get_trip_type, .get_trip_temp = cxgb4_thermal_get_trip_temp, diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c index 05f54bd982c0..cf609dc39acd 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c @@ -361,7 +361,7 @@ static struct thermal_zone_params mlxsw_thermal_params = { .no_hwmon = true, }; -static struct thermal_zone_device_ops mlxsw_thermal_ops = { +static struct thermal_sensor_ops mlxsw_thermal_ops = { .bind = mlxsw_thermal_bind, .unbind = mlxsw_thermal_unbind, .get_temp = mlxsw_thermal_get_temp, @@ -553,7 +553,7 @@ static int mlxsw_thermal_module_trend_get(struct thermal_zone_device *tzdev, return 0; } -static struct thermal_zone_device_ops mlxsw_thermal_module_ops = { +static struct thermal_sensor_ops mlxsw_thermal_module_ops = { .bind = mlxsw_thermal_module_bind, .unbind = mlxsw_thermal_module_unbind, .get_temp = mlxsw_thermal_module_temp_get, @@ -590,7 +590,7 @@ static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev, return 0; } -static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = { +static struct thermal_sensor_ops mlxsw_thermal_gearbox_ops = { .bind = mlxsw_thermal_module_bind, .unbind = mlxsw_thermal_module_unbind, .get_temp = mlxsw_thermal_gearbox_temp_get, diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c index 69cf3a372759..74109a7d329f 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c @@ -718,7 +718,7 @@ static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device, return ret; } -static struct thermal_zone_device_ops tzone_ops = { +static struct thermal_sensor_ops tzone_ops = { .get_temp = iwl_mvm_tzone_get_temp, .get_trip_temp = iwl_mvm_tzone_get_trip_temp, .get_trip_type = iwl_mvm_tzone_get_trip_type, diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 3463629f8764..b9e8f6c60714 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -469,7 +469,7 @@ static int acerhdf_get_crit_temp(struct thermal_zone_device *thermal, } /* bind callback functions to thermalzone */ -static struct thermal_zone_device_ops acerhdf_dev_ops = { +static struct thermal_sensor_ops acerhdf_dev_ops = { .bind = acerhdf_bind, .unbind = acerhdf_unbind, .get_temp = acerhdf_get_ec_temp, diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index d925cb137e12..5ada4a94b4e3 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -1149,7 +1149,7 @@ static int power_supply_read_temp(struct thermal_zone_device *tzd, return ret; } -static struct thermal_zone_device_ops psy_tzd_ops = { +static struct thermal_sensor_ops psy_tzd_ops = { .get_temp = power_supply_read_temp, }; diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index c2ebfb5be4b3..703ace32a217 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -416,7 +416,7 @@ static int armada_get_temp_legacy(struct thermal_zone_device *thermal, return ret; } -static struct thermal_zone_device_ops legacy_ops = { +static struct thermal_sensor_ops legacy_ops = { .get_temp = armada_get_temp_legacy, }; diff --git a/drivers/thermal/da9062-thermal.c b/drivers/thermal/da9062-thermal.c index 180edec34e07..d29953eee39f 100644 --- a/drivers/thermal/da9062-thermal.c +++ b/drivers/thermal/da9062-thermal.c @@ -170,7 +170,7 @@ static int da9062_thermal_get_temp(struct thermal_zone_device *z, return 0; } -static struct thermal_zone_device_ops da9062_thermal_ops = { +static struct thermal_sensor_ops da9062_thermal_ops = { .get_temp = da9062_thermal_get_temp, .get_trip_type = da9062_thermal_get_trip_type, .get_trip_temp = da9062_thermal_get_trip_temp, diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c index 73182eb94bc0..170a1168ae38 100644 --- a/drivers/thermal/dove_thermal.c +++ b/drivers/thermal/dove_thermal.c @@ -109,7 +109,7 @@ static int dove_get_temp(struct thermal_zone_device *thermal, return 0; } -static struct thermal_zone_device_ops ops = { +static struct thermal_sensor_ops ops = { .get_temp = dove_get_temp, }; diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 16663373b682..c57fa2029ee0 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -418,7 +418,7 @@ static int imx_unbind(struct thermal_zone_device *tz, return 0; } -static struct thermal_zone_device_ops imx_tz_ops = { +static struct thermal_sensor_ops imx_tz_ops = { .bind = imx_bind, .unbind = imx_unbind, .get_temp = imx_get_temp, diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c index 4954800b9850..cad48a886888 100644 --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c @@ -485,7 +485,7 @@ static int int3400_thermal_change_mode(struct thermal_zone_device *thermal, return result; } -static struct thermal_zone_device_ops int3400_thermal_ops = { +static struct thermal_sensor_ops int3400_thermal_ops = { .get_temp = int3400_thermal_get_temp, .change_mode = int3400_thermal_change_mode, }; diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c index 62c0aa5d0783..d78f29208352 100644 --- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c @@ -151,7 +151,7 @@ static void int340x_thermal_critical(struct thermal_zone_device *zone) dev_dbg(&zone->device, "%s: critical temperature reached\n", zone->type); } -static struct thermal_zone_device_ops int340x_thermal_zone_ops = { +static struct thermal_sensor_ops int340x_thermal_sensor_ops = { .get_temp = int340x_thermal_get_zone_temp, .get_trip_temp = int340x_thermal_get_trip_temp, .get_trip_type = int340x_thermal_get_trip_type, @@ -217,7 +217,7 @@ static struct thermal_zone_params int340x_thermal_params = { }; struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, - struct thermal_zone_device_ops *override_ops) + struct thermal_sensor_ops *override_ops) { struct int34x_thermal_zone *int34x_thermal_zone; acpi_status status; @@ -262,7 +262,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, acpi_device_bid(adev), trip_cnt, trip_mask, int34x_thermal_zone, - &int340x_thermal_zone_ops, + &int340x_thermal_sensor_ops, &int340x_thermal_params, 0, 0); if (IS_ERR(int34x_thermal_zone->zone)) { diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h index 3b4971df1b33..a25c45e2eb66 100644 --- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h +++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.h @@ -29,13 +29,13 @@ struct int34x_thermal_zone { int hot_temp; int hot_trip_id; struct thermal_zone_device *zone; - struct thermal_zone_device_ops *override_ops; + struct thermal_sensor_ops *override_ops; void *priv_data; struct acpi_lpat_conversion_table *lpat_table; }; struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *, - struct thermal_zone_device_ops *override_ops); + struct thermal_sensor_ops *override_ops); void int340x_thermal_zone_remove(struct int34x_thermal_zone *); int int340x_thermal_read_trips(struct int34x_thermal_zone *int34x_zone); diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c index a8d98f1bd6c6..4b8544f72a23 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c @@ -207,7 +207,7 @@ static int proc_thermal_get_zone_temp(struct thermal_zone_device *zone, return ret; } -static struct thermal_zone_device_ops proc_thermal_local_ops = { +static struct thermal_sensor_ops proc_thermal_local_ops = { .get_temp = proc_thermal_get_zone_temp, }; @@ -285,7 +285,7 @@ int proc_thermal_add(struct device *dev, struct proc_thermal_device *proc_priv) struct acpi_device *adev; acpi_status status; unsigned long long tmp; - struct thermal_zone_device_ops *ops = NULL; + struct thermal_sensor_ops *ops = NULL; int ret; adev = ACPI_COMPANION(dev); diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c index ca40b0967cdd..5316143b09b2 100644 --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c @@ -200,7 +200,7 @@ static int sys_set_trip_temp(struct thermal_zone_device *tzd, int trip, int temp return 0; } -static struct thermal_zone_device_ops tzone_ops = { +static struct thermal_sensor_ops tzone_ops = { .get_temp = sys_get_curr_temp, .get_trip_temp = sys_get_trip_temp, .get_trip_type = sys_get_trip_type, diff --git a/drivers/thermal/intel/intel_pch_thermal.c b/drivers/thermal/intel/intel_pch_thermal.c index 527c91f5960b..e2161ab647b0 100644 --- a/drivers/thermal/intel/intel_pch_thermal.c +++ b/drivers/thermal/intel/intel_pch_thermal.c @@ -331,7 +331,7 @@ static void pch_critical(struct thermal_zone_device *tzd) dev_dbg(&tzd->device, "%s: critical temperature reached\n", tzd->type); } -static struct thermal_zone_device_ops tzd_ops = { +static struct thermal_sensor_ops tzd_ops = { .get_temp = pch_thermal_get_temp, .get_trip_type = pch_get_trip_type, .get_trip_temp = pch_get_trip_temp, diff --git a/drivers/thermal/intel/intel_quark_dts_thermal.c b/drivers/thermal/intel/intel_quark_dts_thermal.c index 3eafc6b0e6c3..636286dc90fc 100644 --- a/drivers/thermal/intel/intel_quark_dts_thermal.c +++ b/drivers/thermal/intel/intel_quark_dts_thermal.c @@ -313,7 +313,7 @@ static int sys_change_mode(struct thermal_zone_device *tzd, return ret; } -static struct thermal_zone_device_ops tzone_ops = { +static struct thermal_sensor_ops tzone_ops = { .get_temp = sys_get_curr_temp, .get_trip_temp = sys_get_trip_temp, .get_trip_type = sys_get_trip_type, diff --git a/drivers/thermal/intel/intel_soc_dts_iosf.c b/drivers/thermal/intel/intel_soc_dts_iosf.c index 342b0bb5a56d..38ce8426fc35 100644 --- a/drivers/thermal/intel/intel_soc_dts_iosf.c +++ b/drivers/thermal/intel/intel_soc_dts_iosf.c @@ -243,7 +243,7 @@ static int sys_get_curr_temp(struct thermal_zone_device *tzd, return 0; } -static struct thermal_zone_device_ops tzone_ops = { +static struct thermal_sensor_ops tzone_ops = { .get_temp = sys_get_curr_temp, .get_trip_temp = sys_get_trip_temp, .get_trip_type = sys_get_trip_type, diff --git a/drivers/thermal/intel/x86_pkg_temp_thermal.c b/drivers/thermal/intel/x86_pkg_temp_thermal.c index 4d8edc61a78b..047e27db72fe 100644 --- a/drivers/thermal/intel/x86_pkg_temp_thermal.c +++ b/drivers/thermal/intel/x86_pkg_temp_thermal.c @@ -220,7 +220,7 @@ static int sys_get_trip_type(struct thermal_zone_device *thermal, int trip, } /* Thermal zone callback registry */ -static struct thermal_zone_device_ops tzone_ops = { +static struct thermal_sensor_ops tzone_ops = { .get_temp = sys_get_curr_temp, .get_trip_temp = sys_get_trip_temp, .get_trip_type = sys_get_trip_type, diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c index 7fb6e476c82a..d8e24549428d 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c @@ -51,7 +51,7 @@ static int kirkwood_get_temp(struct thermal_zone_device *thermal, return 0; } -static struct thermal_zone_device_ops ops = { +static struct thermal_sensor_ops ops = { .get_temp = kirkwood_get_temp, }; diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index b49f04daaf47..a7c22e85adc6 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -327,7 +327,7 @@ static const struct thermal_zone_of_device_ops rcar_thermal_zone_of_ops = { .get_temp = rcar_thermal_of_get_temp, }; -static struct thermal_zone_device_ops rcar_thermal_zone_ops = { +static struct thermal_sensor_ops rcar_thermal_sensor_ops = { .get_temp = rcar_thermal_get_temp, .get_trip_type = rcar_thermal_get_trip_type, .get_trip_temp = rcar_thermal_get_trip_temp, @@ -534,7 +534,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) priv->zone = thermal_zone_device_register( "rcar_thermal", 1, 0, priv, - &rcar_thermal_zone_ops, NULL, 0, + &rcar_thermal_sensor_ops, NULL, 0, idle); ret = thermal_zone_device_enable(priv->zone); diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c index ee33ed692e4f..462a8d4bd1c8 100644 --- a/drivers/thermal/spear_thermal.c +++ b/drivers/thermal/spear_thermal.c @@ -41,7 +41,7 @@ static inline int thermal_get_temp(struct thermal_zone_device *thermal, return 0; } -static struct thermal_zone_device_ops ops = { +static struct thermal_sensor_ops ops = { .get_temp = thermal_get_temp, }; diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c index 1276b95604fe..c42d9cae5e52 100644 --- a/drivers/thermal/st/st_thermal.c +++ b/drivers/thermal/st/st_thermal.c @@ -170,7 +170,7 @@ static int st_thermal_get_trip_temp(struct thermal_zone_device *th, return 0; } -static struct thermal_zone_device_ops st_tz_ops = { +static struct thermal_sensor_ops st_tz_ops = { .get_temp = st_thermal_get_temp, .get_trip_type = st_thermal_get_trip_type, .get_trip_temp = st_thermal_get_trip_temp, diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 82654dc8382b..065dfc179e53 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1184,7 +1184,7 @@ static void bind_tz(struct thermal_zone_device *tz) */ struct thermal_zone_device * thermal_zone_device_register(const char *type, int trips, int mask, - void *devdata, struct thermal_zone_device_ops *ops, + void *devdata, struct thermal_sensor_ops *ops, struct thermal_zone_params *tzp, int passive_delay, int polling_delay) { diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 9233f7e74454..ef953cba3504 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -360,7 +360,7 @@ static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, return -EINVAL; } -static struct thermal_zone_device_ops of_thermal_ops = { +static struct thermal_sensor_ops of_thermal_ops = { .get_trip_type = of_thermal_get_trip_type, .get_trip_temp = of_thermal_get_trip_temp, .set_trip_temp = of_thermal_set_trip_temp, @@ -1046,7 +1046,7 @@ int __init of_parse_thermal_zones(void) { struct device_node *np, *child; struct __thermal_zone *tz; - struct thermal_zone_device_ops *ops; + struct thermal_sensor_ops *ops; np = of_find_node_by_name(NULL, "thermal-zones"); if (!np) { diff --git a/include/linux/thermal.h b/include/linux/thermal.h index c314893970b3..991f7bc02d51 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -57,7 +57,7 @@ enum thermal_notify_event { THERMAL_EVENT_KEEP_ALIVE, /* Request for user space handler to respond */ }; -struct thermal_zone_device_ops { +struct thermal_sensor_ops { int (*bind) (struct thermal_zone_device *, struct thermal_cooling_device *); int (*unbind) (struct thermal_zone_device *, @@ -164,7 +164,7 @@ struct thermal_zone_device { int prev_low_trip; int prev_high_trip; atomic_t need_update; - struct thermal_zone_device_ops *ops; + struct thermal_sensor_ops *ops; struct thermal_zone_params *tzp; struct thermal_governor *governor; void *governor_data; @@ -361,7 +361,7 @@ void devm_thermal_zone_of_sensor_unregister(struct device *dev, #ifdef CONFIG_THERMAL struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, - void *, struct thermal_zone_device_ops *, + void *, struct thermal_sensor_ops *, struct thermal_zone_params *, int, int); void thermal_zone_device_unregister(struct thermal_zone_device *); @@ -396,7 +396,7 @@ void thermal_zone_device_critical(struct thermal_zone_device *tz); #else static inline struct thermal_zone_device *thermal_zone_device_register( const char *type, int trips, int mask, void *devdata, - struct thermal_zone_device_ops *ops, + struct thermal_sensor_ops *ops, struct thermal_zone_params *tzp, int passive_delay, int polling_delay) { return ERR_PTR(-ENODEV); }
A thermal zone is software abstraction of a sensor associated with properties and cooling devices if any. The fact that we have thermal_zone and thermal_zone_ops mixed is confusing and does not clearly identify the different components entering in the thermal management process. A thermal zone appears to be a sensor while it is not. In order to set the scene for multiple thermal sensors aggregated into a single thermal zone. Rename the thermal_zone_ops to thermal_sensor_ops, that will appear clearyl the thermal zone is not a sensor but an abstraction of one [or multiple] sensor(s). Cc: Alexandre Bailon <abailon@baylibre.com> Cc: Kevin Hilman <khilman@baylibre.com> Cc; Eduardo Valentin <eduval@amazon.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org> --- Documentation/driver-api/thermal/sysfs-api.rst | 2 +- drivers/acpi/thermal.c | 6 +++--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_thermal.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 6 +++--- drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 2 +- drivers/platform/x86/acerhdf.c | 2 +- drivers/power/supply/power_supply_core.c | 2 +- drivers/thermal/armada_thermal.c | 2 +- drivers/thermal/da9062-thermal.c | 2 +- drivers/thermal/dove_thermal.c | 2 +- drivers/thermal/imx_thermal.c | 2 +- drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 2 +- .../thermal/intel/int340x_thermal/int340x_thermal_zone.c | 6 +++--- .../thermal/intel/int340x_thermal/int340x_thermal_zone.h | 4 ++-- .../intel/int340x_thermal/processor_thermal_device.c | 4 ++-- .../intel/int340x_thermal/processor_thermal_device_pci.c | 2 +- drivers/thermal/intel/intel_pch_thermal.c | 2 +- drivers/thermal/intel/intel_quark_dts_thermal.c | 2 +- drivers/thermal/intel/intel_soc_dts_iosf.c | 2 +- drivers/thermal/intel/x86_pkg_temp_thermal.c | 2 +- drivers/thermal/kirkwood_thermal.c | 2 +- drivers/thermal/rcar_thermal.c | 4 ++-- drivers/thermal/spear_thermal.c | 2 +- drivers/thermal/st/st_thermal.c | 2 +- drivers/thermal/thermal_core.c | 2 +- drivers/thermal/thermal_of.c | 4 ++-- include/linux/thermal.h | 8 ++++---- 27 files changed, 40 insertions(+), 40 deletions(-)