Re: [PATCH 4/11] LED: Add LED Timer Trigger

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

 



On Tue, 2006-01-31 13:41:37 +0000, Richard Purdie <[email protected]> wrote:
> Index: linux-2.6.15/drivers/leds/ledtrig-timer.c
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ linux-2.6.15/drivers/leds/ledtrig-timer.c	2006-01-29 17:40:11.000000000 +0000
> @@ -0,0 +1,204 @@
> +/* led_dev write lock needs to be held */
> +static void led_timer_setdata(struct led_device *led_dev, unsigned long duty, unsigned long frequency)
> +{
> +	struct timer_trig_data *timer_data = led_dev->trigger_data;
> +	signed long duty1;
> +
> +	if (frequency > 500)
> +		frequency = 500;

Why? ...and especially: why, without complaining?

> +	if (duty > 100)
> +		duty = 100;

Dito.

> +	duty1 = duty - 50;
> +
> +	timer_data->duty = duty;
> +	timer_data->frequency = frequency;
> +	if (frequency != 0) {
> +		timer_data->delay_on = (50 - duty1) * 1000 / 50 / frequency;
> +		timer_data->delay_off = (50 + duty1) * 1000 / 50 / frequency;
> +	}

Nice math :-)

> +	mod_timer(&timer_data->timer, jiffies);
> +}
> +

MfG, JBG

-- 
Jan-Benedict Glaw       [email protected]    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 für einen Freien Staat voll Freier Bürger"  | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux