Re: [PATCH v4 17/17] virt: acrn: Introduce an interface for Service VM to control vCPU

From: Shuo A Liu
Date: Mon Sep 28 2020 - 02:33:34 EST


On Mon 28.Sep'20 at 7:23:05 +0200, Greg Kroah-Hartman wrote:
On Mon, Sep 28, 2020 at 12:10:07PM +0800, Shuo A Liu wrote:
> You just raced with userspace and lost. If you want to add attribute
> files to a device, use the default attribute group list, and it will be
> managed properly for you by the driver core.
>
> Huge hint, if a driver every has to touch a kobject, or call sysfs_*,
> then it is probably doing something wrong.

Do you mean use .groups of struct miscdevice directly ?

If yes, let me follow drivers/char/hw_random/s390-trng.c to do this.
BTW, few driver use the .groups directly. :)

Drivers should almost never be messing with individual sysfs files. And
this ability to use .groups is a "new" one, conversions of existing code
that do not use them is always welcome.

OK. Thanks for the explanation. I will follow the 'new' way :)

Thanks
shuo