[parisc-linux-cvs] linux tsbogend

Matthew Wilcox willy@debian.org
Fri, 4 Jan 2002 23:03:05 +0000


On Thu, Dec 27, 2001 at 10:02:50AM -0700, Grant Grundler wrote:
> Can you post the diff for just that chunk of code?

I can't, but I've done a new one.

> Can you be specific about what annoys you with passing the irq_region?

It's additional complexity when we can do better by reducing complexity.

> I know you've worked very hard on MMIO for card-mode dino and "bus devices"
> in general. But I (and others, like thomas) don't know where you want
> to go with this besides getting all platforms supported. To me, it looked
> like thomas' solution was a step in that direction.

actually, my primary concern is rearchitecting this code.  most of it was
written without a strategy in mind.  this change represents a step in the
wrong direction, IMO.

here's a diff which is actually a slight improvement on what i'd done
before.  i'm not in a position to test this right now, but i hope it's
obvious what i'm doing.


 * Stop calling register_busdevice in dino.c.  Remove all references to
   busdevice from dino, since we really don't need it any more.
 * Remove additional argument for register_busdevice that was added for
   dino's benefit.

Index: drivers/gsc/asp.c
===================================================================
RCS file: /var/cvs/linux/drivers/gsc/asp.c,v
retrieving revision 1.15
diff -u -p -r1.15 asp.c
--- drivers/gsc/asp.c	2001/12/26 21:57:42	1.15
+++ drivers/gsc/asp.c	2002/01/04 22:30:43
@@ -97,7 +97,7 @@ asp_init_chip(struct parisc_device *dev)
 	gsc_writel((1 << (31 - ASP_GSC_IRQ)),VIPER_INT_WORD);
 
 	/* Done init'ing, register this driver */
-	ret = register_busdevice(dev, asp, NULL);
+	ret = register_busdevice(dev, asp);
 	if (ret)
 		goto out;
 
