Re: [PATCH] LED: add LED heartbeat trigger

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

 



On 6/20/06, Atsushi Nemoto <[email protected]> wrote:
Add an LED trigger acts like a heart beat.  This can be used as a
replacement of CONFIG_HEARTBEAT code exists in some arch's timer code.

Signed-off-by: Atsushi Nemoto <[email protected]>

<snip>

new file mode 100644
index 0000000..07ac645
--- /dev/null
+++ b/drivers/leds/ledtrig-heartbeat.c
+               heartbeat_data->period = heartbeat_data->period * HZ / 100;
+               delay = 7 * HZ / 100;

Can these and the other HZ/100 users make use of the existing
*secs_to_jiffies() methods? FYI, if HZ=250, you're getting rounding
here, not sure if it's desired.

<snip>

+static void heartbeat_trig_activate(struct led_classdev *led_cdev)
+{
+       struct heartbeat_trig_data *heartbeat_data;
+
+       heartbeat_data = kzalloc(sizeof(*heartbeat_data), GFP_KERNEL);
+       if (!heartbeat_data)
+               return;
+
+       led_cdev->trigger_data = heartbeat_data;
+       init_timer(&heartbeat_data->timer);
+       heartbeat_data->timer.function = led_heartbeat_function;
+       heartbeat_data->timer.data = (unsigned long) led_cdev;

setup_timer()? (which will call init_timer() before returning.

Thanks,
Nish
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[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