This adds an optional wrapper around ata_ac_issue_prot that triggers the LED 
layer.
Powermac G5 machines with an Apple K2 controller will now blink the PMU LED to 
harddisk activity if CONFIG_ADB_PMU_LED_IDE is defined (like on a 
PowerBook/iBook).
This avoids any pollution of the hot path on non-PowerMacs and makes the 
functionality 
fully optional.

Jeff, hopefully this version addresses your earlier concerns voiced on May 25 
this year.

Signed-off-by: Tony Vroon <[EMAIL PROTECTED]>

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 60e78be..9c687db 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -49,6 +49,7 @@
 #include <linux/workqueue.h>
 #include <linux/jiffies.h>
 #include <linux/scatterlist.h>
+#include <linux/leds.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_host.h>
@@ -5569,6 +5570,25 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc)
 }
 
 /**
+ *     ata_qc_issue_prot_ledtrigger - trigger LED core
+ *     @qc: command to issue to device
+ *
+ *     This triggers the LED core and then calls the
+ *     regular ata_qc_issue_prot function.
+ *
+ *     LOCKING:
+ *     spin_lock_irqsave(host lock)
+ *
+ *     RETURNS:
+ *     Zero on success, AC_ERR_* mask on failure
+ */
+unsigned int ata_qc_issue_prot_ledtrigger(struct ata_queued_cmd *qc)
+{
+       ledtrig_ide_activity(); 
+       return ata_qc_issue_prot(qc);
+}
+
+/**
  *     ata_host_intr - Handle host interrupt for given (port, task)
  *     @ap: Port on which interrupt arrived (possibly...)
  *     @qc: Taskfile currently active in engine
@@ -6873,6 +6893,7 @@ EXPORT_SYMBOL_GPL(ata_hsm_move);
 EXPORT_SYMBOL_GPL(ata_qc_complete);
 EXPORT_SYMBOL_GPL(ata_qc_complete_multiple);
 EXPORT_SYMBOL_GPL(ata_qc_issue_prot);
+EXPORT_SYMBOL_GPL(ata_qc_issue_prot_ledtrigger);
 EXPORT_SYMBOL_GPL(ata_tf_load);
 EXPORT_SYMBOL_GPL(ata_tf_read);
 EXPORT_SYMBOL_GPL(ata_noop_dev_select);
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index 92e8770..af3e57b 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -341,7 +341,11 @@ static const struct ata_port_operations k2_sata_ops = {
        .bmdma_stop             = ata_bmdma_stop,
        .bmdma_status           = ata_bmdma_status,
        .qc_prep                = ata_qc_prep,
+#ifdef CONFIG_ADB_PMU_LED_IDE
+       .qc_issue               = ata_qc_issue_prot_ledtrigger,
+#else
        .qc_issue               = ata_qc_issue_prot,
+#endif
        .data_xfer              = ata_data_xfer,
        .freeze                 = ata_bmdma_freeze,
        .thaw                   = ata_bmdma_thaw,
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 41978a5..ebda8ee 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -790,6 +790,7 @@ extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc);
 extern void ata_qc_prep(struct ata_queued_cmd *qc);
 extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
 extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
+extern unsigned int ata_qc_issue_prot_ledtrigger(struct ata_queued_cmd *qc);
 extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
                unsigned int buflen);
 extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
-
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/

Reply via email to