From: mikem@beardog.cca.cpqcorp.net

This patch fixes a bug when sharing IRQs with another controller that
receives a lot of interrupts.  Without this check we will panic the system
when unloading and reloading the driver.  This is in 2.4.



---

 drivers/block/cciss.c |    2 +-
 drivers/block/cciss.h |    6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff -puN drivers/block/cciss.c~cciss-04-irq-sharing-fix drivers/block/cciss.c
--- 25/drivers/block/cciss.c~cciss-04-irq-sharing-fix	2004-02-04 20:21:42.000000000 -0800
+++ 25-akpm/drivers/block/cciss.c	2004-02-04 20:21:42.000000000 -0800
@@ -1983,7 +1983,7 @@ static irqreturn_t do_cciss_intr(int irq
 
 
 	/* Is this interrupt for us? */
-	if ( h->access.intr_pending(h) == 0)
+	if (( h->access.intr_pending(h) == 0) || (h->interrupts_enabled == 0))
 		return IRQ_NONE;
 
 	/*
diff -puN drivers/block/cciss.h~cciss-04-irq-sharing-fix drivers/block/cciss.h
--- 25/drivers/block/cciss.h~cciss-04-irq-sharing-fix	2004-02-04 20:21:42.000000000 -0800
+++ 25-akpm/drivers/block/cciss.h	2004-02-04 20:21:42.000000000 -0800
@@ -48,7 +48,7 @@ struct ctlr_info 
 	unsigned long io_mem_length;
 	CfgTable_struct *cfgtable;
 	int	intr;
-
+	int	interrupts_enabled;
 	int 	max_commands;
 	int	commands_outstanding;
 	int 	max_outstanding; /* Debug */ 
@@ -134,9 +134,11 @@ static void SA5_intr_mask(ctlr_info_t *h
 {
 	if (val) 
 	{ /* Turn interrupts on */
+		h->interrupts_enabled = 1;
 		writel(0, h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
 	} else /* Turn them off */
 	{
+		h->interrupts_enabled = 0;
         	writel( SA5_INTR_OFF, 
 			h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
 	}
@@ -150,9 +152,11 @@ static void SA5B_intr_mask(ctlr_info_t *
 {
         if (val)
         { /* Turn interrupts on */
+		h->interrupts_enabled = 1;
                 writel(0, h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
         } else /* Turn them off */
         {
+		h->interrupts_enabled = 0;
                 writel( SA5B_INTR_OFF,
                         h->vaddr + SA5_REPLY_INTR_MASK_OFFSET);
         }

_