From: sashiko-bot@kernel.org
To: "Trevor Chan" <trev@trevrosa.dev>
Cc: linux-pci@vger.kernel.org, ojeda@kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5] rust: aref: make `AlwaysRefCounted::inc_ref` an associated function
Date: Sun, 28 Jun 2026 09:37:05 +0000 [thread overview]
Message-ID: <20260628093705.CB2BB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260628092853.16550-1-trev@trevrosa.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Un-updated AlwaysRefCounted trait implementations cause conditional compilation and rustdoc test errors.
--
commit 5db284043a909f35f9aed5c1467a5f9cf863972d
Author: Trevor Chan <trev@trevrosa.dev>
rust: aref: make `AlwaysRefCounted::inc_ref` an associated function
This commit changes the AlwaysRefCounted::inc_ref function from a method
to an associated function to prevent accidental calls. It updates the
implementors of this trait to reflect this change.
Link: https://github.com/Rust-for-Linux/linux/issues/1177
> diff --git a/rust/kernel/sync/aref.rs b/rust/kernel/sync/aref.rs
> index b721b2e00b986..2ae2130d5bb1d 100644
> --- a/rust/kernel/sync/aref.rs
> +++ b/rust/kernel/sync/aref.rs
> @@ -44,7 +44,10 @@
> /// alive.)
> pub unsafe trait AlwaysRefCounted {
> /// Increments the reference count on the object.
> - fn inc_ref(&self);
> + ///
> + /// This function should not be called accidentally; a type might declare their own `inc_ref`
> + /// function and it shouldn't be confused with this one.
> + fn inc_ref(obj: &Self);
[Severity: Low]
Will this change break the build for conditionally compiled modules and
rustdoc tests that still use the old method signature?
When compiling with CONFIG_RUST_DRM_GPUVM, CONFIG_PM_OPP, or
CONFIG_RUST_PWM_ABSTRACTIONS enabled, it appears this will result in
compiler error E0185 because the following implementations were not updated:
rust/kernel/drm/gpuvm/mod.rs:
unsafe impl<T: DriverGpuVm> AlwaysRefCounted for GpuVm<T> {
fn inc_ref(&self) {
rust/kernel/drm/gpuvm/vm_bo.rs:
unsafe impl<T: DriverGpuVm> AlwaysRefCounted for GpuVmBo<T> {
fn inc_ref(&self) {
rust/kernel/opp.rs:
unsafe impl AlwaysRefCounted for OPP {
#[inline]
fn inc_ref(&self) {
rust/kernel/pwm.rs:
unsafe impl<T: PwmOps> AlwaysRefCounted for Chip<T> {
#[inline]
fn inc_ref(&self) {
Additionally, a rustdoc test in rust/kernel/sync/aref.rs for ARef::into_raw
still implements it using the old signature:
/// unsafe impl AlwaysRefCounted for Empty {
/// fn inc_ref(&self) {}
Should these implementations be updated to use fn inc_ref(obj: &Self) to
match the new trait definition?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260628092853.16550-1-trev@trevrosa.dev?part=1
prev parent reply other threads:[~2026-06-28 9:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 9:28 [PATCH v5] rust: aref: make `AlwaysRefCounted::inc_ref` an associated function Trevor Chan
2026-06-28 9:37 ` sashiko-bot [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=20260628093705.CB2BB1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-pci@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=trev@trevrosa.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