* [PATCH v1 15/17] thermal/drivers/acerhdf: Make interval setting only at module load time [not found] <20230219143657.241542-1-daniel.lezcano@linaro.org> @ 2023-02-19 14:36 ` Daniel Lezcano 2023-02-19 21:38 ` Peter Kästle 2023-02-19 14:36 ` [PATCH v1 16/17] thermal/drivers/acerhdf: Remove pointless governor test Daniel Lezcano 1 sibling, 1 reply; 4+ messages in thread From: Daniel Lezcano @ 2023-02-19 14:36 UTC (permalink / raw) To: rafael, daniel.lezcano Cc: linux-pm, linux-kernel, Peter Kaestle, Hans de Goede, Mark Gross, open list:ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER The thermal zone device structure is in the process of being private to the thermal framework core code. This driver is directly accessing and changing the monitoring polling rate. After discussing with the maintainers of this driver, having the polling interval at module loading time is enough for their purpose. Change the code to take into account the interval when the module is loaded but restrict the permissions so the value can not be changed afterwards. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> --- drivers/platform/x86/acerhdf.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 1956469c3457..61f1c3090867 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -79,7 +79,6 @@ static unsigned int list_supported; static unsigned int fanstate = ACERHDF_FAN_AUTO; static char force_bios[16]; static char force_product[16]; -static unsigned int prev_interval; static struct thermal_zone_device *thz_dev; static struct thermal_cooling_device *cl_dev; static struct platform_device *acerhdf_dev; @@ -346,20 +345,15 @@ static void acerhdf_check_param(struct thermal_zone_device *thermal) trips[0].temperature = fanon; trips[0].hysteresis = fanon - fanoff; - if (kernelmode && prev_interval != interval) { + if (kernelmode) { if (interval > ACERHDF_MAX_INTERVAL) { pr_err("interval too high, set to %d\n", ACERHDF_MAX_INTERVAL); interval = ACERHDF_MAX_INTERVAL; } + if (verbose) pr_notice("interval changed to: %d\n", interval); - - if (thermal) - thermal->polling_delay_jiffies = - round_jiffies(msecs_to_jiffies(interval * 1000)); - - prev_interval = interval; } } @@ -807,5 +801,5 @@ static const struct kernel_param_ops interval_ops = { .get = param_get_uint, }; -module_param_cb(interval, &interval_ops, &interval, 0600); +module_param_cb(interval, &interval_ops, &interval, 0000); MODULE_PARM_DESC(interval, "Polling interval of temperature check"); -- 2.34.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 15/17] thermal/drivers/acerhdf: Make interval setting only at module load time 2023-02-19 14:36 ` [PATCH v1 15/17] thermal/drivers/acerhdf: Make interval setting only at module load time Daniel Lezcano @ 2023-02-19 21:38 ` Peter Kästle 0 siblings, 0 replies; 4+ messages in thread From: Peter Kästle @ 2023-02-19 21:38 UTC (permalink / raw) To: Daniel Lezcano, rafael Cc: linux-pm, linux-kernel, Hans de Goede, Mark Gross, platform-driver-x86 19. Februar 2023 15:38, "Daniel Lezcano" <daniel.lezcano@linaro.org> schrieb: > The thermal zone device structure is in the process of being private > to the thermal framework core code. This driver is directly accessing > and changing the monitoring polling rate. > > After discussing with the maintainers of this driver, having the > polling interval at module loading time is enough for their purpose. > > Change the code to take into account the interval when the module is > loaded but restrict the permissions so the value can not be changed > afterwards. > > Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Peter Kaestle <peter@piie.net> > --- > drivers/platform/x86/acerhdf.c | 12 +++--------- > 1 file changed, 3 insertions(+), 9 deletions(-) > > diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c > index 1956469c3457..61f1c3090867 100644 > --- a/drivers/platform/x86/acerhdf.c > +++ b/drivers/platform/x86/acerhdf.c > @@ -79,7 +79,6 @@ static unsigned int list_supported; > static unsigned int fanstate = ACERHDF_FAN_AUTO; > static char force_bios[16]; > static char force_product[16]; > -static unsigned int prev_interval; > static struct thermal_zone_device *thz_dev; > static struct thermal_cooling_device *cl_dev; > static struct platform_device *acerhdf_dev; > @@ -346,20 +345,15 @@ static void acerhdf_check_param(struct thermal_zone_device *thermal) > trips[0].temperature = fanon; > trips[0].hysteresis = fanon - fanoff; > > - if (kernelmode && prev_interval != interval) { > + if (kernelmode) { > if (interval > ACERHDF_MAX_INTERVAL) { > pr_err("interval too high, set to %d\n", > ACERHDF_MAX_INTERVAL); > interval = ACERHDF_MAX_INTERVAL; > } > + > if (verbose) > pr_notice("interval changed to: %d\n", interval); > - > - if (thermal) > - thermal->polling_delay_jiffies = > - round_jiffies(msecs_to_jiffies(interval * 1000)); > - > - prev_interval = interval; > } > } > > @@ -807,5 +801,5 @@ static const struct kernel_param_ops interval_ops = { > .get = param_get_uint, > }; > > -module_param_cb(interval, &interval_ops, &interval, 0600); > +module_param_cb(interval, &interval_ops, &interval, 0000); > MODULE_PARM_DESC(interval, "Polling interval of temperature check"); > -- > 2.34.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v1 16/17] thermal/drivers/acerhdf: Remove pointless governor test [not found] <20230219143657.241542-1-daniel.lezcano@linaro.org> 2023-02-19 14:36 ` [PATCH v1 15/17] thermal/drivers/acerhdf: Make interval setting only at module load time Daniel Lezcano @ 2023-02-19 14:36 ` Daniel Lezcano 2023-02-19 21:35 ` Peter Kästle 1 sibling, 1 reply; 4+ messages in thread From: Daniel Lezcano @ 2023-02-19 14:36 UTC (permalink / raw) To: rafael, daniel.lezcano Cc: linux-pm, linux-kernel, Peter Kaestle, Hans de Goede, Mark Gross, open list:ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER The thermal zone parameter specifies the bang-bang governor. The Kconfig selects the bang-bang governor. So it is pointless to test if the governor was set for the thermal zone assuming it may not have been compiled-in. Remove the test and prevent another access into the thermal internals. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> --- drivers/platform/x86/acerhdf.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 61f1c3090867..71b9c1f922d9 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c @@ -697,13 +697,6 @@ static int __init acerhdf_register_thermal(void) if (ret) return ret; - if (strcmp(thz_dev->governor->name, - acerhdf_zone_params.governor_name)) { - pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n", - acerhdf_zone_params.governor_name); - return -EINVAL; - } - return 0; } -- 2.34.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 16/17] thermal/drivers/acerhdf: Remove pointless governor test 2023-02-19 14:36 ` [PATCH v1 16/17] thermal/drivers/acerhdf: Remove pointless governor test Daniel Lezcano @ 2023-02-19 21:35 ` Peter Kästle 0 siblings, 0 replies; 4+ messages in thread From: Peter Kästle @ 2023-02-19 21:35 UTC (permalink / raw) To: Daniel Lezcano, rafael Cc: linux-pm, linux-kernel, Hans de Goede, Mark Gross, platform-driver-x86 19. Februar 2023 15:38, "Daniel Lezcano" <daniel.lezcano@linaro.org> schrieb: > The thermal zone parameter specifies the bang-bang governor. > > The Kconfig selects the bang-bang governor. So it is pointless to test > if the governor was set for the thermal zone assuming it may not have > been compiled-in. > > Remove the test and prevent another access into the thermal internals. > > Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Peter Kaestle <peter@piie.net> > --- > drivers/platform/x86/acerhdf.c | 7 ------- > 1 file changed, 7 deletions(-) > > diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c > index 61f1c3090867..71b9c1f922d9 100644 > --- a/drivers/platform/x86/acerhdf.c > +++ b/drivers/platform/x86/acerhdf.c > @@ -697,13 +697,6 @@ static int __init acerhdf_register_thermal(void) > if (ret) > return ret; > > - if (strcmp(thz_dev->governor->name, > - acerhdf_zone_params.governor_name)) { > - pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n", > - acerhdf_zone_params.governor_name); > - return -EINVAL; > - } > - > return 0; > } > > -- > 2.34.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-19 22:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230219143657.241542-1-daniel.lezcano@linaro.org>
2023-02-19 14:36 ` [PATCH v1 15/17] thermal/drivers/acerhdf: Make interval setting only at module load time Daniel Lezcano
2023-02-19 21:38 ` Peter Kästle
2023-02-19 14:36 ` [PATCH v1 16/17] thermal/drivers/acerhdf: Remove pointless governor test Daniel Lezcano
2023-02-19 21:35 ` Peter Kästle
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox