* [PATCH v1 1/2] PM: devfreq: fix typo in DFSO_DOWNDIFFERENTIAL macro name
@ 2025-11-18 3:23 Riwen Lu
2025-11-18 3:23 ` [PATCH v1 2/2] PM: devfreq: handle invalid parameters gracefully in simpleondemand Riwen Lu
2025-11-23 15:20 ` [PATCH v1 1/2] PM: devfreq: fix typo in DFSO_DOWNDIFFERENTIAL macro name Chanwoo Choi
0 siblings, 2 replies; 5+ messages in thread
From: Riwen Lu @ 2025-11-18 3:23 UTC (permalink / raw)
To: myungjoo.ham, kyungmin.park, cw00.choi; +Cc: linux-pm, linux-kernel, Riwen Lu
Correct the spelling error in the DFSO_DOWNDIFFERENTIAL macro
definition and update the corresponding variable assignment.
The macro was previously misspelled as DFSO_DOWNDIFFERENCTIAL.
This change ensures consistent and correct spelling throughout
the simpleondemand governor implementation.
Signed-off-by: Riwen Lu <luriwen@kylinos.cn>
---
drivers/devfreq/governor_simpleondemand.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/devfreq/governor_simpleondemand.c b/drivers/devfreq/governor_simpleondemand.c
index c23435736367..b4d7be766f33 100644
--- a/drivers/devfreq/governor_simpleondemand.c
+++ b/drivers/devfreq/governor_simpleondemand.c
@@ -14,7 +14,7 @@
/* Default constants for DevFreq-Simple-Ondemand (DFSO) */
#define DFSO_UPTHRESHOLD (90)
-#define DFSO_DOWNDIFFERENCTIAL (5)
+#define DFSO_DOWNDIFFERENTIAL (5)
static int devfreq_simple_ondemand_func(struct devfreq *df,
unsigned long *freq)
{
@@ -22,7 +22,7 @@ static int devfreq_simple_ondemand_func(struct devfreq *df,
struct devfreq_dev_status *stat;
unsigned long long a, b;
unsigned int dfso_upthreshold = DFSO_UPTHRESHOLD;
- unsigned int dfso_downdifferential = DFSO_DOWNDIFFERENCTIAL;
+ unsigned int dfso_downdifferential = DFSO_DOWNDIFFERENTIAL;
struct devfreq_simple_ondemand_data *data = df->data;
err = devfreq_update_stats(df);
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v1 2/2] PM: devfreq: handle invalid parameters gracefully in simpleondemand
2025-11-18 3:23 [PATCH v1 1/2] PM: devfreq: fix typo in DFSO_DOWNDIFFERENTIAL macro name Riwen Lu
@ 2025-11-18 3:23 ` Riwen Lu
2025-11-23 15:24 ` Chanwoo Choi
2025-11-23 15:20 ` [PATCH v1 1/2] PM: devfreq: fix typo in DFSO_DOWNDIFFERENTIAL macro name Chanwoo Choi
1 sibling, 1 reply; 5+ messages in thread
From: Riwen Lu @ 2025-11-18 3:23 UTC (permalink / raw)
To: myungjoo.ham, kyungmin.park, cw00.choi; +Cc: linux-pm, linux-kernel, Riwen Lu
Instead of returning -EINVAL when upthreshold > 100 or upthreshold <
downdifferential, fall back to default threshold values to ensure the
governor continues functioning.
Additionally, the validation is now scoped to the if (data) block,
preventing unnecessary checks when no user data is provided, while the
fallback mechanism ensures reliability with invalid configurations.
Signed-off-by: Riwen Lu <luriwen@kylinos.cn>
---
drivers/devfreq/governor_simpleondemand.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/devfreq/governor_simpleondemand.c b/drivers/devfreq/governor_simpleondemand.c
index b4d7be766f33..7205891d2ec6 100644
--- a/drivers/devfreq/governor_simpleondemand.c
+++ b/drivers/devfreq/governor_simpleondemand.c
@@ -36,10 +36,15 @@ static int devfreq_simple_ondemand_func(struct devfreq *df,
dfso_upthreshold = data->upthreshold;
if (data->downdifferential)
dfso_downdifferential = data->downdifferential;
+
+ if (dfso_upthreshold > 100 ||
+ dfso_upthreshold < dfso_downdifferential) {
+ dfso_upthreshold = DFSO_UPTHRESHOLD;
+ dfso_downdifferential = DFSO_DOWNDIFFERENTIAL;
+ pr_debug("Invalid thresholds, using defaults: up = %u, down = %u\n",
+ dfso_upthreshold, dfso_downdifferential);
+ }
}
- if (dfso_upthreshold > 100 ||
- dfso_upthreshold < dfso_downdifferential)
- return -EINVAL;
/* Assume MAX if it is going to be divided by zero */
if (stat->total_time == 0) {
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/2] PM: devfreq: fix typo in DFSO_DOWNDIFFERENTIAL macro name
2025-11-18 3:23 [PATCH v1 1/2] PM: devfreq: fix typo in DFSO_DOWNDIFFERENTIAL macro name Riwen Lu
2025-11-18 3:23 ` [PATCH v1 2/2] PM: devfreq: handle invalid parameters gracefully in simpleondemand Riwen Lu
@ 2025-11-23 15:20 ` Chanwoo Choi
1 sibling, 0 replies; 5+ messages in thread
From: Chanwoo Choi @ 2025-11-23 15:20 UTC (permalink / raw)
To: Riwen Lu, myungjoo.ham, kyungmin.park, cw00.choi; +Cc: linux-pm, linux-kernel
25. 11. 18. 12:23에 Riwen Lu 이(가) 쓴 글:
> Correct the spelling error in the DFSO_DOWNDIFFERENTIAL macro
> definition and update the corresponding variable assignment.
>
> The macro was previously misspelled as DFSO_DOWNDIFFERENCTIAL.
> This change ensures consistent and correct spelling throughout
> the simpleondemand governor implementation.
>
> Signed-off-by: Riwen Lu <luriwen@kylinos.cn>
> ---
> drivers/devfreq/governor_simpleondemand.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/devfreq/governor_simpleondemand.c b/drivers/devfreq/governor_simpleondemand.c
> index c23435736367..b4d7be766f33 100644
> --- a/drivers/devfreq/governor_simpleondemand.c
> +++ b/drivers/devfreq/governor_simpleondemand.c
> @@ -14,7 +14,7 @@
>
> /* Default constants for DevFreq-Simple-Ondemand (DFSO) */
> #define DFSO_UPTHRESHOLD (90)
> -#define DFSO_DOWNDIFFERENCTIAL (5)
> +#define DFSO_DOWNDIFFERENTIAL (5)
> static int devfreq_simple_ondemand_func(struct devfreq *df,
> unsigned long *freq)
> {
> @@ -22,7 +22,7 @@ static int devfreq_simple_ondemand_func(struct devfreq *df,
> struct devfreq_dev_status *stat;
> unsigned long long a, b;
> unsigned int dfso_upthreshold = DFSO_UPTHRESHOLD;
> - unsigned int dfso_downdifferential = DFSO_DOWNDIFFERENCTIAL;
> + unsigned int dfso_downdifferential = DFSO_DOWNDIFFERENTIAL;
> struct devfreq_simple_ondemand_data *data = df->data;
>
> err = devfreq_update_stats(df);
Applied it. Thanks.
--
Best Regards,
Samsung Electronics
Chanwoo Choi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 2/2] PM: devfreq: handle invalid parameters gracefully in simpleondemand
2025-11-18 3:23 ` [PATCH v1 2/2] PM: devfreq: handle invalid parameters gracefully in simpleondemand Riwen Lu
@ 2025-11-23 15:24 ` Chanwoo Choi
2025-11-26 9:24 ` luriwen
0 siblings, 1 reply; 5+ messages in thread
From: Chanwoo Choi @ 2025-11-23 15:24 UTC (permalink / raw)
To: Riwen Lu, myungjoo.ham, kyungmin.park, cw00.choi; +Cc: linux-pm, linux-kernel
25. 11. 18. 12:23에 Riwen Lu 이(가) 쓴 글:
> Instead of returning -EINVAL when upthreshold > 100 or upthreshold <
> downdifferential, fall back to default threshold values to ensure the
> governor continues functioning.
>
> Additionally, the validation is now scoped to the if (data) block,
> preventing unnecessary checks when no user data is provided, while the
> fallback mechanism ensures reliability with invalid configurations.
>
> Signed-off-by: Riwen Lu <luriwen@kylinos.cn>
> ---
> drivers/devfreq/governor_simpleondemand.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/devfreq/governor_simpleondemand.c b/drivers/devfreq/governor_simpleondemand.c
> index b4d7be766f33..7205891d2ec6 100644
> --- a/drivers/devfreq/governor_simpleondemand.c
> +++ b/drivers/devfreq/governor_simpleondemand.c
> @@ -36,10 +36,15 @@ static int devfreq_simple_ondemand_func(struct devfreq *df,
> dfso_upthreshold = data->upthreshold;
> if (data->downdifferential)
> dfso_downdifferential = data->downdifferential;
> +
> + if (dfso_upthreshold > 100 ||
> + dfso_upthreshold < dfso_downdifferential) {
> + dfso_upthreshold = DFSO_UPTHRESHOLD;
> + dfso_downdifferential = DFSO_DOWNDIFFERENTIAL;
> + pr_debug("Invalid thresholds, using defaults: up = %u, down = %u\n",
> + dfso_upthreshold, dfso_downdifferential);
> + }
> }
> - if (dfso_upthreshold > 100 ||
> - dfso_upthreshold < dfso_downdifferential)
> - return -EINVAL;
>
> /* Assume MAX if it is going to be divided by zero */
> if (stat->total_time == 0) {
If there are wrong initialization of devfreq_simple_ondemand,
it should point out what is wrong because it makes some confusion if there are no error.
--
Best Regards,
Samsung Electronics
Chanwoo Choi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 2/2] PM: devfreq: handle invalid parameters gracefully in simpleondemand
2025-11-23 15:24 ` Chanwoo Choi
@ 2025-11-26 9:24 ` luriwen
0 siblings, 0 replies; 5+ messages in thread
From: luriwen @ 2025-11-26 9:24 UTC (permalink / raw)
To: Chanwoo Choi, myungjoo.ham, kyungmin.park, cw00.choi
Cc: linux-pm, linux-kernel
在 2025/11/23 23:24, Chanwoo Choi 写道:
> 25. 11. 18. 12:23에 Riwen Lu 이(가) 쓴 글:
>> Instead of returning -EINVAL when upthreshold > 100 or upthreshold <
>> downdifferential, fall back to default threshold values to ensure the
>> governor continues functioning.
>>
>> Additionally, the validation is now scoped to the if (data) block,
>> preventing unnecessary checks when no user data is provided, while the
>> fallback mechanism ensures reliability with invalid configurations.
>>
>> Signed-off-by: Riwen Lu <luriwen@kylinos.cn>
>> ---
>> drivers/devfreq/governor_simpleondemand.c | 11 ++++++++---
>> 1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/devfreq/governor_simpleondemand.c b/drivers/devfreq/governor_simpleondemand.c
>> index b4d7be766f33..7205891d2ec6 100644
>> --- a/drivers/devfreq/governor_simpleondemand.c
>> +++ b/drivers/devfreq/governor_simpleondemand.c
>> @@ -36,10 +36,15 @@ static int devfreq_simple_ondemand_func(struct devfreq *df,
>> dfso_upthreshold = data->upthreshold;
>> if (data->downdifferential)
>> dfso_downdifferential = data->downdifferential;
>> +
>> + if (dfso_upthreshold > 100 ||
>> + dfso_upthreshold < dfso_downdifferential) {
>> + dfso_upthreshold = DFSO_UPTHRESHOLD;
>> + dfso_downdifferential = DFSO_DOWNDIFFERENTIAL;
>> + pr_debug("Invalid thresholds, using defaults: up = %u, down = %u\n",
>> + dfso_upthreshold, dfso_downdifferential);
>> + }
>> }
>> - if (dfso_upthreshold > 100 ||
>> - dfso_upthreshold < dfso_downdifferential)
>> - return -EINVAL;
>>
>> /* Assume MAX if it is going to be divided by zero */
>> if (stat->total_time == 0) {
> If there are wrong initialization of devfreq_simple_ondemand,
> it should point out what is wrong because it makes some confusion if there are no error.
>
>
The original intention behind falling back to default values was to ensure the governor remains functional even with invalid configurations. However, I agree that silently using defaults could hide configuration issues from users.
I'd like to keep fallback but add explicit warning or error.
```c
if (dfso_upthreshold > 100 ||
dfso_upthreshold < dfso_downdifferential) {
pr_warn("Invalid thresholds (up = %u, down = %u), using
defaults: up = %u, down = %u\n",
dfso_upthreshold, dfso_downdifferential,
DFSO_UPTHRESHOLD, DFSO_DOWNDIFFERENTIAL);
dfso_upthreshold = DFSO_UPTHRESHOLD;
dfso_downdifferential = DFSO_DOWNDIFFERENTIAL;
}
--
Best Regards,
Riwen Lu
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-26 9:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-18 3:23 [PATCH v1 1/2] PM: devfreq: fix typo in DFSO_DOWNDIFFERENTIAL macro name Riwen Lu
2025-11-18 3:23 ` [PATCH v1 2/2] PM: devfreq: handle invalid parameters gracefully in simpleondemand Riwen Lu
2025-11-23 15:24 ` Chanwoo Choi
2025-11-26 9:24 ` luriwen
2025-11-23 15:20 ` [PATCH v1 1/2] PM: devfreq: fix typo in DFSO_DOWNDIFFERENTIAL macro name Chanwoo Choi
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®