[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DBHRYM3JB4NK.1QLZ4RA7NVI25@kernel.org>
Date: Mon, 21 Jul 2025 15:41:34 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Greg KH" <gregkh@...uxfoundation.org>
Cc: "Alice Ryhl" <aliceryhl@...gle.com>, <rafael@...nel.org>,
<ojeda@...nel.org>, <alex.gaynor@...il.com>, <boqun.feng@...il.com>,
<gary@...yguo.net>, <bjorn3_gh@...tonmail.com>, <lossin@...nel.org>,
<a.hindborg@...nel.org>, <tmgross@...ch.edu>,
<rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] device: rust: expand documentation for Device
On Mon Jul 21, 2025 at 3:17 PM CEST, Greg KH wrote:
> 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().
In this case the struct usb_interface represents a bus device, that can become
associated with e.g. a class device of the usbmisc class. :)
So, yeah, there are multiple USB devices, some of them are bus devices, some of
them are class devices.
I'm not sure about the exact topology, but AFAIK USB has different bus device
types representing the hierarchy, i.e. a device structure for the entire "real"
USB device and another one for its interfaces.
> 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
Powered by blists - more mailing lists