[parisc-linux-cvs] DIFF -pa78 remove IRQ_REG_DIS crap

Grant Grundler grundler@puffin.external.hp.com
Mon, 5 Nov 2001 00:43:25 -0700


I've wanted to do this for a *long* time. *grin*
Please feel free to add flags field back if it's needed.

grant


Index: Makefile
===================================================================
RCS file: /var/cvs/linux/Makefile,v
retrieving revision 1.189
diff -u -p -r1.189 Makefile
--- Makefile	2001/11/04 22:48:12	1.189
+++ Makefile	2001/11/05 07:37:08
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 9
-EXTRAVERSION = -pa77
+EXTRAVERSION = -pa78
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
Index: arch/parisc/kernel/iosapic.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/iosapic.c,v
retrieving revision 1.34
diff -u -p -r1.34 iosapic.c
--- arch/parisc/kernel/iosapic.c	2001/10/17 20:02:27	1.34
+++ arch/parisc/kernel/iosapic.c	2001/11/05 07:37:09
@@ -1037,8 +1037,8 @@ iosapic_register(unsigned long hpa)
 	}
 
 	isi->isi_region = alloc_irq_region(isi->isi_num_vectors,
-				&iosapic_irq_ops, IRQ_REG_DIS|IRQ_REG_MASK,
-				isi->isi_name, (void *) isi->isi_vector);
+				&iosapic_irq_ops, isi->isi_name,
+				(void *) isi->isi_vector);
 
 	ASSERT(NULL != isi->isi_region);
 	return ((void *) isi);
Index: arch/parisc/kernel/irq.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/irq.c,v
retrieving revision 1.48
diff -u -p -r1.48 irq.c
--- arch/parisc/kernel/irq.c	2001/11/04 22:25:30	1.48
+++ arch/parisc/kernel/irq.c	2001/11/05 07:37:09
@@ -91,8 +91,9 @@ static struct irqaction cpu_irq_actions[
 
 struct irq_region cpu_irq_region = {
 	ops:	{ disable_cpu_irq, enable_cpu_irq, unmask_cpu_irq, unmask_cpu_irq },
-	data:	{ dev: &cpu_data[0], name: "PA-CPU-00", flags: IRQ_REG_MASK|IRQ_REG_DIS,
-			irqbase: IRQ_FROM_REGION(CPU_IRQ_REGION), },
+	data:	{ dev: &cpu_data[0],
+		  name: "PA-CPU-00",
+		  irqbase: IRQ_FROM_REGION(CPU_IRQ_REGION), },
 	action:	cpu_irq_actions,
 };
 
@@ -447,9 +448,23 @@ static inline int find_free_region(void)
 	return 0;
 }
 
