Re: [PATCH] LED: add LED heartbeat trigger

From: Nish Aravamudan
Date: Tue Jun 20 2006 - 12:53:52 EST


On 6/20/06, Atsushi Nemoto <anemo@xxxxxxxxxxxxx> 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 <anemo@xxxxxxxxxxxxx>

<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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/