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: <1332950949.2305.10.camel@lorien2>
Date:	Wed, 28 Mar 2012 10:09:09 -0600
From:	Shuah Khan <shuahkhan@...il.com>
To:	NeilBrown <neilb@...e.de>
Cc:	shuahkhan@...il.com, rpurdie@...ys.net,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] LEDS-One-Shot-Timer-Trigger-implementation

Neil,

> 
> In general I approve of this - thanks for your efforts.
> 
> However there are some details that need attention.

Thanks.
> 
> > 
> > This patch implements the one-shot-timer trigger support by enhancing the
> > current led-class and ledtrig-timer drivers to support the following
> > use-cases:
> > 
> > use-case 1:
> > echo one-shot-timer > /sys/class/leds/SOMELED/trigger
> 
> I don't like the name "one-shot-timer".  This name describes how you expect
> the functionality to be used, but not what the actual difference between
> "timer" and "one-shot-timer" is.
> That difference is simply that one-shot-timer does not start an initial
> default blink, while "timer" does.
> So a name like "timer-no-default" would be a more accurate description and so
> should be preferred.

Yes, timer-no-default describes the enhancement I am making, better than
one-shot-timer does. I will generate patch v2 to address your concerns
and will change the name to timer-no-default and update the relevant
code and documentation that goes with the patch to reflect the change.
> 
> 
> > echo 2000 > /sys/class/leds/SOMELED/delay_on
> 
> This command will call led_blink_set with an on time of '2000' and an off
> time of '0'.  This will cause led_set_software_blink to turn the LED on and
> set no off timer.  This is just as bad as starting a default blink - there is
> no guarantee that the LED (or vibrator) will ever be turned off.
> 
> You need to set 'delay_off' to 'forever' first.

Good point. Will update the documentation.
> 
> >
> I think you should also mention here that:
> 
>  - The 'forever' value is stored as 'ULONG_MAX'.  Possibly a 
>        #define FOREVER ULONG_MAX
>    in the code would be appropriate.  This mapping is only used internally,
>    not in the interface.
> 
>  - The led_blink_set function - which takes two pointers to times - has
>    been extended so that a NULL instead of a pointer means "forever".

Will do.

> > +
> 
> I think
>                 return sprintf(buf, "forever\n");
> 
> if the more common usage.
> 
> Also in led_delay_off_show() below.

ok.
> 

> 
> kstrtoul is currently preferred.  It ensures uniform error codes.
> 

Yes. I noticed the checkpatch.pl warnings. This change is better made as
a separate patch. Do you mind if I deferred it and volunteer to fix it
in a separate patch shortly. :)

> 
> > +	
> 
> Do you need to led_trigger_unregister(&timer_led_trigger) if the registration
> of one_shot_timer_led_trigger fails?

Yes, considered that while I was changing this routine, and thought
might be better to leave the registered timer alone when the second
registration fails. I can go either way.

-- Shuah


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