[PATCH] hwmon:fam15h_power Use div64_u64() for 64-bit divisor

From: SeungJu Cheon

Date: Tue Dec 30 2025 - 07:11:38 EST


tdelta is u64, but do_div() truncates the divisor to 32 bits.
Use div64_u64() to handle the full 64-bit divisor correctly.

Signed-off-by: SeungJu Cheon <suunj1331@xxxxxxxxx>
---
drivers/hwmon/fam15h_power.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
index 8ecebea53651..5e3692606516 100644
--- a/drivers/hwmon/fam15h_power.c
+++ b/drivers/hwmon/fam15h_power.c
@@ -241,7 +241,7 @@ static ssize_t power1_average_show(struct device *dev,
}
tdelta = data->cpu_sw_pwr_ptsc[cu] - prev_ptsc[cu];
jdelta[cu] *= data->cpu_pwr_sample_ratio * 1000;
- do_div(jdelta[cu], tdelta);
+ jdelta[cu] = div64_u64(jdelta[cu], tdelta);

/* the unit is microWatt */
avg_acc += jdelta[cu];
--
2.52.0