mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: chenhan <chenhan0017.work@gmail.com>
To: rust-for-linux@vger.kernel.org
Cc: a.hindborg@kernel.org, boqun@kernel.org,
	fujita.tomonori@gmail.com, frederic@kernel.org, lyude@redhat.com,
	tglx@kernel.org, anna-maria@linutronix.de, jstultz@google.com,
	sboyd@kernel.org, ojeda@kernel.org, gary@garyguo.net,
	bjorn3_gh@protonmail.com, lossin@kernel.org,
	aliceryhl@google.com, tmgross@umich.edu, dakr@kernel.org,
	daniel.almeida@collabora.com, tamird@kernel.org,
	acourbot@nvidia.com, work@onurozkan.dev,
	miguel.ojeda.sandonis@gmail.com, tomo@flapping.org,
	georgeandrout13@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] rust: time: make Delta division and remainder fail consistently
Date: Sat, 17 Oct 2026 19:13:37 +0800	[thread overview]
Message-ID: <20261017111337.22819-1-chenhan0017.work@gmail.com> (raw)
In-Reply-To: <20261001042942.109012-1-chenhan0017.work@gmail.com>

Hi Andreas, Miguel and Tomonori,

Thanks for the follow-up reviews. I have split v3 into three patches:

1. Rename the rem_nanos() argument to divisor and correct its documentation.
2. Add the panic checks and documentation in the existing Delta methods.
3. Move the arithmetic into the new math module and use it from Delta.

V3:
https://lore.kernel.org/rust-for-linux/20261017111134.22546-1-chenhan0017.work@gmail.com/

Andreas wrote:
> Then we can pick patch 1 for fixes and have plenty time to discuss patch
> 2?

The first two patches now form the fix, including the preliminary rename
Miguel requested. Both carry stable Cc, with patch 1 marked as a
prerequisite for patch 2. Patch 2 depends on that rename. The math change
is patch 3, without a stable Cc, so it can be discussed separately.

Tomonori wrote:
> Uwe asked for div helpers in pwm_th1520 [1], and I plan to add the math
> module for them.

Your PWM discussion [1] identifies unsigned helpers such as
mul_u64_u64_div_u64(). I also checked the current pwm_th1520 conversions:
they use unsigned arithmetic, including rounding up. They are not users
of the two signed helpers extracted here. Each helper still has one
production call site in Delta; patch 3 follows Andreas' request to
establish the module.
It makes the helpers public so driver crates can use them. I have not
added unsigned helpers or changed PWM. If your math module lands first,
I can rebase patch 3 onto it without changing the first two patches.

Miguel wrote:
> In any case, safety comment need to explain *why* those conditions are
> true, not just re-state them

The SAFETY comments now point to the checks above that exclude zero and
i64::MIN / -1. The remainder call also explains why &mut rem supplies a
valid, aligned, writable pointer for the duration of the call.

I also removed the two redundant issue-comment Link trailers, the
unrelated "a number of" wording, the C implementation details from the
public documentation, and the "even though ..." explanation. Each API's
Panics section now just states its invalid inputs. The issue Closes and
Georgios' Reported-by are retained.

The cover letter describes the runtime reproducer and validation, with
the API calls and expected results, rather than referring to an
unprovided local Kconfig option.

[1] https://lore.kernel.org/all/20261001.070215.521963012921142699.tomo@flapping.org/

Best regards,
chenhan

      parent reply	other threads:[~2026-10-17 11:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6z5gg2l6ctq6aQIEoJ5hBjZr03ffUqGeECNSGQcVv5eyiZz35kWClxv9o5N7Y-PPk2R2dgpdDxEDLfG7GpkGog==@protonmail.internalid>
2026-10-01  4:29 ` chenhan
2026-10-01  8:10   ` Andreas Hindborg
2026-10-01  9:31     ` FUJITA Tomonori
2026-10-01 10:10       ` Andreas Hindborg
2026-10-01 10:46   ` Miguel Ojeda
2026-10-17 11:13   ` chenhan [this message]

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=20261017111337.22819-1-chenhan0017.work@gmail.com \
    --to=chenhan0017.work@gmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=anna-maria@linutronix.de \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=frederic@kernel.org \
    --cc=fujita.tomonori@gmail.com \
    --cc=gary@garyguo.net \
    --cc=georgeandrout13@gmail.com \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tamird@kernel.org \
    --cc=tglx@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=tomo@flapping.org \
    --cc=work@onurozkan.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 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®