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]
Message-ID: <20081123123154.GB7310@ucw.cz>
Date:	Sun, 23 Nov 2008 13:31:54 +0100
From:	Pavel Machek <pavel@...e.cz>
To:	Trent Piepho <tpiepho@...escale.com>
Cc:	Richard Purdie <rpurdie@...ys.net>, linux-kernel@...r.kernel.org,
	linuxppc-dev@...abs.org,
	Anton Vorontsov <avorontsov@...mvista.com>,
	Sean MacLennan <smaclennan@...atech.com>,
	Wolfram Sang <w.sang@...gutronix.de>,
	Grant Likely <grant.likely@...retlab.ca>
Subject: Re: [PATCH 4/4] leds: Let GPIO LEDs keep their current state

On Thu 2008-11-20 17:05:56, Trent Piepho wrote:
> On Mon, 17 Nov 2008, Richard Purdie wrote:
> > On Fri, 2008-10-24 at 16:09 -0700, Trent Piepho wrote:
> >> +	if (template->keep_state)
> >> +		state = !!gpio_get_value(led_dat->gpio) ^ led_dat->active_low;
> >> +	else
> >> +		state = template->default_state;
> >>
> >>  		state = of_get_property(child, "default-state", NULL);
> >>  		led.default_state = state && !strcmp(state, "on");
> >> +		led.keep_state = state && !strcmp(state, "keep");
> >>
> >> +++ b/include/linux/leds.h
> >> @@ -138,7 +138,8 @@ struct gpio_led {
> >>  	const char *default_trigger;
> >>  	unsigned 	gpio;
> >>  	u8 		active_low;
> >> -	u8		default_state;
> >> +	u8		default_state;	/* 0 = off, 1 = on */
> >> +	u8		keep_state; /* overrides default_state */
> >>  };
> >
> > How about something simpler here, just make default state have three
> > different values - "keep", "on" and "off"? I'm not keen on having two
> > different state variables like this.
> 
> I thought of that, but it ends up being more complex.  Instead of just
> using:
> static const struct gpio_led myled = {
>  	.name = "something",
>  	.keep_state = 1,
> }
> 
> You'd do something like this:
>  	.default_state = LEDS_GPIO_DEFSTATE_KEEP,
> 
> Is that better?

Yes.

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
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