Re: [PATCH v4 4/4] tty: implement led triggers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/  |



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux