Re: [PATCH] usb: rust: mark Device and Interface methods as inline

Miguel Ojeda <[email protected]> Wed, 17 Jun 2026 16:39:30 +0200
Newsgroups dev.linux.lists.linux-kernel-mentees,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux
Message-ID <CANiq72=Hmor3xnwQKbqoLe28yMei6hz9KdAUHeje4UapyF_w_w@mail.gmail.com>
On Wed, Jun 17, 2026 at 12:36 AM Nicolás Antinori
<[email protected]> wrote:
>
> When building the kernel using llvm-19.1.7-rust-1.85.1-x86_64, the
> following symbols are generated:
>
> $ nm vmlinux | grep ' _R'.*usb.*Device | rustfilt
> ...
> ffffffff823f2490 T <kernel::usb::Device as kernel::sync::aref::AlwaysRefCounted>::dec_ref
> ffffffff823f2470 T <kernel::usb::Device as kernel::sync::aref::AlwaysRefCounted>::inc_ref
> ...
>
> $ nm vmlinux | grep ' _R'.*usb.*Interface | rustfilt
> ffffffff823f2450 T <kernel::usb::Interface as kernel::sync::aref::AlwaysRefCounted>::dec_ref
> ffffffff823f2430 T <kernel::usb::Interface as kernel::sync::aref::AlwaysRefCounted>::inc_ref
> ...
>
> However, these Rust symbols are trivial wrappers around the
> `usb_get_dev`, `usb_put_dev`, `usb_get_intf` and `usb_put_intf`
> functions. It doesn't make sense to go through a trivial wrapper
> for these functions.
>
> Link: https://github.com/Rust-for-Linux/linux/issues/1145
> Suggested-by: Alice Ryhl <[email protected]>
> Signed-off-by: Nicolás Antinori <[email protected]>

Looks good, thanks -- I can pick this up, unless USB wants to route it
differently.

Cheers,
Miguel