public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][RFC] Remove uneeded resource structures from pci_dev
@ 2004-01-30  0:48 Adam Belay
  2004-01-30  8:45 ` Russell King
  2004-01-31  0:34 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Adam Belay @ 2004-01-30  0:48 UTC (permalink / raw)
  To: greg, Russell King; +Cc: linux-kernel

Hi,

The following patch remove irq_resource and dma_resource from pci_dev.  It
appears that the serial pci driver depends on irq_resource, however, it may be
broken portions of an old quirk.  I attempted to maintain the existing behavior
while removing irq_resource.  I changed FL_IRQRESOURCE to FL_NOIRQ.  Russell,
could you provide any comments?  irq_resource and dma_resource are most likely
remnants from when pci_dev was shared with pnp.

Thanks,
Adam

This patch has only been tested for compilation.

--- a/drivers/serial/8250_pci.c	2004-01-09 06:59:55.000000000 +0000
+++ b/drivers/serial/8250_pci.c	2004-01-30 00:41:49.000000000 +0000
@@ -43,20 +43,12 @@
 #define FL_BASE4		0x0004
 #define FL_GET_BASE(x)		(x & FL_BASE_MASK)
 
-#define FL_IRQ_MASK		(0x0007 << 4)
-#define FL_IRQBASE0		(0x0000 << 4)
-#define FL_IRQBASE1		(0x0001 << 4)
-#define FL_IRQBASE2		(0x0002 << 4)
-#define FL_IRQBASE3		(0x0003 << 4)
-#define FL_IRQBASE4		(0x0004 << 4)
-#define FL_GET_IRQBASE(x)	((x & FL_IRQ_MASK) >> 4)
-
 /* Use successive BARs (PCI base address registers),
    else use offset into some specified BAR */
 #define FL_BASE_BARS		0x0008
 
-/* Use the irq resource table instead of dev->irq */
-#define FL_IRQRESOURCE		0x0080
+/* do not assign an irq */
+#define FL_NOIRQ		0x0080
 
 /* Use the Base address register size to cap number of ports */
 #define FL_REGION_SZ_CAP	0x0100
@@ -850,17 +842,10 @@
 static _INLINE_ int
 get_pci_irq(struct pci_dev *dev, struct pci_board *board, int idx)
 {
-	int base_idx;
-
-	if ((board->flags & FL_IRQRESOURCE) == 0)
-		return dev->irq;
-
-	base_idx = FL_GET_IRQBASE(board->flags);
-
-	if (base_idx > DEVICE_COUNT_IRQ)
+	if (board->flags & FL_NOIRQ)
 		return 0;
-	
-	return dev->irq_resource[base_idx].start;
+	else
+		return dev->irq;
 }
 
 /*
@@ -1314,7 +1299,7 @@
 		.first_offset	= 0x10000,
 	},
 	[pbn_sgi_ioc3] = {
-		.flags		= FL_BASE0|FL_IRQRESOURCE,
+		.flags		= FL_BASE0|FL_NOIRQ,
 		.num_ports	= 1,
 		.base_baud	= 458333,
 		.uart_offset	= 8,
--- a/include/linux/pci.h	2004-01-09 06:59:33.000000000 +0000
+++ b/include/linux/pci.h	2004-01-30 00:09:47.000000000 +0000
@@ -416,8 +416,6 @@
 	 */
 	unsigned int	irq;
 	struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
-	struct resource dma_resource[DEVICE_COUNT_DMA];
-	struct resource irq_resource[DEVICE_COUNT_IRQ];
 
 	char *		slot_name;	/* pointer to dev.bus_id */
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][RFC] Remove uneeded resource structures from pci_dev
  2004-01-30  0:48 [PATCH][RFC] Remove uneeded resource structures from pci_dev Adam Belay
@ 2004-01-30  8:45 ` Russell King
  2004-01-31  0:34 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Russell King @ 2004-01-30  8:45 UTC (permalink / raw)
  To: Adam Belay, greg, linux-kernel

On Fri, Jan 30, 2004 at 12:48:41AM +0000, Adam Belay wrote:
> I changed FL_IRQRESOURCE to FL_NOIRQ.  Russell, could you provide any
> comments?  irq_resource and dma_resource are most likely
> remnants from when pci_dev was shared with pnp.

Unfortunately there isn't much I can say about this, other than it looks
like the right thing to do.

A lot of these PCI and PNP serial controllers are provided by various
people, and unfortunately no record was kept as to who has what hardware.
Of course, this makes testing these types of changes impossible.

So, the best thing I can suggest is to get the patch into Linus/akpm's
kernel and watch what happens.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][RFC] Remove uneeded resource structures from pci_dev
  2004-01-30  0:48 [PATCH][RFC] Remove uneeded resource structures from pci_dev Adam Belay
  2004-01-30  8:45 ` Russell King
@ 2004-01-31  0:34 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2004-01-31  0:34 UTC (permalink / raw)
  To: Adam Belay, Russell King, linux-kernel

On Fri, Jan 30, 2004 at 12:48:41AM +0000, Adam Belay wrote:
> Hi,
> 
> The following patch remove irq_resource and dma_resource from pci_dev.  It
> appears that the serial pci driver depends on irq_resource, however, it may be
> broken portions of an old quirk.  I attempted to maintain the existing behavior
> while removing irq_resource.  I changed FL_IRQRESOURCE to FL_NOIRQ.  Russell,
> could you provide any comments?  irq_resource and dma_resource are most likely
> remnants from when pci_dev was shared with pnp.

Ok, I've added this to my PCI bk tree, which will end up in the next -mm
release.  If that seems to work ok, I'll send it to Linus (after
whenever 2.6.2 comes out...)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-01-31  0:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-30  0:48 [PATCH][RFC] Remove uneeded resource structures from pci_dev Adam Belay
2004-01-30  8:45 ` Russell King
2004-01-31  0:34 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox