mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: Richard Purdie <rpurdie@rpsys.net>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/11] LED: Add LED Timer Trigger
Date: Tue, 31 Jan 2006 16:01:01 +0100	[thread overview]
Message-ID: <20060131150101.GX18336@lug-owl.de> (raw)
In-Reply-To: <1138714898.6869.129.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1454 bytes --]

On Tue, 2006-01-31 13:41:37 +0000, Richard Purdie <rpurdie@rpsys.net> 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@lug-owl.de    . +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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2006-01-31 15:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-31 13:41 [PATCH 0/11] LED Class, Triggers and Drivers Richard Purdie
2006-01-31 13:41 ` [PATCH 2/11] LED: Add LED Class Richard Purdie
2006-01-31 14:55   ` Jan-Benedict Glaw
2006-01-31 20:59   ` Greg KH
2006-01-31 21:41     ` Richard Purdie
2006-02-01  1:41       ` Greg KH
2006-01-31 13:41 ` [PATCH 4/11] LED: Add LED Timer Trigger Richard Purdie
2006-01-31 15:01   ` Jan-Benedict Glaw [this message]
2006-01-31 17:36     ` Richard Purdie
2006-01-31 15:04 ` [PATCH 0/11] LED Class, Triggers and Drivers Jan-Benedict Glaw
2006-01-31 15:33 ` Pierre Ossman
2006-01-31 16:48   ` Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060131150101.GX18336@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome