Re: [PATCH 2/3] device: rust: expand documentation for Device
From: Greg KH
Date: Mon Jul 21 2025 - 09:17:44 EST
On Mon, Jul 21, 2025 at 02:13:14PM +0200, Danilo Krummrich wrote:
> On Mon Jul 21, 2025 at 2:07 PM CEST, Alice Ryhl wrote:
> > The connection is that to request an irq you must have a &Device<Bound>,
> > so if you can only obtain a &Device<Bound> to a bus device, then that
> > means that you can never request an irq for a class device.
>
> As mentioned in my other reply, a class device never owns resources of a "real"
> device such as an IRQ.
>
> A USB device, which represents a real device on a bus, is a bus device, in your
> example the class device is the input device.
>
Just to confuse things a bit more (sorry), there are also "USB class
devices" that represent USB devices that use the "generic" USB interface
to userspace api. You can find these by searching for
usb_register_dev().
Note, this is different from the drivers/usb/class/ drivers, which
represent various "USB class protocol" that the USB.org group defines,
and those talk to userspace through the various common class apis
depending on the specific device type (input, network, etc.) and are USB
bus drivers.
Naming is hard, wait until you learn about "usb gadget" a word we had to
invent to describe the thing :)
thanks,
greg k-h