Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Hans Zhang <18255117159@163.com>
To: linusw@kernel.org, unicorn_wang@outlook.com, inochiama@gmail.com,
	dlan@kernel.org
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hans Zhang <18255117159@163.com>
Subject: [PATCH 2/2] pinctrl: spacemit: Use FIELD_MODIFY()
Date: Fri,  1 May 2026 01:01:04 +0800	[thread overview]
Message-ID: <20260430170104.53854-3-18255117159@163.com> (raw)
In-Reply-To: <20260430170104.53854-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/pinctrl/spacemit/pinctrl-k1.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pinctrl/spacemit/pinctrl-k1.c b/drivers/pinctrl/spacemit/pinctrl-k1.c
index b0be62b1c816..54674f55ed81 100644
--- a/drivers/pinctrl/spacemit/pinctrl-k1.c
+++ b/drivers/pinctrl/spacemit/pinctrl-k1.c
@@ -777,9 +777,8 @@ static int spacemit_pinconf_generate_config(struct spacemit_pinctrl *pctrl,
 				return -EINVAL;
 			}
 		} else {
-			v &= ~PAD_SLEW_RATE;
 			slew_rate = slew_rate > 1 ? (slew_rate - 2) : 0;
-			v |= FIELD_PREP(PAD_SLEW_RATE, slew_rate);
+			FIELD_MODIFY(PAD_SLEW_RATE, &v, slew_rate);
 		}
 	}
 
-- 
2.34.1


      parent reply	other threads:[~2026-04-30 17:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30 17:01 [PATCH 0/2] pinctrl: Use FIELD_MODIFY() to simplify bit manipulation Hans Zhang
2026-04-30 17:01 ` [PATCH 1/2] pinctrl: sophgo: Use FIELD_MODIFY() Hans Zhang
2026-04-30 17:01 ` Hans Zhang [this message]

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=20260430170104.53854-3-18255117159@163.com \
    --to=18255117159@163.com \
    --cc=dlan@kernel.org \
    --cc=inochiama@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=unicorn_wang@outlook.com \
    /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