[PATCH v3 5/7] platform/x86/amd/pmf: Use upper/lower_32_bits() in amd_pmf_set_dram_addr()

Shyam Sundar S K <[email protected]> Thu, 23 Jul 2026 16:45:32 +0530
Newsgroups org.kernel.vger.platform-driver-x86
Message-ID <[email protected]>
Replace the open coded manual bit shifting used to split a 64-bit
physical address into its high and low 32-bit halves with the standard
kernel helpers upper_32_bits() and lower_32_bits().

No functional changes.

Reviewed-by: Mario Limonciello (AMD) <[email protected]>
Co-developed-by: Patil Rajesh Reddy <[email protected]>
Signed-off-by: Patil Rajesh Reddy <[email protected]>
Signed-off-by: Shyam Sundar S K <[email protected]>
---
 drivers/platform/x86/amd/pmf/metrics.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/amd/pmf/metrics.c b/drivers/platform/x86/amd/pmf/metrics.c
index a5444ad52cf4..8ee60d455ec3 100644
--- a/drivers/platform/x86/amd/pmf/metrics.c
+++ b/drivers/platform/x86/amd/pmf/metrics.c
@@ -10,7 +10,6 @@
  */
 
 #include <linux/array_size.h>
-#include <linux/bits.h>
 #include <linux/cleanup.h>
 #include <linux/container_of.h>
 #include <linux/device.h>
@@ -19,6 +18,7 @@
 #include <linux/ktime.h>
 #include <linux/string.h>
 #include <linux/types.h>
+#include <linux/wordpart.h>
 #include <linux/workqueue.h>
 
 #include "pmf.h"
@@ -82,8 +82,8 @@ int amd_pmf_set_dram_addr(struct amd_pmf_dev *dev, bool alloc_buffer)
 	}
 
 	phys_addr = virt_to_phys(dev->buf);
-	hi = phys_addr >> 32;
-	low = phys_addr & GENMASK(31, 0);
+	hi = upper_32_bits(phys_addr);
+	low = lower_32_bits(phys_addr);
 
 	amd_pmf_send_cmd(dev, SET_DRAM_ADDR_HIGH, SET_CMD, hi, NULL);
 	amd_pmf_send_cmd(dev, SET_DRAM_ADDR_LOW, SET_CMD, low, NULL);
-- 
2.34.1