Thread (6 messages) 6 messages, 3 authors, 2016-02-05

Re: [PATCH v3 1/3] libahci: Implement the capability to override the generic ahci interrupt handler.

From: Sergei Shtylyov <hidden>
Date: 2016-02-05 14:12:40
Also in: linux-arm-kernel, linux-ide

Hello.

On 02/05/2016 12:20 AM, suman Tripathi wrote:
From: Suman Tripathi <redacted>

This patch implements the capability to override the generic
ahci interrupt handler so that the LDD drivers can implement
    AHCI.
there own custom interrupt handler routines.
    s/there/their/.
quoted hunk ↗ jump to hunk
Signed-off-by: Suman Tripathi <redacted>
---
  drivers/ata/ahci.h    |    2 ++
  drivers/ata/libahci.c |   32 +++++++++++++++++++++++---------
  2 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index a4faa43..3d883ee 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -360,6 +360,7 @@ struct ahci_host_priv {
  	 * be overridden anytime before the host is activated.
  	 */
  	void			(*start_engine)(struct ata_port *ap);
+	irqreturn_t 		(*ahci_irq_intr)(int irq, void *dev_instance);
    The 'ahci_irq_intr' name is somewhat tautological.


[...]
quoted hunk ↗ jump to hunk
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index eda3cf2..5d3035a 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
[...]
quoted hunk ↗ jump to hunk
@@ -2504,15 +2505,28 @@ int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht)
  	struct ahci_host_priv *hpriv = host->private_data;
  	int irq = hpriv->irq;
  	int rc;
+	irqreturn_t (*ahci_irq_handler)(int irq, void *dev_instance);

-	if (hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX))
-		rc = ahci_host_activate_multi_irqs(host, sht);
-	else if (hpriv->flags & AHCI_HFLAG_EDGE_IRQ)
-		rc = ata_host_activate(host, irq, ahci_single_edge_irq_intr,
-				       IRQF_SHARED, sht);
-	else
-		rc = ata_host_activate(host, irq, ahci_single_level_irq_intr,
-				       IRQF_SHARED, sht);
+	ahci_irq_handler = hpriv->ahci_irq_intr;
+
+	if (hpriv->flags & (AHCI_HFLAG_MULTI_MSI | AHCI_HFLAG_MULTI_MSIX)) {
+		if (!ahci_irq_handler)
+			rc = ahci_host_activate_multi_irqs(host, sht);
+		else
+			dev_warn(host->dev, "both AHCI_HFLAG_MULTI_MSI flag set \
+				 and custom irq handler implemented\n");
+
+	} else {
+		if (!ahci_irq_handler) {
    Why not *else* *if* on a single line?

[...]

MBR, Sergei
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help