Message ID | 3757041.MHq7AAxBmi@kreacher (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Johannes Berg |
Headers | show |
Series | thermal: Writable trip points handling rework | expand |
On Fri, Feb 09, 2024 at 03:10:24PM +0100, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > It is now possible to flag trip points with THERMAL_TRIP_WRITABLE_TEMP > to allow their temperature to be set from user space via sysfs instead > of using a nonzero writable trips mask during thermal zone registration, > so make the iwlwifi code do that. > > No intentional functional impact. > > Note that this change is requisite for dropping the mask argument from > thermal_zone_device_register_with_trips() going forward. > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > --- > > This patch obviously depends on > > https://patchwork.kernel.org/project/linux-pm/patch/8346768.T7Z3S40VBb@kreacher/ > > which has been queued up for 6.9 already. > > --- > drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > Index: linux-pm/drivers/net/wireless/intel/iwlwifi/mvm/tt.c > =================================================================== > --- linux-pm.orig/drivers/net/wireless/intel/iwlwifi/mvm/tt.c > +++ linux-pm/drivers/net/wireless/intel/iwlwifi/mvm/tt.c > @@ -667,9 +667,6 @@ static struct thermal_zone_device_ops t > .set_trip_temp = iwl_mvm_tzone_set_trip_temp, > }; > > -/* make all trips writable */ > -#define IWL_WRITABLE_TRIPS_MSK (BIT(IWL_MAX_DTS_TRIPS) - 1) > - > static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm) > { > int i, ret; > @@ -692,11 +689,12 @@ static void iwl_mvm_thermal_zone_registe > for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) { > mvm->tz_device.trips[i].temperature = THERMAL_TEMP_INVALID; > mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE; > + mvm->tz_device.trips[i].type = THERMAL_TRIP_WRITABLE_TEMP; mvm->tz_device.trips[i].flags = THERMAL_TRIP_WRITABLE_TEMP; Consider using diffrent prefix for constants to diffrenciate flags and types. Regards Stanislaw > } > mvm->tz_device.tzone = thermal_zone_device_register_with_trips(name, > mvm->tz_device.trips, > IWL_MAX_DTS_TRIPS, > - IWL_WRITABLE_TRIPS_MSK, > + 0, > mvm, &tzone_ops, > NULL, 0, 0); > if (IS_ERR(mvm->tz_device.tzone)) { > > >
On Fri, Feb 9, 2024 at 3:50 PM Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> wrote: > > On Fri, Feb 09, 2024 at 03:10:24PM +0100, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > It is now possible to flag trip points with THERMAL_TRIP_WRITABLE_TEMP > > to allow their temperature to be set from user space via sysfs instead > > of using a nonzero writable trips mask during thermal zone registration, > > so make the iwlwifi code do that. > > > > No intentional functional impact. > > > > Note that this change is requisite for dropping the mask argument from > > thermal_zone_device_register_with_trips() going forward. > > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > --- > > > > This patch obviously depends on > > > > https://patchwork.kernel.org/project/linux-pm/patch/8346768.T7Z3S40VBb@kreacher/ > > > > which has been queued up for 6.9 already. > > > > --- > > drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 6 ++---- > > 1 file changed, 2 insertions(+), 4 deletions(-) > > > > Index: linux-pm/drivers/net/wireless/intel/iwlwifi/mvm/tt.c > > =================================================================== > > --- linux-pm.orig/drivers/net/wireless/intel/iwlwifi/mvm/tt.c > > +++ linux-pm/drivers/net/wireless/intel/iwlwifi/mvm/tt.c > > @@ -667,9 +667,6 @@ static struct thermal_zone_device_ops t > > .set_trip_temp = iwl_mvm_tzone_set_trip_temp, > > }; > > > > -/* make all trips writable */ > > -#define IWL_WRITABLE_TRIPS_MSK (BIT(IWL_MAX_DTS_TRIPS) - 1) > > - > > static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm) > > { > > int i, ret; > > @@ -692,11 +689,12 @@ static void iwl_mvm_thermal_zone_registe > > for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) { > > mvm->tz_device.trips[i].temperature = THERMAL_TEMP_INVALID; > > mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE; > > + mvm->tz_device.trips[i].type = THERMAL_TRIP_WRITABLE_TEMP; > > mvm->tz_device.trips[i].flags = THERMAL_TRIP_WRITABLE_TEMP; > > Consider using diffrent prefix for constants to diffrenciate flags and types. Well, I can use THERMAL_TRIP_FLAG_RW_TEMP or similar, but is it really so confusing? I'm wondering what others think. > > } > > mvm->tz_device.tzone = thermal_zone_device_register_with_trips(name, > > mvm->tz_device.trips, > > IWL_MAX_DTS_TRIPS, > > - IWL_WRITABLE_TRIPS_MSK, > > + 0, > > mvm, &tzone_ops, > > NULL, 0, 0); > > if (IS_ERR(mvm->tz_device.tzone)) { > > > > > > >
On Fri, Feb 09, 2024 at 05:15:41PM +0100, Rafael J. Wysocki wrote: > On Fri, Feb 9, 2024 at 3:50 PM Stanislaw Gruszka > <stanislaw.gruszka@linux.intel.com> wrote: > > > > On Fri, Feb 09, 2024 at 03:10:24PM +0100, Rafael J. Wysocki wrote: > > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > > > It is now possible to flag trip points with THERMAL_TRIP_WRITABLE_TEMP > > > to allow their temperature to be set from user space via sysfs instead > > > of using a nonzero writable trips mask during thermal zone registration, > > > so make the iwlwifi code do that. > > > > > > No intentional functional impact. > > > > > > Note that this change is requisite for dropping the mask argument from > > > thermal_zone_device_register_with_trips() going forward. > > > > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > --- > > > > > > This patch obviously depends on > > > > > > https://patchwork.kernel.org/project/linux-pm/patch/8346768.T7Z3S40VBb@kreacher/ > > > > > > which has been queued up for 6.9 already. > > > > > > --- > > > drivers/net/wireless/intel/iwlwifi/mvm/tt.c | 6 ++---- > > > 1 file changed, 2 insertions(+), 4 deletions(-) > > > > > > Index: linux-pm/drivers/net/wireless/intel/iwlwifi/mvm/tt.c > > > =================================================================== > > > --- linux-pm.orig/drivers/net/wireless/intel/iwlwifi/mvm/tt.c > > > +++ linux-pm/drivers/net/wireless/intel/iwlwifi/mvm/tt.c > > > @@ -667,9 +667,6 @@ static struct thermal_zone_device_ops t > > > .set_trip_temp = iwl_mvm_tzone_set_trip_temp, > > > }; > > > > > > -/* make all trips writable */ > > > -#define IWL_WRITABLE_TRIPS_MSK (BIT(IWL_MAX_DTS_TRIPS) - 1) > > > - > > > static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm) > > > { > > > int i, ret; > > > @@ -692,11 +689,12 @@ static void iwl_mvm_thermal_zone_registe > > > for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) { > > > mvm->tz_device.trips[i].temperature = THERMAL_TEMP_INVALID; > > > mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE; > > > + mvm->tz_device.trips[i].type = THERMAL_TRIP_WRITABLE_TEMP; > > > > mvm->tz_device.trips[i].flags = THERMAL_TRIP_WRITABLE_TEMP; > > > > Consider using diffrent prefix for constants to diffrenciate flags and types. > > Well, I can use THERMAL_TRIP_FLAG_RW_TEMP or similar, but is it really > so confusing? It's not, it was just suggestion, if you don't want to, don't do it. Regards Stanislaw > I'm wondering what others think. > > > > } > > > mvm->tz_device.tzone = thermal_zone_device_register_with_trips(name, > > > mvm->tz_device.trips, > > > IWL_MAX_DTS_TRIPS, > > > - IWL_WRITABLE_TRIPS_MSK, > > > + 0, > > > mvm, &tzone_ops, > > > NULL, 0, 0); > > > if (IS_ERR(mvm->tz_device.tzone)) { > > > > > > > > > > > >
"Rafael J. Wysocki" <rjw@rjwysocki.net> writes: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > It is now possible to flag trip points with THERMAL_TRIP_WRITABLE_TEMP > to allow their temperature to be set from user space via sysfs instead > of using a nonzero writable trips mask during thermal zone registration, > so make the iwlwifi code do that. > > No intentional functional impact. > > Note that this change is requisite for dropping the mask argument from > thermal_zone_device_register_with_trips() going forward. > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> For wireless patches we use "wifi:" prefix in the title, if you can still change the patch please add that.
On Fri, 2024-02-09 at 17:15 +0100, Rafael J. Wysocki wrote: > > > for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) { > > > mvm->tz_device.trips[i].temperature = THERMAL_TEMP_INVALID; > > > mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE; > > > + mvm->tz_device.trips[i].type = THERMAL_TRIP_WRITABLE_TEMP; > > > > mvm->tz_device.trips[i].flags = THERMAL_TRIP_WRITABLE_TEMP; > > > > Consider using diffrent prefix for constants to diffrenciate flags and types. > > Well, I can use THERMAL_TRIP_FLAG_RW_TEMP or similar, but is it really > so confusing? > > I'm wondering what others think. > I'd tend to agree with Stanislaw. I did (eventually) notice the double assignment to .type above, but had that not been visible in the context, or you'd have removed the first one by accident, I'd really not have thought about it twice. The bug also makes it look like you even confused yourself ;-) So having a clearer indication that it's a flag would make sense, I'd say. johannes
On Mon, Feb 12, 2024 at 8:30 AM Kalle Valo <kvalo@kernel.org> wrote: > > "Rafael J. Wysocki" <rjw@rjwysocki.net> writes: > > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > It is now possible to flag trip points with THERMAL_TRIP_WRITABLE_TEMP > > to allow their temperature to be set from user space via sysfs instead > > of using a nonzero writable trips mask during thermal zone registration, > > so make the iwlwifi code do that. > > > > No intentional functional impact. > > > > Note that this change is requisite for dropping the mask argument from > > thermal_zone_device_register_with_trips() going forward. > > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > For wireless patches we use "wifi:" prefix in the title, if you can > still change the patch please add that. Sure, no problem.
On Mon, Feb 12, 2024 at 11:31 AM Johannes Berg <johannes@sipsolutions.net> wrote: > > On Fri, 2024-02-09 at 17:15 +0100, Rafael J. Wysocki wrote: > > > > for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) { > > > > mvm->tz_device.trips[i].temperature = THERMAL_TEMP_INVALID; > > > > mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE; > > > > + mvm->tz_device.trips[i].type = THERMAL_TRIP_WRITABLE_TEMP; > > > > > > mvm->tz_device.trips[i].flags = THERMAL_TRIP_WRITABLE_TEMP; > > > > > > Consider using diffrent prefix for constants to diffrenciate flags and types. > > > > Well, I can use THERMAL_TRIP_FLAG_RW_TEMP or similar, but is it really > > so confusing? > > > > I'm wondering what others think. > > > > I'd tend to agree with Stanislaw. I did (eventually) notice the double > assignment to .type above, but had that not been visible in the context, > or you'd have removed the first one by accident, I'd really not have > thought about it twice. > > The bug also makes it look like you even confused yourself ;-) No, that's just a mistake. > So having a clearer indication that it's a flag would make sense, I'd say. Sure, thanks!
Index: linux-pm/drivers/net/wireless/intel/iwlwifi/mvm/tt.c =================================================================== --- linux-pm.orig/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +++ linux-pm/drivers/net/wireless/intel/iwlwifi/mvm/tt.c @@ -667,9 +667,6 @@ static struct thermal_zone_device_ops t .set_trip_temp = iwl_mvm_tzone_set_trip_temp, }; -/* make all trips writable */ -#define IWL_WRITABLE_TRIPS_MSK (BIT(IWL_MAX_DTS_TRIPS) - 1) - static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm) { int i, ret; @@ -692,11 +689,12 @@ static void iwl_mvm_thermal_zone_registe for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) { mvm->tz_device.trips[i].temperature = THERMAL_TEMP_INVALID; mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE; + mvm->tz_device.trips[i].type = THERMAL_TRIP_WRITABLE_TEMP; } mvm->tz_device.tzone = thermal_zone_device_register_with_trips(name, mvm->tz_device.trips, IWL_MAX_DTS_TRIPS, - IWL_WRITABLE_TRIPS_MSK, + 0, mvm, &tzone_ops, NULL, 0, 0); if (IS_ERR(mvm->tz_device.tzone)) {