Re: [PATCH 2/2] rust/kernel: Add platform::ModuleDevice

Danilo Krummrich
2025-01-24T10:52:41Z

On Thu, Jan 23, 2025 at 03:17:23PM +0100, Greg Kroah-Hartman wrote:
> On Thu, Jan 23, 2025 at 11:21:28AM +0100, Danilo Krummrich wrote:
> > On Thu, Jan 23, 2025 at 07:23:08AM +0100, Greg Kroah-Hartman wrote:
> > > On Wed, Jan 22, 2025 at 06:49:22PM -0500, Lyude Paul wrote:
> > > > A number of kernel modules work with virtual devices, where being virtual
> > > > implies that there's no physical device to actually be plugged into the
> > > > system. Because of that, such modules need to be able to manually
> > > > instantiate a kernel device themselves - which can then be probed in the
> > > > same manner as any other kernel device.
> > > >
> > > > This adds support for such a usecase by introducing another platform device
> > > > type, ModuleDevice. This type is interchangeable with normal platform
> > > > devices, with the one exception being that it controls the lifetime of the
> > > > registration of the device.
> > >
> > > Sorry, but a "virtual" device is NOT a platform device at all. Platform
> > > devices are things that are not on a real bus and are described by
> > > firmware somehow.
> > >
> > > The kernel has "virtual" devices today just fine, look at
> > > /sys/devices/virtual/ so why not just use that api instead of making up
> > > something new?
> >
> > I think we briefly discussed this in another mail thread [1] for the example of
> > the vKMS driver [2] in the past.
> >
> > In [1] you mentioned that with the virtual device API, things are a bit
> > inconvenient and that you want to follow up on this.
>
> And my intern ended up doing other things last summer and never got to
> this, sorry. I've not had the time either. Let me try to get to it
> next week, but no promises...
>
> But that doesn't excuse the abuse of platform devices, that's not ok,
> and I'm not going to want to take this change at all, sorry.

It does not, indeed. That's not what I wanted to imply.

I brought it up to see if there has been any progress already that can be built
upon.