[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGTfZH1-CRv-7Uf-vSqocC_QZQ4HRXOV9OyP_LJie3g3KcczSw@mail.gmail.com>
Date: Wed, 14 May 2025 02:39:15 +0900
From: Chanwoo Choi <chanwoo@...nel.org>
To: Lifeng Zheng <zhenglifeng1@...wei.com>
Cc: myungjoo.ham@...sung.com, kyungmin.park@...sung.com, cw00.choi@...sung.com,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org, linuxarm@...wei.com,
jonathan.cameron@...wei.com, zhanjie9@...ilicon.com, lihuisong@...wei.com,
yubowen8@...wei.com, cenxinghai@...artners.com
Subject: Re: [PATCH 2/4] PM / devfreq: Limit max_freq with scaling_min_freq
Hi,
Applied it. Thanks.
On Mon, Apr 21, 2025 at 12:00 PM Lifeng Zheng <zhenglifeng1@...wei.com> wrote:
>
> Limit max_freq in devfreq_get_freq_range() with scaling_min_freq to avoid
> showing an unreachable freq when reading it.
>
> Use macro clamp to simplify code.
>
> Signed-off-by: Lifeng Zheng <zhenglifeng1@...wei.com>
> ---
> drivers/devfreq/devfreq.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 98657d3b9435..2810c84b9f8a 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -152,11 +152,8 @@ void devfreq_get_freq_range(struct devfreq *devfreq,
> (unsigned long)HZ_PER_KHZ * qos_max_freq);
>
> /* Apply constraints from OPP interface */
> - *min_freq = max(*min_freq, devfreq->scaling_min_freq);
> - *max_freq = min(*max_freq, devfreq->scaling_max_freq);
> -
> - if (*min_freq > *max_freq)
> - *min_freq = *max_freq;
> + *max_freq = clamp(*max_freq, devfreq->scaling_min_freq, devfreq->scaling_max_freq);
> + *min_freq = clamp(*min_freq, devfreq->scaling_min_freq, *max_freq);
> }
> EXPORT_SYMBOL(devfreq_get_freq_range);
>
> --
> 2.33.0
>
>
--
Best Regards,
Chanwoo Choi
Samsung Electronics
Powered by blists - more mailing lists