lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 22 Sep 2010 10:56:06 +0200
From:	Johannes Berg <johannes@...solutions.net>
To:	Richard Purdie <rpurdie@...ys.net>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC] led-class: always implement blinking

On Tue, 2010-09-21 at 22:24 +0100, Richard Purdie wrote:

> > Well, this function gets assigned to led_cdev->blink_set(), which is a
> > function pointer that takes pass-by-reference arguments. The comment
> > there says:
> > 
> >         /* Activate hardware accelerated blink, delays are in
> >          * miliseconds and if none is provided then a sensible default
> >          * should be chosen. The call can adjust the timings if it can't
> >          * match the values specified exactly. */
> >         int             (*blink_set)(struct led_classdev *led_cdev,
> >                                      unsigned long *delay_on,
> >                                      unsigned long *delay_off);
> > 
> > but the software implementation doesn't adjust the timings, of course. I
> > suppose the "adjust the timings" was also meant to update the values.
> 
> The idea was that hardware fallbacks would let the caller know what
> values it had actually fallen back to. The software fallback using
> timers is generic so doesn't need to change the values.
> 
> I've been meaning to look more closely at the patch but I haven't got to
> it yet, sorry :(.

Right. But I actually ran into problems here. I had to add another
"blink_stop" software function, because even though the _internal_ code
in led-class.c currently assumes calling blink_set(0, 0) will stop
blinking, the documentation says that then it should chose a
"user-friendly" blinking speed... So there are bugs in the current
implementation, and not all LEDs implement this either.

Additionally, blink_set() may return an error, in which case software
fallback should be used.

I solved this yesterday in a new version of my patch by adding new API

void led_classdev_blink_set(*dev, *on, *off)

that will use blink_set() and then fall back to software.

HOWEVER, if you use that, then just doing brightness_set(dev, LED_OFF)
will not turn off blinking because we cannot hook into that from the
software blinking implementation. There are two ways to solve this:

a) provide a wrapper for brightness_set() as well, that will disable
   software blink, and should be used in preference of calling the
   function pointer directly, it may be an inline.

b) provide a function led_classdev_blink_stop() that will turn off the
   LED and stop the blinking

Which one would you prefer?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