Linux-Hwmon Archive on
 help / color / Atom feed
* [PATCH v11 02/12] hwmon: pwm-fan: Use 64-bit division macro
       [not found] <>
@ 2020-03-20  1:41 ` Guru Das Srinagesh
  0 siblings, 0 replies; only message in thread
From: Guru Das Srinagesh @ 2020-03-20  1:41 UTC (permalink / raw)
  To: linux-pwm
  Cc: Thierry Reding, Uwe Kleine-König, Subbaraman Narayanamurthy,
	linux-kernel, Guru Das Srinagesh, Kamil Debski,
	Bartlomiej Zolnierkiewicz, Jean Delvare, Guenter Roeck,
	Liam Girdwood, Mark Brown, linux-hwmon

Since the PWM framework is switching struct pwm_args.period's datatype
to u64, prepare for this transition by using DIV_ROUND_UP_ULL to handle
a 64-bit dividend.

Cc: Kamil Debski <>
Cc: Bartlomiej Zolnierkiewicz <>
Cc: Jean Delvare <>
Cc: Guenter Roeck <>
Cc: Liam Girdwood <>
Cc: Mark Brown <>

Signed-off-by: Guru Das Srinagesh <>
Acked-by: Guenter Roeck <>
 drivers/hwmon/pwm-fan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index 42ffd2e..283423a 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -437,7 +437,7 @@ static int pwm_fan_resume(struct device *dev)
 		return 0;
 	pwm_get_args(ctx->pwm, &pargs);
-	duty = DIV_ROUND_UP(ctx->pwm_value * (pargs.period - 1), MAX_PWM);
+	duty = DIV_ROUND_UP_ULL(ctx->pwm_value * (pargs.period - 1), MAX_PWM);
 	ret = pwm_config(ctx->pwm, duty, pargs.period);
 	if (ret)
 		return ret;
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <>
2020-03-20  1:41 ` [PATCH v11 02/12] hwmon: pwm-fan: Use 64-bit division macro Guru Das Srinagesh

Linux-Hwmon Archive on

Archives are clonable:
	git clone --mirror linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ \
	public-inbox-index linux-hwmon

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone