lkml.org 
[lkml]   [2026]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/2] cpufreq: apple-soc: Use FIELD_MODIFY()
From
On Thu Apr 30, 2026 at 12:32 PM EDT, Hans Zhang wrote:
> Use FIELD_MODIFY() to remove open-coded bit manipulation.
> No functional change intended.
>
> Signed-off-by: Hans Zhang <18255117159@163.com>
> ---
> drivers/cpufreq/apple-soc-cpufreq.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c
> index 9396034167e5..638e5bf72185 100644
> --- a/drivers/cpufreq/apple-soc-cpufreq.c
> +++ b/drivers/cpufreq/apple-soc-cpufreq.c
> @@ -187,10 +187,8 @@ static int apple_soc_cpufreq_set_target(struct cpufreq_policy *policy,
>
> reg &= ~priv->info->ps1_mask;
> reg |= pstate << priv->info->ps1_shift;
> - if (priv->info->has_ps2) {
> - reg &= ~APPLE_DVFS_CMD_PS2;
> - reg |= FIELD_PREP(APPLE_DVFS_CMD_PS2, pstate);
> - }
> + if (priv->info->has_ps2)
> + FIELD_MODIFY(APPLE_DVFS_CMD_PS2, &reg, pstate);
> reg |= APPLE_DVFS_CMD_SET;
>
> writeq_relaxed(reg, priv->reg_base + APPLE_DVFS_CMD);

Looks okay.

Reviewed-by: Joshua Peisach <jpeisach@ubuntu.com>

\
 
 \ /
  Last update: 2026-04-30 21:55    [W:0.082 / U:4.812 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog