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.