mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SeungJu Cheon <suunj1331@gmail.com>
To: ray.huang@amd.com, linux@roeck-us.net
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	SeungJu Cheon <suunj1331@gmail.com>
Subject: [PATCH] hwmon:fam15h_power Use div64_u64() for 64-bit divisor
Date: Tue, 30 Dec 2025 21:09:59 +0900	[thread overview]
Message-ID: <20251230120959.199139-1-suunj1331@gmail.com> (raw)

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@gmail.com>
---
 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


             reply	other threads:[~2025-12-30 12:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-30 12:09 SeungJu Cheon [this message]
2025-12-30 23:23 ` David Laight
2025-12-31 14:18   ` Guenter Roeck

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=20251230120959.199139-1-suunj1331@gmail.com \
    --to=suunj1331@gmail.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=ray.huang@amd.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

all inboxes | Powered by JetHome®