Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318962
b: refs/heads/master
c: 3740e49
h: refs/heads/master
v: v3
  • Loading branch information
Fabio Baltieri authored and Bryan Wu committed Jul 23, 2012
1 parent 752a32f commit 465b751
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5bb629c504394f4d42c53a25d75ccb02a393f92f
refs/heads/master: 3740e49c668bbe7719f292c24c4c5f152a88b97e
25 changes: 4 additions & 21 deletions trunk/drivers/leds/ledtrig-ide-disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,22 @@
*/

#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/timer.h>
#include <linux/leds.h>

static void ledtrig_ide_timerfunc(unsigned long data);
#define BLINK_DELAY 30

DEFINE_LED_TRIGGER(ledtrig_ide);
static DEFINE_TIMER(ledtrig_ide_timer, ledtrig_ide_timerfunc, 0, 0);
static int ide_activity;
static int ide_lastactivity;
static unsigned long ide_blink_delay = BLINK_DELAY;

void ledtrig_ide_activity(void)
{
ide_activity++;
if (!timer_pending(&ledtrig_ide_timer))
mod_timer(&ledtrig_ide_timer, jiffies + msecs_to_jiffies(10));
led_trigger_blink_oneshot(ledtrig_ide,
&ide_blink_delay, &ide_blink_delay, 0);
}
EXPORT_SYMBOL(ledtrig_ide_activity);

static void ledtrig_ide_timerfunc(unsigned long data)
{
if (ide_lastactivity != ide_activity) {
ide_lastactivity = ide_activity;
/* INT_MAX will set each LED to its maximum brightness */
led_trigger_event(ledtrig_ide, INT_MAX);
mod_timer(&ledtrig_ide_timer, jiffies + msecs_to_jiffies(10));
} else {
led_trigger_event(ledtrig_ide, LED_OFF);
}
}

static int __init ledtrig_ide_init(void)
{
led_trigger_register_simple("ide-disk", &ledtrig_ide);
Expand Down

0 comments on commit 465b751

Please sign in to comment.