All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Abdurrahman Hussain via B4 Relay"
	<devnull+abdurrahman.nexthop.ai@kernel.org>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 2/7] hwmon: (pmbus/adm1266) write fractional-seconds field of SET_RTC
Date: Sat, 09 May 2026 00:06:12 +0000	[thread overview]
Message-ID: <20260509000612.91314C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260508-adm1266-v1-2-ec08bf29e0ce@nexthop.ai>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] 64-bit division using the `/` operator will cause build failures on 32-bit architectures.
--

commit f0fa424ad89f6e68ea279a8fd355cf480c9af8fc
Author: Abdurrahman Hussain <abdurrahman@nexthop.ai>

hwmon: (pmbus/adm1266) write fractional-seconds field of SET_RTC

This commit updates the adm1266 driver to write the fractional-seconds field
of the SET_RTC register. It samples wall-clock time as a struct timespec64
and converts tv_nsec to a 16-bit fractional representation using 64-bit
arithmetic.

> diff --git a/drivers/hwmon/pmbus/adm1266.c b/drivers/hwmon/pmbus/adm1266.c
> index a86666c73a5e9..ba8a025095287 100644
> --- a/drivers/hwmon/pmbus/adm1266.c
> +++ b/drivers/hwmon/pmbus/adm1266.c
[ ... ]
> @@ -428,16 +428,23 @@ static int adm1266_config_nvmem(struct adm1266_data *data)
[ ... ]
> +	/*
> +	 * SET_RTC frame layout (datasheet Rev. D, Table 84):
> +	 *   bytes [1:0] = fractional seconds, LSB = 1/65536 s
> +	 *   bytes [5:2] = seconds since 1970-01-01 UTC
> +	 */
> +	frac = (u16)(((u64)ts.tv_nsec << 16) / NSEC_PER_SEC);

Will this cause build failures on 32-bit architectures?

The compiler lacks built-in hardware support for 64-bit division on 32-bit
architectures and emits a call to an intrinsic like __udivdi3, which is not
available since the kernel does not link with libgcc.

Should this use the div_u64() helper function instead, such as
div_u64((u64)ts.tv_nsec << 16, NSEC_PER_SEC)?

> +	for (i = 0; i < 2; i++)
> +		write_buf[i] = (frac >> (i * 8)) & 0xFF;
>  	for (i = 0; i < 4; i++)
> -		write_buf[2 + i] = (kt >> (i * 8)) & 0xFF;
> +		write_buf[2 + i] = (ts.tv_sec >> (i * 8)) & 0xFF;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260508-adm1266-v1-0-ec08bf29e0ce@nexthop.ai?part=2

  reply	other threads:[~2026-05-09  0:06 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-08 23:33 [PATCH 0/7] hwmon: (pmbus/adm1266) RTC fix, blackbox, FW rev, rtc_class Abdurrahman Hussain
2026-05-08 23:33 ` Abdurrahman Hussain via B4 Relay
2026-05-08 23:33 ` [PATCH 1/7] hwmon: (pmbus/adm1266) use wall-clock seconds for SET_RTC Abdurrahman Hussain
2026-05-08 23:33   ` Abdurrahman Hussain via B4 Relay
2026-05-08 23:48   ` sashiko-bot
2026-05-08 23:33 ` [PATCH 2/7] hwmon: (pmbus/adm1266) write fractional-seconds field of SET_RTC Abdurrahman Hussain
2026-05-08 23:33   ` Abdurrahman Hussain via B4 Relay
2026-05-09  0:06   ` sashiko-bot [this message]
2026-05-08 23:33 ` [PATCH 3/7] hwmon: (pmbus/adm1266) add firmware_revision debugfs entry Abdurrahman Hussain
2026-05-08 23:33   ` Abdurrahman Hussain via B4 Relay
2026-05-09  0:38   ` sashiko-bot
2026-05-08 23:33 ` [PATCH 4/7] hwmon: (pmbus/adm1266) add clear_blackbox " Abdurrahman Hussain
2026-05-08 23:33   ` Abdurrahman Hussain via B4 Relay
2026-05-09  1:10   ` sashiko-bot
2026-05-08 23:33 ` [PATCH 5/7] hwmon: (pmbus/adm1266) add powerup_counter " Abdurrahman Hussain
2026-05-08 23:33   ` Abdurrahman Hussain via B4 Relay
2026-05-09  1:48   ` sashiko-bot
2026-05-08 23:33 ` [PATCH 6/7] hwmon: (pmbus/adm1266) register rtc_class device backed by SET_RTC Abdurrahman Hussain
2026-05-08 23:33   ` Abdurrahman Hussain via B4 Relay
2026-05-09  2:26   ` sashiko-bot
2026-05-08 23:33 ` [PATCH 7/7] hwmon: (pmbus/adm1266) include adapter number in GPIO line label Abdurrahman Hussain
2026-05-08 23:33   ` Abdurrahman Hussain via B4 Relay
2026-05-09  2:39   ` sashiko-bot
2026-05-09 14:14 ` [PATCH 0/7] hwmon: (pmbus/adm1266) RTC fix, blackbox, FW rev, rtc_class Guenter Roeck
2026-05-09 21:58   ` Abdurrahman Hussain
2026-05-09 23:49     ` Guenter Roeck
2026-05-11  3:46       ` Abdurrahman Hussain

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=20260509000612.91314C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=devnull+abdurrahman.nexthop.ai@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=sashiko@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.