Re: [PATCH 5/9] trinity: Add sysfs debugfs module

From: Greg KH
Date: Wed Jul 27 2022 - 09:25:27 EST


On Mon, Jul 25, 2022 at 03:53:04PM +0900, Jiho Chu wrote:
> This patch includes debugfs and sysfs interfaces.

debugfs and sysfs are two totally different things, with different rules
and requirements. Split this up into at least 2 different patches and
don't mush them all together.

Would you want to try to review 2000+ lines of this type of thing that
does two totally different things at the same time?

Also, you forgot the sysfs Documentation/ABI/ entries, which are
required as you know.

And finally, you should never do this:

> +int trinity_sysfs_init(struct trinity_driver *drv)
> +{
> + struct device *dev = drv_to_dev_ptr(drv);
> + int err;
> +
> + err = sysfs_create_groups(&dev->kobj, trinity_attrs_groups);


You just raced with userspace and lost. Use the default groups pointer
for your driver and all will be fine. Makes for much smaller code that
works properly.

thanks,

greg k-h