public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Hans Zhang <18255117159@163.com>
To: Thinh.Nguyen@synopsys.com, gregkh@linuxfoundation.org,
	peter.griffin@linaro.org, andre.draszik@linaro.org,
	tudor.ambarus@linaro.org, mathias.nyman@intel.com,
	chunfeng.yun@mediatek.com, matthias.bgg@gmail.com,
	angelogioacchino.delregno@collabora.com, badhri@google.com,
	heikki.krogerus@linux.intel.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	Hans Zhang <18255117159@163.com>
Subject: [PATCH 1/6] usb: dwc3: Use FIELD_MODIFY()
Date: Fri,  1 May 2026 00:39:14 +0800	[thread overview]
Message-ID: <20260430163919.47372-2-18255117159@163.com> (raw)
In-Reply-To: <20260430163919.47372-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/usb/dwc3/core.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 58899b1fa96d..f95201470ab2 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -425,8 +425,7 @@ static void dwc3_ref_clk_period(struct dwc3 *dwc)
 	}
 
 	reg = dwc3_readl(dwc, DWC3_GUCTL);
-	reg &= ~DWC3_GUCTL_REFCLKPER_MASK;
-	reg |=  FIELD_PREP(DWC3_GUCTL_REFCLKPER_MASK, period);
+	FIELD_MODIFY(DWC3_GUCTL_REFCLKPER_MASK, &reg, period);
 	dwc3_writel(dwc, DWC3_GUCTL, reg);
 
 	if (DWC3_VER_IS_PRIOR(DWC3, 250A))
@@ -456,12 +455,9 @@ static void dwc3_ref_clk_period(struct dwc3 *dwc)
 	decr = 480000000 / rate;
 
 	reg = dwc3_readl(dwc, DWC3_GFLADJ);
-	reg &= ~DWC3_GFLADJ_REFCLK_FLADJ_MASK
-	    &  ~DWC3_GFLADJ_240MHZDECR
-	    &  ~DWC3_GFLADJ_240MHZDECR_PLS1;
-	reg |= FIELD_PREP(DWC3_GFLADJ_REFCLK_FLADJ_MASK, fladj)
-	    |  FIELD_PREP(DWC3_GFLADJ_240MHZDECR, decr >> 1)
-	    |  FIELD_PREP(DWC3_GFLADJ_240MHZDECR_PLS1, decr & 1);
+	FIELD_MODIFY(DWC3_GFLADJ_REFCLK_FLADJ_MASK, &reg, fladj);
+	FIELD_MODIFY(DWC3_GFLADJ_240MHZDECR, &reg, decr >> 1);
+	FIELD_MODIFY(DWC3_GFLADJ_240MHZDECR_PLS1, &reg, decr & 1);
 
 	if (dwc->gfladj_refclk_lpm_sel)
 		reg |=  DWC3_GFLADJ_REFCLK_LPM_SEL;
-- 
2.34.1



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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30 16:39 [PATCH 0/6] usb: Use FIELD_MODIFY() for bitfield operations Hans Zhang
2026-04-30 16:39 ` Hans Zhang [this message]
2026-04-30 16:39 ` [PATCH 2/6] usb: dwc3: google: Use FIELD_MODIFY() Hans Zhang
2026-04-30 16:39 ` [PATCH 3/6] usb: dwc3: dwc3-octeon: " Hans Zhang
2026-04-30 16:39 ` [PATCH 4/6] usb: xhci: " Hans Zhang
2026-04-30 16:39 ` [PATCH 5/6] usb: xhci-mtk: " Hans Zhang
2026-04-30 16:39 ` [PATCH 6/6] usb: typec: " Hans Zhang

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=20260430163919.47372-2-18255117159@163.com \
    --to=18255117159@163.com \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=andre.draszik@linaro.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=badhri@google.com \
    --cc=chunfeng.yun@mediatek.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=peter.griffin@linaro.org \
    --cc=tudor.ambarus@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