[RFC PATCH 7/8] LED: Add IDE disk activity LED trigger

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

 



Add an LED trigger for IDE disk activity to the IDE subsystem.

Signed-off-by: Richard Purdie <[email protected]>
Acked-by: Pavel Machek <[email protected]>

Index: linux-2.6.15-rc2/drivers/ide/ide-disk.c
===================================================================
--- linux-2.6.15-rc2.orig/drivers/ide/ide-disk.c	2005-11-28 12:31:02.000000000 +0000
+++ linux-2.6.15-rc2/drivers/ide/ide-disk.c	2005-11-28 15:55:36.000000000 +0000
@@ -60,6 +60,7 @@
 #include <linux/genhd.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
+#include <linux/leds.h>
 
 #define _IDE_DISK
 
@@ -78,6 +79,8 @@
 	struct kref	kref;
 };
 
+INIT_LED_TRIGGER_GLOBAL(ide_led_trigger);
+
 static DECLARE_MUTEX(idedisk_ref_sem);
 
 #define to_ide_disk(obj) container_of(obj, struct ide_disk_obj, kref)
@@ -315,6 +318,8 @@
 		return ide_stopped;
 	}
 
+	led_trigger_event(ide_led_trigger, 100);
+
 	pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n",
 		 drive->name, rq_data_dir(rq) == READ ? "read" : "writ",
 		 block, rq->nr_sectors, (unsigned long)rq->buffer);
@@ -1259,11 +1264,13 @@
 
 static void __exit idedisk_exit (void)
 {
+	led_trigger_unregister_simple(ide_led_trigger);
 	driver_unregister(&idedisk_driver.gen_driver);
 }
 
 static int __init idedisk_init(void)
 {
+	led_trigger_register_simple("ide-disk", &ide_led_trigger);
 	return driver_register(&idedisk_driver.gen_driver);
 }
 
Index: linux-2.6.15-rc2/drivers/ide/ide-io.c
===================================================================
--- linux-2.6.15-rc2.orig/drivers/ide/ide-io.c	2005-11-20 03:25:03.000000000 +0000
+++ linux-2.6.15-rc2/drivers/ide/ide-io.c	2005-11-28 12:31:04.000000000 +0000
@@ -48,6 +48,7 @@
 #include <linux/device.h>
 #include <linux/kmod.h>
 #include <linux/scatterlist.h>
+#include <linux/leds.h>
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
@@ -107,6 +108,8 @@
  *	it was tagged may be out of order.
  */
 
+extern struct led_trigger *ide_led_trigger;
+
 int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors)
 {
 	struct request *rq;
@@ -125,6 +128,9 @@
 		ret = __ide_end_request(drive, rq, uptodate, nr_sectors);
 
 	spin_unlock_irqrestore(&ide_lock, flags);
+
+	led_trigger_event(ide_led_trigger, 0);
+
 	return ret;
 }
 EXPORT_SYMBOL(ide_end_request);


-
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