Hello, On Wed, May 16, 2018 at 09:46:20PM +0200, Jacek Anaszewski wrote: > On 05/15/2018 10:14 PM, Uwe Kleine-König wrote: > > I looked into this driver and it does forbidden stuff. You must not call > > device_create_file() for an already bound device. (@gregkh: Would it be > > a good idea to issue a warning when device_create_file is called too > > late, maybe only if CONFIG_DEBUG_KERNEL=y or CONFIG_DEBUG_SOMETHING?) > > Many LED triggers create their specific sysfs files this way. It is still not ok, even if others do it this way. > > A sane approach to such trigger parameters would include putting a > > const struct attribute_group **groups member into the struct > > led_trigger and let led_trigger_register do the right thing with it. > > > > Not sure what "the right thing" is here. Just adding the group > > certainly is not. We'd somehow need a new kobject for this. @gregkh: > > Maybe you can comment and point out the way to go here? > > kobject_uevent_env() is called on led_cdev->dev->kobj from > led_trigger_set(). I'm not 100% confident, but I think this doesn't justify adding attributes after registration. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html