Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "FUJITA Tomonori" <tomo@flapping.org>
Cc: linux-serial@vger.kernel.org, ojeda@kernel.org, gary@garyguo.net
Subject: Re: [PATCH v2] rust: serdev: use Delta<Jiffy> for timeouts
Date: Mon, 02 Nov 2026 00:58:48 +0000	[thread overview]
Message-ID: <sashiko-outbox-192799@kernel.org> (raw)
In-Reply-To: <20261102005125.626125-1-tomo@flapping.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] rust: serdev: outdated timeout type in Driver doctest for write_all()
--

commit 2726c2fee6d94012455c660974ada63f17dd12c7
Author: FUJITA Tomonori <fujita.tomonori@gmail.com>

rust: serdev: use Delta<Jiffy> for timeouts

This commit updates serdev::Device::write_all() and
serdev::Device::wait_until_sent() to accept a Delta<Jiffy> timeout instead
of a raw Jiffies value, rounding non-positive timeouts up to one jiffy.

> diff --git a/rust/kernel/serdev.rs b/rust/kernel/serdev.rs
> index 17ca504b7f8d6..656598602d7a9 100644
> --- a/rust/kernel/serdev.rs
> +++ b/rust/kernel/serdev.rs

[ ... ]

> @@ -475,28 +488,26 @@ pub fn set_parity(&self, parity: Parity) -> Result {
>      /// [`Device::wait_until_sent`] to make sure the controller write buffer has actually been
>      /// emptied.
>      ///
> -    /// Use a timeout of 0 to wait indefinitely.
> +    /// A `timeout` of 0 or negative is rounded up to one jiffy. Pass
> +    /// `Delta::from_jiffies(isize::MAX)` to wait indefinitely.
>      ///
>      /// Returns the number of bytes written (less than `data.len()` if interrupted).
>      /// [`kernel::error::code::ETIMEDOUT`] or [`kernel::error::code::ERESTARTSYS`] if interrupted
>      /// before any bytes were written. [`kernel::error::code::EINVAL`] if `data.len() > i32::MAX`.
>      #[inline]
> -    pub fn write_all(&self, data: &[u8], timeout: Jiffies) -> Result<usize> {
> +    pub fn write_all(&self, data: &[u8], timeout: Delta<Jiffy>) -> Result<usize> {

[Severity: Low]
Does the rustdoc example on the serdev::Driver trait in rust/kernel/serdev.rs
also need to be updated for this signature change?

///     fn probe<'bound>(
///         sdev: &'bound serdev::Device<Core<'_>>,
///         _id_info: Option<&'bound Self::IdInfo>,
///     ) -> impl PinInit<Self::Data<'bound>, Error> + 'bound {
///         sdev.set_baudrate(115200);
///         sdev.write_all(b"Hello\n", 0)?;
///         Ok(MyDriver)
///     }

It still passes an integer literal 0 to sdev.write_all(), which fails to
compile when building with CONFIG_RUST_SERIAL_DEV_BUS_ABSTRACTIONS=y and
CONFIG_RUST_KERNEL_DOCTESTS=y.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261102005125.626125-1-tomo@flapping.org?part=1

  reply	other threads:[~2026-11-02  0:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  0:51 [PATCH v2] rust: serdev: use Delta<Jiffy> for timeouts FUJITA Tomonori
2026-11-02  0:58 ` sashiko-bot [this message]
2026-11-02 14:41 ` Markus Probst

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=sashiko-outbox-192799@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-serial@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tomo@flapping.org \
    /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