Re: [PATCH] WIP: drivers/base: Add virtual_device_create()

Andy Shevchenko
2025-01-31T10:43:22Z

On Thu, Jan 30, 2025 at 04:28:26PM -0500, Lyude Paul wrote:
> As Greg KH pointed out, we have a nice /sys/devices/virtual directory free
> for the taking - but the vast majority of device drivers concerned with
> virtual devices do not use this and instead misuse the platform device API.
>
> To fix this, let's start by adding a simple function that can be used for
> creating virtual devices - virtual_device_create().
>
> Signed-off-by: Lyude Paul <lyude@redhat.com>
>
> ---
>
> So, WIP obviously because I wrote this up in a few minutes - but this goes
> off the idea that Danilo suggested to me off-list of coming up with a
> simple API for handling virtual devices that's a little more obvious to
> use. I wanted to get people's feedback and if we're happy with this idea,
> I'm willing to go through and add some pointers to this function in various
> platform API docs - along with porting over the C version of VKMS over to
> this API.

So, if it goes anywhere, please be sure that:
1) it's implemented in a separate *.c and *.h;
2) it won't abuse header inclusions and add into dependency hell;
3) it's documented.

Additionally would be nice to have one user to be converted to see how it may
be done in practice.

--
With Best Regards,
Andy Shevchenko