public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cxl/core: Use FIELD_MODIFY()
@ 2026-04-30 16:27 Hans Zhang
  2026-04-30 20:21 ` Dave Jiang
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Zhang @ 2026-04-30 16:27 UTC (permalink / raw)
  To: dave, jic23, dave.jiang, alison.schofield, vishal.l.verma,
	ira.weiny, djbw
  Cc: linux-cxl, linux-kernel, Hans Zhang

Use FIELD_MODIFY() to remove open-coded bit manipulation.
No functional change intended.

Signed-off-by: Hans Zhang <18255117159@163.com>
---
 drivers/cxl/core/edac.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/cxl/core/edac.c b/drivers/cxl/core/edac.c
index b321971fef58..a374e8ebac87 100644
--- a/drivers/cxl/core/edac.c
+++ b/drivers/cxl/core/edac.c
@@ -717,8 +717,7 @@ static int cxl_set_ecs_count_mode(struct device *dev, u8 *log_cap, u16 *config,
 		return -EINVAL;
 	}
 
-	*config &= ~CXL_ECS_COUNT_MODE_MASK;
-	*config |= FIELD_PREP(CXL_ECS_COUNT_MODE_MASK, val);
+	FIELD_MODIFY(CXL_ECS_COUNT_MODE_MASK, config, val);
 
 	return 0;
 }
@@ -729,8 +728,7 @@ static int cxl_set_ecs_reset_counter(struct device *dev, u8 *log_cap,
 	if (val != CXL_ECS_RESET_COUNTER)
 		return -EINVAL;
 
-	*config &= ~CXL_ECS_RESET_COUNTER_MASK;
-	*config |= FIELD_PREP(CXL_ECS_RESET_COUNTER_MASK, val);
+	FIELD_MODIFY(CXL_ECS_RESET_COUNTER_MASK, config, val);
 
 	return 0;
 }

base-commit: 3b3bea6d4b9c162f9e555905d96b8c1da67ecd5b
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-01 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-30 16:27 [PATCH] cxl/core: Use FIELD_MODIFY() Hans Zhang
2026-04-30 20:21 ` Dave Jiang
2026-05-01 14:21   ` Hans Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox