ledtrig-disk.c 976 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * LED Disk Activity Trigger
  3. *
  4. * Copyright 2006 Openedhand Ltd.
  5. *
  6. * Author: Richard Purdie <rpurdie@openedhand.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/leds.h>
  16. #define BLINK_DELAY 30
  17. DEFINE_LED_TRIGGER(ledtrig_disk);
  18. DEFINE_LED_TRIGGER(ledtrig_ide);
  19. void ledtrig_disk_activity(void)
  20. {
  21. unsigned long blink_delay = BLINK_DELAY;
  22. led_trigger_blink_oneshot(ledtrig_disk,
  23. &blink_delay, &blink_delay, 0);
  24. led_trigger_blink_oneshot(ledtrig_ide,
  25. &blink_delay, &blink_delay, 0);
  26. }
  27. EXPORT_SYMBOL(ledtrig_disk_activity);
  28. static int __init ledtrig_disk_init(void)
  29. {
  30. led_trigger_register_simple("disk-activity", &ledtrig_disk);
  31. led_trigger_register_simple("ide-disk", &ledtrig_ide);
  32. return 0;
  33. }
  34. device_initcall(ledtrig_disk_init);