From: sashiko-bot@kernel.org
To: "Danilo Krummrich" <dakr@kernel.org>
Cc: ojeda@kernel.org, dri-devel@lists.freedesktop.org,
"Alexandre Courbot" <acourbot@nvidia.com>
Subject: Re: [PATCH v4 6/7] rust: pci: return DevresLt from Bar::into_devres()
Date: Fri, 26 Jun 2026 18:46:13 +0000 [thread overview]
Message-ID: <20260626184613.ABFA61F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260626183630.2585057-7-dakr@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Missing default generic parameter `SIZE = 0` on the `DevresBar` type alias.
--
commit 017789d5b34f5d46a0492fb61faa312b02cc8a26
Author: Danilo Krummrich <dakr@kernel.org>
rust: pci: return DevresLt from Bar::into_devres()
This commit updates Bar::into_devres() to return DevresLt, which can shorten
the stored static lifetime back to the caller's borrow lifetime. It implements
CovariantForLt and ForLt for Bar and adds a DevresBar type alias.
> diff --git a/rust/kernel/pci/io.rs b/rust/kernel/pci/io.rs
> index 0461e01aaa20e..7a0d2d74129d1 100644
> --- a/rust/kernel/pci/io.rs
> +++ b/rust/kernel/pci/io.rs
[ ... ]
> @@ -151,6 +155,19 @@ pub struct Bar<'a, const SIZE: usize = 0> {
> num: i32,
> }
>
> +impl<const SIZE: usize> ForLt for Bar<'static, SIZE> {
> + type Of<'a> = Bar<'a, SIZE>;
> +}
> +
> +// SAFETY: `Bar<'a, SIZE>` is covariant over `'a`; it holds `&'a Device<Bound>`,
> +// which is covariant.
> +unsafe impl<const SIZE: usize> CovariantForLt for Bar<'static, SIZE> {}
> +
> +/// A device-managed PCI BAR mapping.
> +///
> +/// See [`Bar::into_devres`].
> +pub type DevresBar<const SIZE: usize> = DevresLt<Bar<'static, SIZE>>;
[Severity: Low]
This isn't a bug, but should DevresBar provide a default size parameter to
match the underlying Bar struct?
The Bar struct defines its size parameter with a default of 0 as seen in the
context above, but the new DevresBar alias omits this default. This omission
requires callers to explicitly specify the size when using the alias, which
creates a slight inconsistency in API ergonomics between the base type and its
device-managed counterpart.
Would it make sense to define it as:
pub type DevresBar<const SIZE: usize = 0> = DevresLt<Bar<'static, SIZE>>; ?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260626183630.2585057-1-dakr@kernel.org?part=6
next prev parent reply other threads:[~2026-06-26 18:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-26 18:36 [PATCH v4 0/7] ForLt/CovariantForLt split, auxiliary closure API and DevresLt Danilo Krummrich
2026-06-26 18:36 ` [PATCH v4 1/7] rust: types: rename ForLt to CovariantForLt Danilo Krummrich
2026-06-27 10:59 ` Miguel Ojeda
2026-06-26 18:36 ` [PATCH v4 2/7] rust: types: introduce ForLt base trait for CovariantForLt Danilo Krummrich
2026-06-27 12:26 ` Miguel Ojeda
2026-06-27 13:51 ` Danilo Krummrich
2026-06-27 14:21 ` Miguel Ojeda
2026-06-30 13:50 ` Gary Guo
2026-06-26 18:36 ` [PATCH v4 3/7] rust: auxiliary: add registration_data_with() for ForLt types Danilo Krummrich
2026-06-26 18:36 ` [PATCH v4 4/7] rust: auxiliary: sample: demonstrate ForLt with invariant Mutex type Danilo Krummrich
2026-06-26 18:36 ` [PATCH v4 5/7] rust: devres: add DevresLt for ForLt-aware device resource access Danilo Krummrich
2026-06-26 18:50 ` sashiko-bot
2026-06-26 18:36 ` [PATCH v4 6/7] rust: pci: return DevresLt from Bar::into_devres() Danilo Krummrich
2026-06-26 18:46 ` sashiko-bot [this message]
2026-06-26 18:36 ` [PATCH v4 7/7] rust: io: mem: return DevresLt from IoMem/ExclusiveIoMem::into_devres() Danilo Krummrich
2026-07-12 0:07 ` [PATCH v4 0/7] ForLt/CovariantForLt split, auxiliary closure API and DevresLt Danilo Krummrich
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=20260626184613.ABFA61F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acourbot@nvidia.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox