From 56d40f649bd538b7089971a5a30aa302af9ea7d3 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sat, 7 Feb 2004 17:43:02 -0800 Subject: [PATCH] [PATCH] cciss: IRQ sharing fix 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 --git a/drivers/block/cciss.c b/drivers/block/cciss.c index e26566a53bb0d..2b4f6ba3a6bb3 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -1983,7 +1983,7 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id, struct pt_regs *regs) /* 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 --git a/drivers/block/cciss.h b/drivers/block/cciss.h index 16bf4638ade84..f37ad3dfa1daa 100644 --- a/drivers/block/cciss.h +++ b/drivers/block/cciss.h @@ -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, unsigned long val) { 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 *h, unsigned long val) { 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); } -- 2.53.0