Index: drivers/gsc/busdevice.h
===================================================================
RCS file: /var/cvs/linux/drivers/gsc/busdevice.h,v
retrieving revision 1.8
diff -u -p -r1.8 busdevice.h
--- drivers/gsc/busdevice.h	2001/12/26 21:57:42	1.8
+++ drivers/gsc/busdevice.h	2002/01/04 22:30:43
@@ -27,7 +27,7 @@ struct busdevice {
 /* short cut to keep the compiler happy */
 #define BUSDEV_DEV(x)	((struct busdevice *) (x))
 
-int register_busdevice(struct parisc_device *gsc_parent, struct busdevice *busdev_new, struct irq_region *);
+int register_busdevice(struct parisc_device *parent, struct busdevice *busdev_new);
 
 void busdev_barked(int busdev_irq, void *dev, struct pt_regs *regs);
 
Index: drivers/gsc/dino.c
===================================================================
RCS file: /var/cvs/linux/drivers/gsc/dino.c,v
retrieving revision 1.49
diff -u -p -r1.49 dino.c
--- drivers/gsc/dino.c	2001/12/26 22:00:32	1.49
+++ drivers/gsc/dino.c	2002/01/04 22:30:44
@@ -62,8 +62,6 @@
 #include <asm/irq.h>		/* for "gsc" irq functions */
 #include <asm/gsc.h>
 
-#include "busdevice.h"
-
 #undef DINO_DEBUG
 
 #ifdef DINO_DEBUG
@@ -708,21 +706,9 @@ dino_common_init(struct parisc_device *d
 	u32 eim;
 	struct gsc_irq gsc_irq;
 	struct resource *res;
-	struct busdevice *dino_busdevice;
 
 	int ret;
 
-	/* Support the serial port which is sometimes attached on built-in
-	 * Dino / Cujo chips.
-	 */
-
-	dino_busdevice = kmalloc(sizeof(struct busdevice), GFP_KERNEL);
-	if (!dino_busdevice)
-		return -ENOMEM;
-
-	dino_busdevice->name = "Dino";
-	dino_busdevice->hpa = dev->hpa;
-	
 	pcibios_register_hba(&dino_dev->hba);
 
 	pci_bios = &dino_bios_ops;   /* used by pci_scan_bus() */
@@ -761,7 +747,7 @@ dino_common_init(struct parisc_device *d
 	** Tell generic interrupt support we have 11 bits which need
 	** be checked in the interrupt handler.
 	*/
-	dino_dev->dino_region = alloc_irq_region( DINO_IRQS, &dino_irq_ops,
+	dino_dev->dino_region = alloc_irq_region(DINO_IRQS, &dino_irq_ops,
 						"dino", dino_dev);
 
 	if (NULL == dino_dev->dino_region) {
@@ -769,19 +755,12 @@ dino_common_init(struct parisc_device *d
 			dino_dev->hba.base_addr);
 		return 1;
 	}
-
-	/* Register busdevice for the serial port */
 
-	dino_busdevice->parent_irq = gsc_irq.irq;
-	dino_busdevice->eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
-
-	ret = register_busdevice(dev, dino_busdevice, dino_dev->dino_region);
-	if (ret) {
-		kfree(dino_busdevice);
-		return ret;
-	}
+	/* Support the serial port which is sometimes attached on built-in
+	 * Dino / Cujo chips.
+	 */
 
-	fixup_child_irqs(dev, dino_busdevice->busdev_region->data.irqbase,
+	fixup_child_irqs(dev, dino_dev->dino_region->data.irqbase,
 			dino_choose_irq);
 
 	/*
Index: drivers/gsc/gsc.c
===================================================================
RCS file: /var/cvs/linux/drivers/gsc/gsc.c,v
retrieving revision 1.29
diff -u -p -r1.29 gsc.c
--- drivers/gsc/gsc.c	2001/12/26 21:57:42	1.29
+++ drivers/gsc/gsc.c	2002/01/04 22:30:44
@@ -158,21 +158,17 @@ struct irq_region_ops busdev_irq_ops = {
 };
 
 
-int register_busdevice(struct parisc_device *gsc_parent, 
-			struct busdevice *busdev, struct irq_region *irqregion)
+int register_busdevice(struct parisc_device *parent, struct busdevice *busdev)
 {
 	struct resource *res;
 
-	busdev->gsc = gsc_parent;
+	busdev->gsc = parent;
 
-	if (irqregion == NULL) {
-		/* the IRQs we simulate */
-		busdev->busdev_region = alloc_irq_region(32, &busdev_irq_ops,
-							 busdev->name, busdev);
-		if (!busdev->busdev_region)
-			return -ENOMEM;
-	} else
-		busdev->busdev_region = irqregion;
+	/* the IRQs we simulate */
+	busdev->busdev_region = alloc_irq_region(32, &busdev_irq_ops,
+						 busdev->name, busdev);
+	if (!busdev->busdev_region)
+		return -ENOMEM;
 
 	/* allocate resource region */
 	res = kmalloc(sizeof(struct resource), GFP_KERNEL);
Index: drivers/gsc/lasi.c
===================================================================
RCS file: /var/cvs/linux/drivers/gsc/lasi.c,v
retrieving revision 1.34
diff -u -p -r1.34 lasi.c
--- drivers/gsc/lasi.c	2001/12/26 21:57:42	1.34
+++ drivers/gsc/lasi.c	2002/01/04 22:30:44
@@ -212,7 +212,7 @@ lasi_init_chip(struct parisc_device *dev
 	gsc_writel(lasi->eim, lasi->hpa + OFFSET_IAR);
 
 	/* Done init'ing, register this driver */
-	ret = register_busdevice(dev, lasi, NULL);
+	ret = register_busdevice(dev, lasi);
 	if (ret) {
 		kfree(lasi);
 		return ret;
Index: drivers/gsc/wax.c
===================================================================
RCS file: /var/cvs/linux/drivers/gsc/wax.c,v
retrieving revision 1.17
diff -u -p -r1.17 wax.c
--- drivers/gsc/wax.c	2001/12/26 21:57:42	1.17
+++ drivers/gsc/wax.c	2002/01/04 22:30:45
@@ -119,7 +119,7 @@ wax_init_chip(struct parisc_device *dev)
 //	gsc_writel(wax->eim, wax->hpa + OFFSET_IAR);
 
 	/* Done init'ing, register this driver */
-	ret = register_busdevice(dev, wax, NULL);
+	ret = register_busdevice(dev, wax);
 	if (ret) {
 		kfree(wax);
 		return ret;

-- 
Revolutions do not require corporate support.