Re: [PATCH 0/2] rust: usb: add initial USB abstractions
From: Greg Kroah-Hartman
Date: Tue Sep 23 2025 - 08:55:15 EST
On Tue, Sep 23, 2025 at 02:29:00PM +0200, Alice Ryhl wrote:
> On Tue, Sep 23, 2025 at 2:05 PM Greg Kroah-Hartman
> <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Mon, Aug 25, 2025 at 03:18:04PM -0300, Daniel Almeida wrote:
> > > This adds initial support for USB Rust drivers, not only because I see a
> > > widespread use of module_usb_driver() in media (which is a subsystem I
> > > aim to support) but also because I want to learn about USB in general
> > > and this is a nice opportunity to start doing so.
> > >
> > > I tried to keep things as consistent with pci.rs and platform.rs as
> > > possible and tested it by manually binding a device (i.e.: my Logitech
> > > mouse) to the sample driver via:
> > >
> > > /sys/bus/usb/drivers/rust_driver_usb/new_id
> > >
> > > This initial patch is therefore comprised of the same patterns that are
> > > known to work for pci and platform already.
> > >
> > > Physically disconnecting the device also worked, i.e.: nothing bad
> > > showed up in dmesg.
> > >
> > > Note that I did not touch MAINTAINERS at all. The objective is to
> > > kickstart the discussion of what to do there here in v1.
> >
> > I tried to apply these, but I get the following build error when adding
> > to the char-misc-testing tree:
> >
> > ld.lld: error: undefined symbol: usb_get_intf
> > >>> referenced by kernel.1a949e63ee2acc6a-cgu.0
> > >>> rust/kernel.o:(<kernel::usb::Interface as kernel::sync::aref::AlwaysRefCounted>::inc_ref) in archive vmlinux.a
> > >>> referenced by kernel.1a949e63ee2acc6a-cgu.0
> > >>> rust/kernel.o:(<kernel::sync::aref::ARef<kernel::usb::Interface> as core::convert::From<&kernel::usb::Interface<kernel::device::CoreInternal>>>::from) in archive vmlinux.a
> >
> > ld.lld: error: undefined symbol: usb_put_intf
> > >>> referenced by kernel.1a949e63ee2acc6a-cgu.0
> > >>> rust/kernel.o:(<kernel::usb::Interface as kernel::sync::aref::AlwaysRefCounted>::dec_ref) in archive vmlinux.a
> >
> > ld.lld: error: undefined symbol: usb_get_dev
> > >>> referenced by kernel.1a949e63ee2acc6a-cgu.0
> > >>> rust/kernel.o:(<kernel::usb::Device as kernel::sync::aref::AlwaysRefCounted>::inc_ref) in archive vmlinux.a
> > >>> referenced by kernel.1a949e63ee2acc6a-cgu.0
> > >>> rust/kernel.o:(<kernel::sync::aref::ARef<kernel::usb::Device> as core::convert::From<&kernel::usb::Device<kernel::device::CoreInternal>>>::from) in archive vmlinux.a
> >
> > ld.lld: error: undefined symbol: usb_put_dev
> > >>> referenced by kernel.1a949e63ee2acc6a-cgu.0
> > >>> rust/kernel.o:(<kernel::usb::Device as kernel::sync::aref::AlwaysRefCounted>::dec_ref) in archive vmlinux.a
> >
> >
> > Any hints?
>
> Did you enable CONFIG_USB?
Yes, CONFIG_USB=m