-struct irq_region *alloc_irq_region(
-	int count, struct irq_region_ops *ops, unsigned long flags,
-	const char *name, void *dev)
+
+/*****
+ * alloc_irq_region - allocate/init a new IRQ region
+ * @count: number of IRQs in this region.
+ * @ops: function table with request/release/mask/unmask/etc.. entries.
+ * @name: name of region owner for /proc/interrupts output.
+ * @dev: private data to associate with the new IRQ region.
+ *
+ * Every IRQ must become a MMIO write to the CPU's EIRR in
+ * order to get CPU service. The IRQ region represents the
+ * number of unique events the region handler can (or must)
+ * identify. For PARISC CPU, that's the width of the EIR Register.
+ * IRQ regions virtualize IRQs (eg EISA or PCI host bus controllers)
+ * for line based devices.
+ */
+struct irq_region *alloc_irq_region( int count, struct irq_region_ops *ops,
+					const char *name, void *dev)
 {
 	struct irq_region *region;
 	int index;
@@ -469,12 +484,14 @@ struct irq_region *alloc_irq_region(
 	    count = IRQ_PER_REGION;
 	}
 
-	if (flags & IRQ_REG_MASK)
-		if (!(ops->mask_irq && ops->unmask_irq))
+	/* if either mask *or* unmask is set, both have to be set. */
+	if((ops->mask_irq || ops->unmask_irq) &&
+		!(ops->mask_irq && ops->unmask_irq))
 			return NULL;
 
-	if (flags & IRQ_REG_DIS)
-		if (!(ops->disable_irq && ops->enable_irq))
+	/* ditto for enable/disable */
+	if( (ops->disable_irq || ops->enable_irq) &&
+		!(ops->disable_irq && ops->enable_irq) )
 			return NULL;
 
 	region = kmalloc(sizeof(*region), GFP_ATOMIC);
@@ -491,7 +508,6 @@ struct irq_region *alloc_irq_region(
 
 	region->ops = *ops;
 	region->data.irqbase = IRQ_FROM_REGION(index);
-	region->data.flags = flags;
 	region->data.name = name;
 	region->data.dev = dev;
 
@@ -610,25 +626,6 @@ void free_irq(unsigned int irq, void *de
 
 
 /*
- * This is called when we want to synchronize with
- * interrupts. We may for example tell a device to
- * stop sending interrupts: but to make sure there
- * are no interrupts that are executing on another
- * CPU we need to call this function.
- */
-#ifdef CONFIG_SMP
-/* needed in CONFIG_SMP ?? */
-void synchronize_irq()
-{
-	if (irqs_running()) {
-		/* Stupid approach */
-		cli();
-		sti();
-	}
-}
-#endif
-
-/*
  * IRQ autodetection code..
  *
  * This depends on the fact that any interrupt that
@@ -769,7 +766,6 @@ int probe_irq_off(unsigned long val)
 		irq_found = -irq_found;
 	return irq_found;
 }
-
 
 
 void __init init_IRQ(void)
Index: arch/parisc/kernel/superio.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/superio.c,v
retrieving revision 1.11
diff -u -p -r1.11 superio.c
--- arch/parisc/kernel/superio.c	2001/10/29 18:38:21	1.11
+++ arch/parisc/kernel/superio.c	2001/11/05 07:37:09
@@ -347,7 +347,6 @@ int superio_fixup_irq(struct pci_dev *pc
 		/* Allocate an irq region for SuperIO devices */
 		sio_dev.irq_region = alloc_irq_region(SUPERIO_NIRQS,
 						&superio_irq_ops,
-						IRQ_REG_DIS|IRQ_REG_MASK,
 						"SuperIO", (void *) &sio_dev);
 		if (!sio_dev.irq_region) {
 			printk(KERN_WARNING "SuperIO: alloc_irq_region failed\n");
Index: drivers/gsc/dino.c
===================================================================
RCS file: /var/cvs/linux/drivers/gsc/dino.c,v
retrieving revision 1.45
diff -u -p -r1.45 dino.c
--- drivers/gsc/dino.c	2001/10/23 21:02:54	1.45
+++ drivers/gsc/dino.c	2001/11/05 07:37:09
@@ -791,7 +791,7 @@ dino_common_init(struct parisc_device *d
 	** be checked in the interrupt handler.
 	*/
 	dino_dev->dino_region = alloc_irq_region( DINO_IRQS, &dino_irq_ops,
-						IRQ_REG_MASK|IRQ_REG_DIS, "dino", dino_dev);
+						"dino", dino_dev);
 
 	if(NULL == dino_dev->dino_region) {
 		printk(KERN_WARNING "Dino %lx: alloc_irq_region() failed\n", 
Index: drivers/gsc/gsc.c
===================================================================
RCS file: /var/cvs/linux/drivers/gsc/gsc.c,v
retrieving revision 1.27
diff -u -p -r1.27 gsc.c
--- drivers/gsc/gsc.c	2001/11/03 23:05:59	1.27
+++ drivers/gsc/gsc.c	2001/11/05 07:37:09
@@ -167,7 +167,7 @@ int register_busdevice(struct parisc_dev
 
 	/* the IRQs we simulate */
 	busdev->busdev_region = alloc_irq_region(32, &busdev_irq_ops,
-			    IRQ_REG_MASK|IRQ_REG_DIS, busdev->name, busdev);
+			    busdev->name, busdev);
 	if (!busdev->busdev_region)
 		return -ENOMEM;
 
Index: drivers/gsc/eisa.c
===================================================================
RCS file: /var/cvs/linux/drivers/gsc/eisa.c,v
retrieving revision 1.9
diff -u -p -r1.9 eisa.c
--- drivers/gsc/eisa.c	2001/11/03 23:05:59	1.9
+++ drivers/gsc/eisa.c	2001/11/05 07:37:09
@@ -114,7 +114,7 @@ struct irqaction action[IRQ_PER_REGION];
 
 static struct irq_region eisa_irq_region = {
 	{ eisa_disable_irq, eisa_enable_irq, eisa_mask_irq, eisa_unmask_irq },
-	{ NULL, "EISA", IRQ_REG_MASK|IRQ_REG_DIS, EISA_IRQ_REGION },
+	{ NULL, "EISA", EISA_IRQ_REGION },
 	action,
 };
 
Index: include/asm-parisc/irq.h
===================================================================
RCS file: /var/cvs/linux/include/asm-parisc/irq.h,v
retrieving revision 1.17
diff -u -p -r1.17 irq.h
--- include/asm-parisc/irq.h	2001/11/04 22:21:06	1.17
+++ include/asm-parisc/irq.h	2001/11/05 07:37:09
@@ -39,9 +39,6 @@
 #define IRQ_OFFSET(irq)		((irq) & ((1<<IRQ_REGION_SHIFT)-1))
 #define	IRQ_FROM_REGION(reg)	((reg) << IRQ_REGION_SHIFT)
 
-#define IRQ_REG_DIS		1 /* support disable_irq()/enable_irq() */
-#define IRQ_REG_MASK		2 /* require IRQs to be masked */
-
 #define EISA_IRQ_REGION		0 /* region 0 needs to be reserved for EISA */
 #define EISA_MAX_IRQS		16 /* max. (E)ISA irq line */
 
@@ -55,7 +52,6 @@ struct irq_region_ops {
 struct irq_region_data {
 	void *dev;
 	const char *name;
-	unsigned flags;
 	int irqbase;
 	unsigned int status[IRQ_PER_REGION]; /* IRQ status */
 };
@@ -86,7 +82,7 @@ extern void do_irq_mask(unsigned long ma
 	struct pt_regs *regs);
 
 extern struct irq_region *alloc_irq_region(int count, struct irq_region_ops *ops,
-	unsigned long flags, const char *name, void *dev);
+	const char *name, void *dev);
 
 extern int txn_alloc_irq(void);
 extern int txn_claim_irq(int);