mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Purdie <rpurdie@rpsys.net>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH 10/11] LED: Add IDE disk activity LED trigger
Date: Tue, 31 Jan 2006 13:41:58 +0000	[thread overview]
Message-ID: <1138714918.6869.139.camel@localhost.localdomain> (raw)

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

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>

Index: linux-2.6.15/drivers/ide/ide-disk.c
===================================================================
--- linux-2.6.15.orig/drivers/ide/ide-disk.c	2006-01-29 14:43:00.000000000 +0000
+++ linux-2.6.15/drivers/ide/ide-disk.c	2006-01-29 15:22:48.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
 
@@ -297,6 +298,8 @@
 	}
 }
 
+extern struct led_trigger *ide_led_trigger;
+
 /*
  * 268435455  == 137439 MB or 28bit limit
  * 320173056  == 163929 MB or 48bit addressing
@@ -315,6 +318,8 @@
 		return ide_stopped;
 	}
 
+	led_trigger_event(ide_led_trigger, LED_FULL);
+
 	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);
Index: linux-2.6.15/drivers/ide/ide-io.c
===================================================================
--- linux-2.6.15.orig/drivers/ide/ide-io.c	2006-01-29 14:37:20.000000000 +0000
+++ linux-2.6.15/drivers/ide/ide-io.c	2006-01-29 15:28:00.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>
@@ -93,6 +94,8 @@
 }
 EXPORT_SYMBOL(__ide_end_request);
 
+extern struct led_trigger *ide_led_trigger;
+
 /**
  *	ide_end_request		-	complete an IDE I/O
  *	@drive: IDE device for the I/O
@@ -123,6 +126,9 @@
 	ret = __ide_end_request(drive, rq, uptodate, nr_sectors);
 
 	spin_unlock_irqrestore(&ide_lock, flags);
+
+	led_trigger_event(ide_led_trigger, LED_OFF);
+
 	return ret;
 }
 EXPORT_SYMBOL(ide_end_request);
Index: linux-2.6.15/drivers/ide/ide.c
===================================================================
--- linux-2.6.15.orig/drivers/ide/ide.c	2006-01-29 14:43:00.000000000 +0000
+++ linux-2.6.15/drivers/ide/ide.c	2006-01-29 15:23:59.000000000 +0000
@@ -154,6 +154,7 @@
 #include <linux/seq_file.h>
 #include <linux/device.h>
 #include <linux/bitops.h>
+#include <linux/leds.h>
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
@@ -1990,6 +1991,8 @@
 
 EXPORT_SYMBOL_GPL(ide_bus_type);
 
+INIT_LED_TRIGGER_GLOBAL(ide_led_trigger);
+
 /*
  * This is gets invoked once during initialization, to set *everything* up
  */
@@ -2036,6 +2039,8 @@
 #ifdef CONFIG_PROC_FS
 	proc_ide_create();
 #endif
+	led_trigger_register_simple("ide-disk", &ide_led_trigger);
+
 	return 0;
 }
 
@@ -2068,6 +2073,8 @@
 {
 	int index;
 
+	led_trigger_unregister_simple(ide_led_trigger);
+
 	for (index = 0; index < MAX_HWIFS; ++index)
 		ide_unregister(index);
 



             reply	other threads:[~2006-01-31 13:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-31 13:41 Richard Purdie [this message]
2006-01-31 14:46 ` Bartlomiej Zolnierkiewicz
2006-01-31 16:21   ` Richard Purdie
2006-01-31 17:44     ` Bartlomiej Zolnierkiewicz
2006-01-31 20:29       ` Jens Axboe
2006-01-31 22:08       ` Benjamin Herrenschmidt
2006-01-31 23:39         ` Richard Purdie
2006-02-04 15:29       ` Richard Purdie
2006-01-31 20:35     ` Jens Axboe
2006-01-31 21:22       ` Jordan Crouse
2006-02-01  0:12         ` Matt Reimer
2006-02-02  1:32         ` Adrian Bunk
2006-01-31 22:03       ` [PATCH 10/11] " Richard Purdie
2006-02-02 11:07       ` Pavel Machek
2006-02-01 16:09 ` Jan Engelhardt
2006-02-04  9:54   ` Jan-Benedict Glaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1138714918.6869.139.camel@localhost.localdomain \
    --to=rpurdie@rpsys.net \
    --cc=bzolnier@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome