public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans Zhang <18255117159@163.com>
To: ray.huang@amd.com, mario.limonciello@amd.com, rafael@kernel.org,
	viresh.kumar@linaro.org, sven@kernel.org, j@jannau.net
Cc: perry.yuan@amd.com, kprateek.nayak@amd.com, neal@gompa.dev,
	linux-pm@vger.kernel.org, asahi@lists.linux.dev,
	linux-kernel@vger.kernel.org, Hans Zhang <18255117159@163.com>
Subject: [PATCH 2/2] cpufreq: apple-soc: Use FIELD_MODIFY()
Date: Fri,  1 May 2026 00:32:13 +0800	[thread overview]
Message-ID: <20260430163213.44695-3-18255117159@163.com> (raw)
In-Reply-To: <20260430163213.44695-1-18255117159@163.com>

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);
-- 
2.34.1


  parent reply	other threads:[~2026-04-30 16:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30 16:32 [PATCH 0/2] *cpufreq: Use FIELD_MODIFY() for bitfield operations Hans Zhang
2026-04-30 16:32 ` [PATCH 1/2] cpufreq/amd-pstate: Use FIELD_MODIFY() Hans Zhang
2026-05-01  5:27   ` K Prateek Nayak
2026-04-30 16:32 ` Hans Zhang [this message]
2026-04-30 19:54   ` [PATCH 2/2] cpufreq: apple-soc: " Joshua Peisach
2026-05-05  3:59 ` [PATCH 0/2] *cpufreq: Use FIELD_MODIFY() for bitfield operations Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260430163213.44695-3-18255117159@163.com \
    --to=18255117159@163.com \
    --cc=asahi@lists.linux.dev \
    --cc=j@jannau.net \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=neal@gompa.dev \
    --cc=perry.yuan@amd.com \
    --cc=rafael@kernel.org \
    --cc=ray.huang@amd.com \
    --cc=sven@kernel.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox