Skip to contentSkip to conversation

LED: Add IDE disk activity LED trigger

PATCH In review Richard Purdie 2 participants 2 messages Mar 29, 2006 LED

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 LED: Add IDE disk activity LED trigger

Add an LED trigger for IDE disk activity to the ide-disk driver.

drivers/ide/ide-disk.c +3 -0
Index: linux-2.6.16/drivers/ide/ide-disk.c
===================================================================
@@ -60,6 +60,7 @@
 #include <linux/genhd.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
+#include <linux/leds.h>
 
 #define _IDE_DISK
 
@@ -316,6 +317,8 @@
 		return ide_stopped;
 	}
 
+	ledtrig_ide_activity();
+
 	pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n",
 		 drive->name, rq_data_dir(rq) == READ ? "read" : "writ",
 		 (unsigned long long)block, rq->nr_sectors,
drivers/leds/ledtrig-ide-disk.c new file +62 -0

62 lines not on this page · raw message

include/linux/leds.h +8 -0
Index: linux-2.6.16/include/linux/leds.h
===================================================================
@@ -98,4 +98,12 @@
 #define led_trigger_event(x, y) do {} while(0)
 
 #endif
+
+/* Trigger specific functions */
+#ifdef CONFIG_LEDS_TRIGGER_IDE_DISK
+extern void ledtrig_ide_activity(void);
+#else
+#define ledtrig_ide_activity() do {} while(0)
+#endif
+
 #endif		/* __LINUX_LEDS_H_INCLUDED */
drivers/leds/Kconfig +7 -0
Index: linux-2.6.16/drivers/leds/Kconfig
===================================================================
@@ -66,5 +66,12 @@
 	  This allows LEDs to be controlled by a programmable timer
 	  via sysfs. If unsure, say Y.
 
+config LEDS_TRIGGER_IDE_DISK
+	bool "LED Timer Trigger"
+	depends LEDS_TRIGGERS && BLK_DEV_IDEDISK
+	help
+	  This allows LEDs to be controlled by IDE disk activity.
+	  If unsure, say Y.
+
 endmenu
 
drivers/leds/Makefile +1 -0
Index: linux-2.6.16/drivers/leds/Makefile
===================================================================
@@ -13,3 +13,4 @@
 
 # LED Triggers
 obj-$(CONFIG_LEDS_TRIGGER_TIMER)	+= ledtrig-timer.o
+obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK)	+= ledtrig-ide-disk.o
#1 lore raw
Quoted 17 lines · Richard Purdie

Add an LED trigger for IDE disk activity to the ide-disk driver.

Index: linux-2.6.16/drivers/ide/ide-disk.c
===================================================================

drivers/ide/ide-disk.c 2006-03-28 17:25:12.000000000 +0100 renamed from drivers/ide/ide-disk.c 2006-03-28 17:22:51.000000000 +0100 +1 -0
@@ -60,6 +60,7 @@
 #include <linux/genhd.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
+#include <linux/leds.h>
 
 #define _IDE_DISK
 

drivers/ide/ide-disk.c 2006-03-28 17:25:12.000000000 +0100 line 321

Quoted 5 lines
drivers/ide/ide-disk.c 2006-03-28 17:25:12.000000000 +0100 renamed from drivers/ide/ide-disk.c 2006-03-28 17:22:51.000000000 +0100 +2 -0
@@ -316,6 +317,8 @@
                return ide_stopped;
        }
 
+       ledtrig_ide_activity();
+

Now this is really non-intrusive. :)
Thank you for reworking the patch.

The rest of changes also look fine for me, ACK.

Bartlomiej