Re: [PATCH 4/11] LED: Add LED Timer Trigger
From: Jan-Benedict Glaw
Date: Tue Jan 31 2006 - 09:59:23 EST
On Tue, 2006-01-31 13:41:37 +0000, Richard Purdie <rpurdie@xxxxxxxxx> 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 jbglaw@xxxxxxxxxx . +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