Re: [PATCH v2 01/16] leds: triggers: let struct led_trigger::activate return an error code

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

 



Hello Pavel,

On Thu, May 24, 2018 at 01:54:26PM +0200, Pavel Machek wrote:
> > Given that activating a trigger can fail, let the callback return an
> > indication. This prevents to have a trigger active according to the
> > "trigger" sysfs attribure but not functional.
> > 
> > This is done using a new function callback .new_activate to not break
> > existing drivers and to allow to convert one after the other to the new
> > mechanism. Once all users are converted, .activate can be dropped and
> > .new_activate renamed.
> 
> No, this is not reasonable.
> 
> Instead of big rename, replace return value in ->activate with int. It
> will currently return 0 for all drivers.

No, currently the .activate callbacks "return" void, which e.g. on ARM
means that the r0 register (which holds the return value when the return
type is int) contains an unspecified value which most of the time is not
zero.

> > +++ b/include/linux/leds.h
> > @@ -253,6 +253,8 @@ static inline bool led_sysfs_is_disabled(struct led_classdev *led_cdev)
> >  struct led_trigger {
> >  	/* Trigger Properties */
> >  	const char	 *name;
> > +	int		(*new_activate)(struct led_classdev *led_cdev);
> > +	/* .activate is unused if .new_activate is non-NULL */
> >  	void		(*activate)(struct led_classdev *led_cdev);
> >  	void		(*deactivate)(struct led_classdev *led_cdev);

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