public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [BK PATCH] PCI update for 2.6.3-rc1
@ 2004-02-09 23:13 Greg KH
  2004-02-09 23:22 ` [PATCH] PCI Update " Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:13 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel

Hi,

Here are some PCI and PCI hotplug patches for 2.6.3-rc1.
The majority of this is the dmapool code that has been moved from the
pci core to the driver core to enable platforms that do not have pci
support to still use dma pools.  There are a number of other minor PCI
hotplug fixups, and I cleaned up the PCI MSI code a bit.

All of these changes have been in the last few -mm trees with no
problems (not including the UML build, which the UML people need to fix
in their own...)

Please pull from:
	bk://kernel.bkbits.net/gregkh/linux/pci-2.6

thanks,

greg k-h

p.s. I'll send these as patches in response to this email to lkml for
those who want to see them.


 drivers/pci/pool.c                 |  404 -------------------------------
 include/linux/pci_msi.h            |  170 -------------
 Documentation/DMA-API.txt          |   87 ++++++
 arch/i386/pci/irq.c                |   44 +++
 drivers/base/Makefile              |    4 
 drivers/base/core.c                |    1 
 drivers/base/dmapool.c             |  480 ++++++++++++++++++++++++++++++++++---
 drivers/pci/Makefile               |    2 
 drivers/pci/hotplug.c              |    6 
 drivers/pci/hotplug/acpiphp_core.c |    6 
 drivers/pci/hotplug/acpiphp_glue.c |   56 ++--
 drivers/pci/hotplug/cpqphp_ctrl.c  |    4 
 drivers/pci/hotplug/cpqphp_pci.c   |   28 +-
 drivers/pci/hotplug/ibmphp_core.c  |  195 +++++----------
 drivers/pci/hotplug/ibmphp_ebda.c  |  118 ++++-----
 drivers/pci/hotplug/ibmphp_pci.c   |   78 +++---
 drivers/pci/hotplug/ibmphp_res.c   |   56 ++--
 drivers/pci/msi.c                  |    3 
 drivers/pci/msi.h                  |  168 ++++++++++++
 drivers/pci/pci-driver.c           |    2 
 drivers/pci/pci.ids                |    8 
 drivers/pci/probe.c                |    4 
 drivers/pci/remove.c               |    2 
 drivers/serial/8250_pci.c          |   27 --
 include/linux/device.h             |    1 
 include/linux/dmapool.h            |   27 ++
 include/linux/pci.h                |   16 -
 include/linux/pci_msi.h            |   29 --
 28 files changed, 1044 insertions(+), 982 deletions(-)
-----


<dlsy:snoqualmie.dp.intel.com>:
  o PCI: Patch to get cpqphp working with IOAPIC

<dsaxena:plexity.net>:
  o PCI: Replace pci_pool with generic dma_pool, part 2
  o PCI: Replace pci_pool with generic dma_pool

<eike-hotplug:sf-tec.de>:
  o PCI Hotplug: Convert error paths in ibmphp to use goto
  o PCI Hotplug: mark functions __init/__exit in acpiphp
  o PCI Hotplug: make ibm_unconfigure_device void
  o PCI Hotplug: kill hpcrc from several functions in ibmphp_core.c
  o PCI Hotplug: very small optimisations for ibmphp_pci.c
  o PCI Hotplug: Coding style fixes for drivers/pci/hotplug.c
  o PCI: avoid two returns directly after each other in pcidriver.c
  o PCI Hotplug: Kill useless instructions from ibmphp_core.c
  o PCI Hotplug: Kill spaces before \n in ibmphp*
  o PCI Hotplug: Whitespace fixes for acpiphp
  o PCI Hotplug: coding style for cpqphp_pci.c

Adam Belay:
  o PCI: Remove uneeded resource structures from pci_dev

David Brownell:
  o PCI: dma_pool fixups

Greg Kroah-Hartman:
  o dmapool: fix up list_for_each() calls to list_for_each_entry()
  o PCI: move pci_msi.h out of include/linux to drivers/pci where it belongs
  o PCI: remove stupid MSI debugging code that was never used
  o dmapool: Remove sentance in documentation that is now false on 2.6
  o dmapool: use dev_err() whenever we can to get the better information in it
  o PCI: add back some pci.ids entries that got deleted in the last big update

Matthew Dobson:
  o PCI: fix "pcibus_class" Device Class, release function


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

* [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:13 [BK PATCH] PCI update for 2.6.3-rc1 Greg KH
@ 2004-02-09 23:22 ` Greg KH
  2004-02-09 23:22   ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.1, 2004/01/30 16:31:28-08:00, greg@kroah.com

[PATCH] PCI: add back some pci.ids entries that got deleted in the last big update.


 drivers/pci/pci.ids |    8 ++++++++
 1 files changed, 8 insertions(+)


diff -Nru a/drivers/pci/pci.ids b/drivers/pci/pci.ids
--- a/drivers/pci/pci.ids	Mon Feb  9 14:59:48 2004
+++ b/drivers/pci/pci.ids	Mon Feb  9 14:59:48 2004
@@ -5871,6 +5871,11 @@
 		14f1 2004  Dynalink 56PMi
 	8234  RS8234 ATM SAR Controller [ServiceSAR Plus]
 14f2  MOBILITY Electronics
+	0120  EV1000 bridge
+	0121  EV1000 Parallel port
+	0122  EV1000 Serial port
+	0123  EV1000 Keyboard controller
+	0124  EV1000 Mouse controller
 14f3  BROADLOGIC
 14f4  TOKYO Electronic Industry CO Ltd
 14f5  SOPAC Ltd
@@ -6667,6 +6672,9 @@
 	1040  536EP Data Fax Modem
 		16be 1040  V.9X DSP Data Fax Modem
 	1043  PRO/Wireless LAN 2100 3B Mini PCI Adapter
+	1048  82597EX 10GbE Ethernet Controller
+		8086 a01f  PRO/10GbE LR Server Adapter
+		8086 a11f  PRO/10GbE LR Server Adapter
 	1059  82551QM Ethernet Controller
 	1130  82815 815 Chipset Host Bridge and Memory Controller Hub
 		1025 1016  Travelmate 612 TX


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22   ` Greg KH
@ 2004-02-09 23:22     ` Greg KH
  2004-02-09 23:22       ` Greg KH
  2004-02-10 16:03     ` Geert Uytterhoeven
  1 sibling, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.3, 2004/01/30 16:35:12-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI Hotplug: coding style for cpqphp_pci.c

here are some coding style fixes.


 drivers/pci/hotplug/cpqphp_pci.c |   26 +++++++++++---------------
 1 files changed, 11 insertions(+), 15 deletions(-)


diff -Nru a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c
--- a/drivers/pci/hotplug/cpqphp_pci.c	Mon Feb  9 14:59:40 2004
+++ b/drivers/pci/hotplug/cpqphp_pci.c	Mon Feb  9 14:59:40 2004
@@ -123,7 +123,7 @@
 	dbg("%s: bus/dev/func = %x/%x/%x\n", __FUNCTION__, func->bus, func->device, func->function);
 
 	for (j=0; j<8 ; j++) {
-		struct pci_dev* temp = pci_find_slot(func->bus, (func->device << 3) | j);
+		struct pci_dev* temp = pci_find_slot(func->bus, PCI_DEVFN(func->device, j));
 		if (temp)
 			pci_remove_bus_device(temp);
 	}
@@ -545,10 +545,10 @@
 		} while (function < max_functions);
 	}			// End of IF (device in slot?)
 	else {
-		return(2);
+		return 2;
 	}
 
-	return(0);
+	return 0;
 }
 
 
@@ -594,9 +594,8 @@
 
 			while (next != NULL) {
 				rc = cpqhp_save_base_addr_length(ctrl, next);
-
 				if (rc)
-					return(rc);
+					return rc;
 
 				next = next->next;
 			}
@@ -979,7 +978,6 @@
 
 			while (next != NULL) {
 				rc = cpqhp_configure_board(ctrl, next);
-
 				if (rc)
 					return rc;
 
@@ -1076,9 +1074,8 @@
 
 			while (next != NULL) {
 				rc = cpqhp_valid_replace(ctrl, next);
-
 				if (rc)
-					return(rc);
+					return rc;
 
 				next = next->next;
 			}
@@ -1144,7 +1141,7 @@
 	}
 
 
-	return(0);
+	return 0;
 }
 
 
@@ -1229,9 +1226,8 @@
 	i = readb(rom_resource_table + NUMBER_OF_ENTRIES);
 	dbg("number_of_entries = %d\n", i);
 
-	if (!readb(one_slot + SECONDARY_BUS)) {
-		return(1);
-	}
+	if (!readb(one_slot + SECONDARY_BUS))
+		return 1;
 
 	dbg("dev|IO base|length|Mem base|length|Pre base|length|PB SB MB\n");
 
@@ -1391,7 +1387,7 @@
 	rc &= cpqhp_resource_sort_and_combine(&(ctrl->io_head));
 	rc &= cpqhp_resource_sort_and_combine(&(ctrl->bus_head));
 
-	return(rc);
+	return rc;
 }
 
 
@@ -1411,7 +1407,7 @@
 	dbg("%s\n", __FUNCTION__);
 
 	if (!func)
-		return(1);
+		return 1;
 
 	node = func->io_head;
 	func->io_head = NULL;
@@ -1450,7 +1446,7 @@
 	rc |= cpqhp_resource_sort_and_combine(&(resources->io_head));
 	rc |= cpqhp_resource_sort_and_combine(&(resources->bus_head));
 
-	return(rc);
+	return rc;
 }
 
 


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22 ` [PATCH] PCI Update " Greg KH
@ 2004-02-09 23:22   ` Greg KH
  2004-02-09 23:22     ` Greg KH
  2004-02-10 16:03     ` Geert Uytterhoeven
  0 siblings, 2 replies; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.2, 2004/01/30 16:34:48-08:00, ambx1@neo.rr.com

[PATCH] PCI: Remove uneeded resource structures from pci_dev

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.


 drivers/serial/8250_pci.c |   27 ++++++---------------------
 include/linux/pci.h       |    2 --
 2 files changed, 6 insertions(+), 23 deletions(-)


diff -Nru a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
--- a/drivers/serial/8250_pci.c	Mon Feb  9 14:59:44 2004
+++ b/drivers/serial/8250_pci.c	Mon Feb  9 14:59:44 2004
@@ -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,
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h	Mon Feb  9 14:59:44 2004
+++ b/include/linux/pci.h	Mon Feb  9 14:59:44 2004
@@ -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] 32+ messages in thread

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22     ` Greg KH
@ 2004-02-09 23:22       ` Greg KH
  2004-02-09 23:22         ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.4, 2004/02/02 11:04:46-08:00, dsaxena@plexity.net

[PATCH] PCI: Replace pci_pool with generic dma_pool

- Move drivers/pci/pool.c to drivers/base/pool.c
- Initialize struct device.dma_pools in device_initialize()
- Remove initialization of struct pci_dev.pools from pci_setup_device()


 drivers/pci/pool.c     |  404 ------------------------------------------------
 drivers/base/Makefile  |    2 
 drivers/base/core.c    |    1 
 drivers/base/dmapool.c |  409 +++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/pci/Makefile   |    2 
 drivers/pci/probe.c    |    2 
 6 files changed, 412 insertions(+), 408 deletions(-)


diff -Nru a/drivers/base/Makefile b/drivers/base/Makefile
--- a/drivers/base/Makefile	Mon Feb  9 14:59:35 2004
+++ b/drivers/base/Makefile	Mon Feb  9 14:59:35 2004
@@ -2,7 +2,7 @@
 
 obj-y			:= core.o sys.o interface.o bus.o \
 			   driver.o class.o class_simple.o platform.o \
-			   cpu.o firmware.o init.o map.o
+			   cpu.o firmware.o init.o map.o dmapool.o
 obj-y			+= power/
 obj-$(CONFIG_FW_LOADER)	+= firmware_class.o
 obj-$(CONFIG_NUMA)	+= node.o  memblk.o
diff -Nru a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c	Mon Feb  9 14:59:35 2004
+++ b/drivers/base/core.c	Mon Feb  9 14:59:35 2004
@@ -197,6 +197,7 @@
 	INIT_LIST_HEAD(&dev->children);
 	INIT_LIST_HEAD(&dev->driver_list);
 	INIT_LIST_HEAD(&dev->bus_list);
+	INIT_LIST_HEAD(&dev->dma_pools);
 }
 
 /**
diff -Nru a/drivers/base/dmapool.c b/drivers/base/dmapool.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/base/dmapool.c	Mon Feb  9 14:59:35 2004
@@ -0,0 +1,409 @@
+
+#include <linux/device.h>
+#include <linux/mm.h>
+#include <asm/io.h>		/* Needed for i386 to build */
+#include <asm/scatterlist.h>	/* Needed for i386 to build */
+#include <linux/dma-mapping.h>
+#include <linux/dmapool.h>
+#include <linux/slab.h>
+#include <linux/module.h>
+
+/*
+ * Pool allocator ... wraps the dma_alloc_coherent page allocator, so
+ * small blocks are easily used by drivers for bus mastering controllers.
+ * This should probably be sharing the guts of the slab allocator.
+ */
+
+struct dma_pool {	/* the pool */
+	struct list_head	page_list;
+	spinlock_t		lock;
+	size_t			blocks_per_page;
+	size_t			size;
+	struct device		*dev;
+	size_t			allocation;
+	char			name [32];
+	wait_queue_head_t	waitq;
+	struct list_head	pools;
+};
+
+struct dma_page {	/* cacheable header for 'allocation' bytes */
+	struct list_head	page_list;
+	void			*vaddr;
+	dma_addr_t		dma;
+	unsigned		in_use;
+	unsigned long		bitmap [0];
+};
+
+#define	POOL_TIMEOUT_JIFFIES	((100 /* msec */ * HZ) / 1000)
+#define	POOL_POISON_FREED	0xa7	/* !inuse */
+#define	POOL_POISON_ALLOCATED	0xa9	/* !initted */
+
+static DECLARE_MUTEX (pools_lock);
+
+static ssize_t
+show_pools (struct device *dev, char *buf)
+{
+	unsigned		temp, size;
+	char			*next;
+	struct list_head	*i, *j;
+
+	next = buf;
+	size = PAGE_SIZE;
+
+	temp = snprintf (next, size, "poolinfo - 0.1\n");
+	size -= temp;
+	next += temp;
+
+	down (&pools_lock);
+	list_for_each (i, &dev->dma_pools) {
+		struct dma_pool	*pool;
+		unsigned	pages = 0, blocks = 0;
+
+		pool = list_entry (i, struct dma_pool, pools);
+
+		list_for_each (j, &pool->page_list) {
+			struct dma_page	*page;
+
+			page = list_entry (j, struct dma_page, page_list);
+			pages++;
+			blocks += page->in_use;
+		}
+
+		/* per-pool info, no real statistics yet */
+		temp = snprintf (next, size, "%-16s %4u %4Zu %4Zu %2u\n",
+				pool->name,
+				blocks, pages * pool->blocks_per_page,
+				pool->size, pages);
+		size -= temp;
+		next += temp;
+	}
+	up (&pools_lock);
+
+	return PAGE_SIZE - size;
+}
+static DEVICE_ATTR (pools, S_IRUGO, show_pools, NULL);
+
+/**
+ * dma_pool_create - Creates a pool of consistent memory blocks, for dma.
+ * @name: name of pool, for diagnostics
+ * @dev: device that will be doing the DMA
+ * @size: size of the blocks in this pool.
+ * @align: alignment requirement for blocks; must be a power of two
+ * @allocation: returned blocks won't cross this boundary (or zero)
+ * Context: !in_interrupt()
+ *
+ * Returns a dma allocation pool with the requested characteristics, or
+ * null if one can't be created.  Given one of these pools, dma_pool_alloc()
+ * may be used to allocate memory.  Such memory will all have "consistent"
+ * DMA mappings, accessible by the device and its driver without using
+ * cache flushing primitives.  The actual size of blocks allocated may be
+ * larger than requested because of alignment.
+ *
+ * If allocation is nonzero, objects returned from dma_pool_alloc() won't
+ * cross that size boundary.  This is useful for devices which have
+ * addressing restrictions on individual DMA transfers, such as not crossing
+ * boundaries of 4KBytes.
+ */
+struct dma_pool *
+dma_pool_create (const char *name, struct device *dev,
+	size_t size, size_t align, size_t allocation)
+{
+	struct dma_pool		*retval;
+
+	if (align == 0)
+		align = 1;
+	if (size == 0)
+		return 0;
+	else if (size < align)
+		size = align;
+	else if ((size % align) != 0) {
+		size += align + 1;
+		size &= ~(align - 1);
+	}
+
+	if (allocation == 0) {
+		if (PAGE_SIZE < size)
+			allocation = size;
+		else
+			allocation = PAGE_SIZE;
+		// FIXME: round up for less fragmentation
+	} else if (allocation < size)
+		return 0;
+
+	if (!(retval = kmalloc (sizeof *retval, SLAB_KERNEL)))
+		return retval;
+
+	strlcpy (retval->name, name, sizeof retval->name);
+
+	retval->dev = dev;
+
+	INIT_LIST_HEAD (&retval->page_list);
+	spin_lock_init (&retval->lock);
+	retval->size = size;
+	retval->allocation = allocation;
+	retval->blocks_per_page = allocation / size;
+	init_waitqueue_head (&retval->waitq);
+
+	if (dev) {
+		down (&pools_lock);
+		if (list_empty (&dev->dma_pools))
+			device_create_file (dev, &dev_attr_pools);
+		/* note:  not currently insisting "name" be unique */
+		list_add (&retval->pools, &dev->dma_pools);
+		up (&pools_lock);
+	} else
+		INIT_LIST_HEAD (&retval->pools);
+
+	return retval;
+}
+
+
+static struct dma_page *
+pool_alloc_page (struct dma_pool *pool, int mem_flags)
+{
+	struct dma_page	*page;
+	int		mapsize;
+
+	mapsize = pool->blocks_per_page;
+	mapsize = (mapsize + BITS_PER_LONG - 1) / BITS_PER_LONG;
+	mapsize *= sizeof (long);
+
+	page = (struct dma_page *) kmalloc (mapsize + sizeof *page, mem_flags);
+	if (!page)
+		return 0;
+	page->vaddr = dma_alloc_coherent (pool->dev,
+					    pool->allocation,
+					    &page->dma,
+					    mem_flags);
+	if (page->vaddr) {
+		memset (page->bitmap, 0xff, mapsize);	// bit set == free
+#ifdef	CONFIG_DEBUG_SLAB
+		memset (page->vaddr, POOL_POISON_FREED, pool->allocation);
+#endif
+		list_add (&page->page_list, &pool->page_list);
+		page->in_use = 0;
+	} else {
+		kfree (page);
+		page = 0;
+	}
+	return page;
+}
+
+
+static inline int
+is_page_busy (int blocks, unsigned long *bitmap)
+{
+	while (blocks > 0) {
+		if (*bitmap++ != ~0UL)
+			return 1;
+		blocks -= BITS_PER_LONG;
+	}
+	return 0;
+}
+
+static void
+pool_free_page (struct dma_pool *pool, struct dma_page *page)
+{
+	dma_addr_t	dma = page->dma;
+
+#ifdef	CONFIG_DEBUG_SLAB
+	memset (page->vaddr, POOL_POISON_FREED, pool->allocation);
+#endif
+	dma_free_coherent (pool->dev, pool->allocation, page->vaddr, dma);
+	list_del (&page->page_list);
+	kfree (page);
+}
+
+
+/**
+ * dma_pool_destroy - destroys a pool of dma memory blocks.
+ * @pool: dma pool that will be destroyed
+ * Context: !in_interrupt()
+ *
+ * Caller guarantees that no more memory from the pool is in use,
+ * and that nothing will try to use the pool after this call.
+ */
+void
+dma_pool_destroy (struct dma_pool *pool)
+{
+	down (&pools_lock);
+	list_del (&pool->pools);
+	if (pool->dev && list_empty (&pool->dev->dma_pools))
+		device_remove_file (pool->dev, &dev_attr_pools);
+	up (&pools_lock);
+
+	while (!list_empty (&pool->page_list)) {
+		struct dma_page		*page;
+		page = list_entry (pool->page_list.next,
+				struct dma_page, page_list);
+		if (is_page_busy (pool->blocks_per_page, page->bitmap)) {
+			printk (KERN_ERR "dma_pool_destroy %s/%s, %p busy\n",
+				pool->dev ? pool->dev->bus_id : NULL,
+				pool->name, page->vaddr);
+			/* leak the still-in-use consistent memory */
+			list_del (&page->page_list);
+			kfree (page);
+		} else
+			pool_free_page (pool, page);
+	}
+
+	kfree (pool);
+}
+
+
+/**
+ * dma_pool_alloc - get a block of consistent memory
+ * @pool: dma pool that will produce the block
+ * @mem_flags: SLAB_KERNEL or SLAB_ATOMIC
+ * @handle: pointer to dma address of block
+ *
+ * This returns the kernel virtual address of a currently unused block,
+ * and reports its dma address through the handle.
+ * If such a memory block can't be allocated, null is returned.
+ */
+void *
+dma_pool_alloc (struct dma_pool *pool, int mem_flags, dma_addr_t *handle)
+{
+	unsigned long		flags;
+	struct list_head	*entry;
+	struct dma_page		*page;
+	int			map, block;
+	size_t			offset;
+	void			*retval;
+
+restart:
+	spin_lock_irqsave (&pool->lock, flags);
+	list_for_each (entry, &pool->page_list) {
+		int		i;
+		page = list_entry (entry, struct dma_page, page_list);
+		/* only cachable accesses here ... */
+		for (map = 0, i = 0;
+				i < pool->blocks_per_page;
+				i += BITS_PER_LONG, map++) {
+			if (page->bitmap [map] == 0)
+				continue;
+			block = ffz (~ page->bitmap [map]);
+			if ((i + block) < pool->blocks_per_page) {
+				clear_bit (block, &page->bitmap [map]);
+				offset = (BITS_PER_LONG * map) + block;
+				offset *= pool->size;
+				goto ready;
+			}
+		}
+	}
+	if (!(page = pool_alloc_page (pool, SLAB_ATOMIC))) {
+		if (mem_flags == SLAB_KERNEL) {
+			DECLARE_WAITQUEUE (wait, current);
+
+			current->state = TASK_INTERRUPTIBLE;
+			add_wait_queue (&pool->waitq, &wait);
+			spin_unlock_irqrestore (&pool->lock, flags);
+
+			schedule_timeout (POOL_TIMEOUT_JIFFIES);
+
+			remove_wait_queue (&pool->waitq, &wait);
+			goto restart;
+		}
+		retval = 0;
+		goto done;
+	}
+
+	clear_bit (0, &page->bitmap [0]);
+	offset = 0;
+ready:
+	page->in_use++;
+	retval = offset + page->vaddr;
+	*handle = offset + page->dma;
+#ifdef	CONFIG_DEBUG_SLAB
+	memset (retval, POOL_POISON_ALLOCATED, pool->size);
+#endif
+done:
+	spin_unlock_irqrestore (&pool->lock, flags);
+	return retval;
+}
+
+
+static struct dma_page *
+pool_find_page (struct dma_pool *pool, dma_addr_t dma)
+{
+	unsigned long		flags;
+	struct list_head	*entry;
+	struct dma_page		*page;
+
+	spin_lock_irqsave (&pool->lock, flags);
+	list_for_each (entry, &pool->page_list) {
+		page = list_entry (entry, struct dma_page, page_list);
+		if (dma < page->dma)
+			continue;
+		if (dma < (page->dma + pool->allocation))
+			goto done;
+	}
+	page = 0;
+done:
+	spin_unlock_irqrestore (&pool->lock, flags);
+	return page;
+}
+
+
+/**
+ * dma_pool_free - put block back into dma pool
+ * @pool: the dma pool holding the block
+ * @vaddr: virtual address of block
+ * @dma: dma address of block
+ *
+ * Caller promises neither device nor driver will again touch this block
+ * unless it is first re-allocated.
+ */
+void
+dma_pool_free (struct dma_pool *pool, void *vaddr, dma_addr_t dma)
+{
+	struct dma_page		*page;
+	unsigned long		flags;
+	int			map, block;
+
+	if ((page = pool_find_page (pool, dma)) == 0) {
+		printk (KERN_ERR "dma_pool_free %s/%s, %p/%lx (bad dma)\n",
+			pool->dev ? pool->dev->bus_id : NULL,
+			pool->name, vaddr, (unsigned long) dma);
+		return;
+	}
+
+	block = dma - page->dma;
+	block /= pool->size;
+	map = block / BITS_PER_LONG;
+	block %= BITS_PER_LONG;
+
+#ifdef	CONFIG_DEBUG_SLAB
+	if (((dma - page->dma) + (void *)page->vaddr) != vaddr) {
+		printk (KERN_ERR "dma_pool_free %s/%s, %p (bad vaddr)/%Lx\n",
+			pool->dev ? pool->dev->bus_id : NULL,
+			pool->name, vaddr, (unsigned long long) dma);
+		return;
+	}
+	if (page->bitmap [map] & (1UL << block)) {
+		printk (KERN_ERR "dma_pool_free %s/%s, dma %Lx already free\n",
+			pool->dev ? pool->dev->bus_id : NULL,
+			pool->name, (unsigned long long)dma);
+		return;
+	}
+	memset (vaddr, POOL_POISON_FREED, pool->size);
+#endif
+
+	spin_lock_irqsave (&pool->lock, flags);
+	page->in_use--;
+	set_bit (block, &page->bitmap [map]);
+	if (waitqueue_active (&pool->waitq))
+		wake_up (&pool->waitq);
+	/*
+	 * Resist a temptation to do
+	 *    if (!is_page_busy(bpp, page->bitmap)) pool_free_page(pool, page);
+	 * it is not interrupt safe. Better have empty pages hang around.
+	 */
+	spin_unlock_irqrestore (&pool->lock, flags);
+}
+
+
+EXPORT_SYMBOL (dma_pool_create);
+EXPORT_SYMBOL (dma_pool_destroy);
+EXPORT_SYMBOL (dma_pool_alloc);
+EXPORT_SYMBOL (dma_pool_free);
diff -Nru a/drivers/pci/Makefile b/drivers/pci/Makefile
--- a/drivers/pci/Makefile	Mon Feb  9 14:59:35 2004
+++ b/drivers/pci/Makefile	Mon Feb  9 14:59:35 2004
@@ -2,7 +2,7 @@
 # Makefile for the PCI bus specific drivers.
 #
 
-obj-y		+= access.o bus.o probe.o remove.o pci.o pool.o quirks.o \
+obj-y		+= access.o bus.o probe.o remove.o pci.o quirks.o \
 			names.o pci-driver.o search.o pci-sysfs.o
 obj-$(CONFIG_PROC_FS) += proc.o
 
diff -Nru a/drivers/pci/pool.c b/drivers/pci/pool.c
--- a/drivers/pci/pool.c	Mon Feb  9 14:59:35 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,404 +0,0 @@
-#include <linux/pci.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-
-/*
- * Pool allocator ... wraps the pci_alloc_consistent page allocator, so
- * small blocks are easily used by drivers for bus mastering controllers.
- * This should probably be sharing the guts of the slab allocator.
- */
-
-struct pci_pool {	/* the pool */
-	struct list_head	page_list;
-	spinlock_t		lock;
-	size_t			blocks_per_page;
-	size_t			size;
-	struct pci_dev		*dev;
-	size_t			allocation;
-	char			name [32];
-	wait_queue_head_t	waitq;
-	struct list_head	pools;
-};
-
-struct pci_page {	/* cacheable header for 'allocation' bytes */
-	struct list_head	page_list;
-	void			*vaddr;
-	dma_addr_t		dma;
-	unsigned		in_use;
-	unsigned long		bitmap [0];
-};
-
-#define	POOL_TIMEOUT_JIFFIES	((100 /* msec */ * HZ) / 1000)
-#define	POOL_POISON_FREED	0xa7	/* !inuse */
-#define	POOL_POISON_ALLOCATED	0xa9	/* !initted */
-
-static DECLARE_MUTEX (pools_lock);
-
-static ssize_t
-show_pools (struct device *dev, char *buf)
-{
-	struct pci_dev		*pdev;
-	unsigned		temp, size;
-	char			*next;
-	struct list_head	*i, *j;
-
-	pdev = container_of (dev, struct pci_dev, dev);
-	next = buf;
-	size = PAGE_SIZE;
-
-	temp = snprintf (next, size, "poolinfo - 0.1\n");
-	size -= temp;
-	next += temp;
-
-	down (&pools_lock);
-	list_for_each (i, &pdev->pools) {
-		struct pci_pool	*pool;
-		unsigned	pages = 0, blocks = 0;
-
-		pool = list_entry (i, struct pci_pool, pools);
-
-		list_for_each (j, &pool->page_list) {
-			struct pci_page	*page;
-
-			page = list_entry (j, struct pci_page, page_list);
-			pages++;
-			blocks += page->in_use;
-		}
-
-		/* per-pool info, no real statistics yet */
-		temp = snprintf (next, size, "%-16s %4u %4Zu %4Zu %2u\n",
-				pool->name,
-				blocks, pages * pool->blocks_per_page,
-				pool->size, pages);
-		size -= temp;
-		next += temp;
-	}
-	up (&pools_lock);
-
-	return PAGE_SIZE - size;
-}
-static DEVICE_ATTR (pools, S_IRUGO, show_pools, NULL);
-
-/**
- * pci_pool_create - Creates a pool of pci consistent memory blocks, for dma.
- * @name: name of pool, for diagnostics
- * @pdev: pci device that will be doing the DMA
- * @size: size of the blocks in this pool.
- * @align: alignment requirement for blocks; must be a power of two
- * @allocation: returned blocks won't cross this boundary (or zero)
- * Context: !in_interrupt()
- *
- * Returns a pci allocation pool with the requested characteristics, or
- * null if one can't be created.  Given one of these pools, pci_pool_alloc()
- * may be used to allocate memory.  Such memory will all have "consistent"
- * DMA mappings, accessible by the device and its driver without using
- * cache flushing primitives.  The actual size of blocks allocated may be
- * larger than requested because of alignment.
- *
- * If allocation is nonzero, objects returned from pci_pool_alloc() won't
- * cross that size boundary.  This is useful for devices which have
- * addressing restrictions on individual DMA transfers, such as not crossing
- * boundaries of 4KBytes.
- */
-struct pci_pool *
-pci_pool_create (const char *name, struct pci_dev *pdev,
-	size_t size, size_t align, size_t allocation)
-{
-	struct pci_pool		*retval;
-
-	if (align == 0)
-		align = 1;
-	if (size == 0)
-		return 0;
-	else if (size < align)
-		size = align;
-	else if ((size % align) != 0) {
-		size += align + 1;
-		size &= ~(align - 1);
-	}
-
-	if (allocation == 0) {
-		if (PAGE_SIZE < size)
-			allocation = size;
-		else
-			allocation = PAGE_SIZE;
-		// FIXME: round up for less fragmentation
-	} else if (allocation < size)
-		return 0;
-
-	if (!(retval = kmalloc (sizeof *retval, SLAB_KERNEL)))
-		return retval;
-
-	strlcpy (retval->name, name, sizeof retval->name);
-
-	retval->dev = pdev;
-
-	INIT_LIST_HEAD (&retval->page_list);
-	spin_lock_init (&retval->lock);
-	retval->size = size;
-	retval->allocation = allocation;
-	retval->blocks_per_page = allocation / size;
-	init_waitqueue_head (&retval->waitq);
-
-	if (pdev) {
-		down (&pools_lock);
-		if (list_empty (&pdev->pools))
-			device_create_file (&pdev->dev, &dev_attr_pools);
-		/* note:  not currently insisting "name" be unique */
-		list_add (&retval->pools, &pdev->pools);
-		up (&pools_lock);
-	} else
-		INIT_LIST_HEAD (&retval->pools);
-
-	return retval;
-}
-
-
-static struct pci_page *
-pool_alloc_page (struct pci_pool *pool, int mem_flags)
-{
-	struct pci_page	*page;
-	int		mapsize;
-
-	mapsize = pool->blocks_per_page;
-	mapsize = (mapsize + BITS_PER_LONG - 1) / BITS_PER_LONG;
-	mapsize *= sizeof (long);
-
-	page = (struct pci_page *) kmalloc (mapsize + sizeof *page, mem_flags);
-	if (!page)
-		return 0;
-	page->vaddr = pci_alloc_consistent (pool->dev,
-					    pool->allocation,
-					    &page->dma);
-	if (page->vaddr) {
-		memset (page->bitmap, 0xff, mapsize);	// bit set == free
-#ifdef	CONFIG_DEBUG_SLAB
-		memset (page->vaddr, POOL_POISON_FREED, pool->allocation);
-#endif
-		list_add (&page->page_list, &pool->page_list);
-		page->in_use = 0;
-	} else {
-		kfree (page);
-		page = 0;
-	}
-	return page;
-}
-
-
-static inline int
-is_page_busy (int blocks, unsigned long *bitmap)
-{
-	while (blocks > 0) {
-		if (*bitmap++ != ~0UL)
-			return 1;
-		blocks -= BITS_PER_LONG;
-	}
-	return 0;
-}
-
-static void
-pool_free_page (struct pci_pool *pool, struct pci_page *page)
-{
-	dma_addr_t	dma = page->dma;
-
-#ifdef	CONFIG_DEBUG_SLAB
-	memset (page->vaddr, POOL_POISON_FREED, pool->allocation);
-#endif
-	pci_free_consistent (pool->dev, pool->allocation, page->vaddr, dma);
-	list_del (&page->page_list);
-	kfree (page);
-}
-
-
-/**
- * pci_pool_destroy - destroys a pool of pci memory blocks.
- * @pool: pci pool that will be destroyed
- * Context: !in_interrupt()
- *
- * Caller guarantees that no more memory from the pool is in use,
- * and that nothing will try to use the pool after this call.
- */
-void
-pci_pool_destroy (struct pci_pool *pool)
-{
-	down (&pools_lock);
-	list_del (&pool->pools);
-	if (pool->dev && list_empty (&pool->dev->pools))
-		device_remove_file (&pool->dev->dev, &dev_attr_pools);
-	up (&pools_lock);
-
-	while (!list_empty (&pool->page_list)) {
-		struct pci_page		*page;
-		page = list_entry (pool->page_list.next,
-				struct pci_page, page_list);
-		if (is_page_busy (pool->blocks_per_page, page->bitmap)) {
-			printk (KERN_ERR "pci_pool_destroy %s/%s, %p busy\n",
-				pool->dev ? pci_name(pool->dev) : NULL,
-				pool->name, page->vaddr);
-			/* leak the still-in-use consistent memory */
-			list_del (&page->page_list);
-			kfree (page);
-		} else
-			pool_free_page (pool, page);
-	}
-
-	kfree (pool);
-}
-
-
-/**
- * pci_pool_alloc - get a block of consistent memory
- * @pool: pci pool that will produce the block
- * @mem_flags: SLAB_KERNEL or SLAB_ATOMIC
- * @handle: pointer to dma address of block
- *
- * This returns the kernel virtual address of a currently unused block,
- * and reports its dma address through the handle.
- * If such a memory block can't be allocated, null is returned.
- */
-void *
-pci_pool_alloc (struct pci_pool *pool, int mem_flags, dma_addr_t *handle)
-{
-	unsigned long		flags;
-	struct list_head	*entry;
-	struct pci_page		*page;
-	int			map, block;
-	size_t			offset;
-	void			*retval;
-
-restart:
-	spin_lock_irqsave (&pool->lock, flags);
-	list_for_each (entry, &pool->page_list) {
-		int		i;
-		page = list_entry (entry, struct pci_page, page_list);
-		/* only cachable accesses here ... */
-		for (map = 0, i = 0;
-				i < pool->blocks_per_page;
-				i += BITS_PER_LONG, map++) {
-			if (page->bitmap [map] == 0)
-				continue;
-			block = ffz (~ page->bitmap [map]);
-			if ((i + block) < pool->blocks_per_page) {
-				clear_bit (block, &page->bitmap [map]);
-				offset = (BITS_PER_LONG * map) + block;
-				offset *= pool->size;
-				goto ready;
-			}
-		}
-	}
-	if (!(page = pool_alloc_page (pool, SLAB_ATOMIC))) {
-		if (mem_flags == SLAB_KERNEL) {
-			DECLARE_WAITQUEUE (wait, current);
-
-			current->state = TASK_INTERRUPTIBLE;
-			add_wait_queue (&pool->waitq, &wait);
-			spin_unlock_irqrestore (&pool->lock, flags);
-
-			schedule_timeout (POOL_TIMEOUT_JIFFIES);
-
-			remove_wait_queue (&pool->waitq, &wait);
-			goto restart;
-		}
-		retval = 0;
-		goto done;
-	}
-
-	clear_bit (0, &page->bitmap [0]);
-	offset = 0;
-ready:
-	page->in_use++;
-	retval = offset + page->vaddr;
-	*handle = offset + page->dma;
-#ifdef	CONFIG_DEBUG_SLAB
-	memset (retval, POOL_POISON_ALLOCATED, pool->size);
-#endif
-done:
-	spin_unlock_irqrestore (&pool->lock, flags);
-	return retval;
-}
-
-
-static struct pci_page *
-pool_find_page (struct pci_pool *pool, dma_addr_t dma)
-{
-	unsigned long		flags;
-	struct list_head	*entry;
-	struct pci_page		*page;
-
-	spin_lock_irqsave (&pool->lock, flags);
-	list_for_each (entry, &pool->page_list) {
-		page = list_entry (entry, struct pci_page, page_list);
-		if (dma < page->dma)
-			continue;
-		if (dma < (page->dma + pool->allocation))
-			goto done;
-	}
-	page = 0;
-done:
-	spin_unlock_irqrestore (&pool->lock, flags);
-	return page;
-}
-
-
-/**
- * pci_pool_free - put block back into pci pool
- * @pool: the pci pool holding the block
- * @vaddr: virtual address of block
- * @dma: dma address of block
- *
- * Caller promises neither device nor driver will again touch this block
- * unless it is first re-allocated.
- */
-void
-pci_pool_free (struct pci_pool *pool, void *vaddr, dma_addr_t dma)
-{
-	struct pci_page		*page;
-	unsigned long		flags;
-	int			map, block;
-
-	if ((page = pool_find_page (pool, dma)) == 0) {
-		printk (KERN_ERR "pci_pool_free %s/%s, %p/%lx (bad dma)\n",
-			pool->dev ? pci_name(pool->dev) : NULL,
-			pool->name, vaddr, (unsigned long) dma);
-		return;
-	}
-
-	block = dma - page->dma;
-	block /= pool->size;
-	map = block / BITS_PER_LONG;
-	block %= BITS_PER_LONG;
-
-#ifdef	CONFIG_DEBUG_SLAB
-	if (((dma - page->dma) + (void *)page->vaddr) != vaddr) {
-		printk (KERN_ERR "pci_pool_free %s/%s, %p (bad vaddr)/%Lx\n",
-			pool->dev ? pci_name(pool->dev) : NULL,
-			pool->name, vaddr, (unsigned long long) dma);
-		return;
-	}
-	if (page->bitmap [map] & (1UL << block)) {
-		printk (KERN_ERR "pci_pool_free %s/%s, dma %Lx already free\n",
-			pool->dev ? pci_name(pool->dev) : NULL,
-			pool->name, (unsigned long long)dma);
-		return;
-	}
-	memset (vaddr, POOL_POISON_FREED, pool->size);
-#endif
-
-	spin_lock_irqsave (&pool->lock, flags);
-	page->in_use--;
-	set_bit (block, &page->bitmap [map]);
-	if (waitqueue_active (&pool->waitq))
-		wake_up (&pool->waitq);
-	/*
-	 * Resist a temptation to do
-	 *    if (!is_page_busy(bpp, page->bitmap)) pool_free_page(pool, page);
-	 * it is not interrupt safe. Better have empty pages hang around.
-	 */
-	spin_unlock_irqrestore (&pool->lock, flags);
-}
-
-
-EXPORT_SYMBOL (pci_pool_create);
-EXPORT_SYMBOL (pci_pool_destroy);
-EXPORT_SYMBOL (pci_pool_alloc);
-EXPORT_SYMBOL (pci_pool_free);
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c	Mon Feb  9 14:59:35 2004
+++ b/drivers/pci/probe.c	Mon Feb  9 14:59:35 2004
@@ -452,8 +452,6 @@
 	sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(dev->bus),
 		dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
 
-	INIT_LIST_HEAD(&dev->pools);
-
 	pci_read_config_dword(dev, PCI_CLASS_REVISION, &class);
 	class >>= 8;				    /* upper 3 bytes */
 	dev->class = class;


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22       ` Greg KH
@ 2004-02-09 23:22         ` Greg KH
  2004-02-09 23:22           ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.5, 2004/02/02 11:05:17-08:00, dsaxena@plexity.net

[PATCH] PCI: Replace pci_pool with generic dma_pool, part 2

include/linux changes:

- Add dma_pools member to struct device
- Add include/linux/dmapool.h
- Remove pools memober from struct pci_dev
- Replace pci_pool_* functions with macros that map to dma_pool_* functions


 include/linux/device.h  |    1 +
 include/linux/dmapool.h |   27 +++++++++++++++++++++++++++
 include/linux/pci.h     |   14 ++++++++------
 3 files changed, 36 insertions(+), 6 deletions(-)


diff -Nru a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h	Mon Feb  9 14:59:31 2004
+++ b/include/linux/device.h	Mon Feb  9 14:59:31 2004
@@ -284,6 +284,7 @@
 					   detached from its driver. */
 
 	u64		*dma_mask;	/* dma mask (if dma'able device) */
+	struct list_head	dma_pools;	/* dma pools (if dma'ble) */
 
 	void	(*release)(struct device * dev);
 };
diff -Nru a/include/linux/dmapool.h b/include/linux/dmapool.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/include/linux/dmapool.h	Mon Feb  9 14:59:31 2004
@@ -0,0 +1,27 @@
+/*
+ * include/linux/dmapool.h
+ *
+ * Allocation pools for DMAable (coherent) memory.
+ *
+ * This file is licensed under  the terms of the GNU General Public 
+ * License version 2. This program is licensed "as is" without any 
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef LINUX_DMAPOOL_H
+#define	LINUX_DMAPOOL_H
+
+#include <asm/io.h>
+#include <asm/scatterlist.h>
+
+struct dma_pool *dma_pool_create(const char *name, struct device *dev, 
+			size_t size, size_t align, size_t allocation);
+
+void dma_pool_destroy(struct dma_pool *pool);
+
+void *dma_pool_alloc(struct dma_pool *pool, int mem_flags, dma_addr_t *handle);
+
+void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr);
+
+#endif
+
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h	Mon Feb  9 14:59:31 2004
+++ b/include/linux/pci.h	Mon Feb  9 14:59:31 2004
@@ -393,7 +393,6 @@
 					   0xffffffff.  You only need to change
 					   this if your device has broken DMA
 					   or supports 64-bit transfers.  */
-	struct list_head pools;		/* pci_pools tied to this device */
 
 	u64		consistent_dma_mask;/* Like dma_mask, but for
 					       pci_alloc_consistent mappings as
@@ -692,12 +691,15 @@
 int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass);
 
 /* kmem_cache style wrapper around pci_alloc_consistent() */
-struct pci_pool *pci_pool_create (const char *name, struct pci_dev *dev,
-		size_t size, size_t align, size_t allocation);
-void pci_pool_destroy (struct pci_pool *pool);
 
-void *pci_pool_alloc (struct pci_pool *pool, int flags, dma_addr_t *handle);
-void pci_pool_free (struct pci_pool *pool, void *vaddr, dma_addr_t addr);
+#include <linux/dmapool.h>
+
+#define	pci_pool dma_pool
+#define pci_pool_create(name, pdev, size, align, allocation) \
+		dma_pool_create(name, &pdev->dev, size, align, allocation)
+#define	pci_pool_destroy(pool) dma_pool_destroy(pool)
+#define	pci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, handle)
+#define	pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr)
 
 #if defined(CONFIG_ISA) || defined(CONFIG_EISA)
 extern struct pci_dev *isa_bridge;


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22           ` Greg KH
@ 2004-02-09 23:22             ` Greg KH
  2004-02-09 23:22               ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.7, 2004/02/02 11:42:37-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI Hotplug: Whitespace fixes for acpiphp

This are some whitespace fixes for acpiphp, in most cases killing spaces
before the opening brace of function declarations.


 drivers/pci/hotplug/acpiphp_glue.c |   50 ++++++++++++++++++-------------------
 1 files changed, 25 insertions(+), 25 deletions(-)


diff -Nru a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
--- a/drivers/pci/hotplug/acpiphp_glue.c	Mon Feb  9 14:59:22 2004
+++ b/drivers/pci/hotplug/acpiphp_glue.c	Mon Feb  9 14:59:22 2004
@@ -87,7 +87,7 @@
 
 /* callback routine to check the existence of ejectable slots */
 static acpi_status
-is_ejectable_slot (acpi_handle handle, u32 lvl,	void *context, void **rv)
+is_ejectable_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
 {
 	int *count = (int *)context;
 
@@ -103,7 +103,7 @@
 
 /* callback routine to register each ACPI PCI slot object */
 static acpi_status
-register_slot (acpi_handle handle, u32 lvl, void *context, void **rv)
+register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
 {
 	struct acpiphp_bridge *bridge = (struct acpiphp_bridge *)context;
 	struct acpiphp_slot *slot;
@@ -212,7 +212,7 @@
 
 
 /* see if it's worth looking at this bridge */
-static int detect_ejectable_slots (acpi_handle *bridge_handle)
+static int detect_ejectable_slots(acpi_handle *bridge_handle)
 {
 	acpi_status status;
 	int count;
@@ -231,7 +231,7 @@
  * TBD: _TRA, etc.
  */
 static acpi_status
-decode_acpi_resource (struct acpi_resource *resource, void *context)
+decode_acpi_resource(struct acpi_resource *resource, void *context)
 {
 	struct acpiphp_bridge *bridge = (struct acpiphp_bridge *) context;
 	struct acpi_resource_address64 address;
@@ -339,7 +339,7 @@
 
 
 /* initialize miscellaneous stuff for both root and PCI-to-PCI bridge */
-static void init_bridge_misc (struct acpiphp_bridge *bridge)
+static void init_bridge_misc(struct acpiphp_bridge *bridge)
 {
 	acpi_status status;
 
@@ -371,7 +371,7 @@
 
 
 /* allocate and initialize host bridge data structure */
-static void add_host_bridge (acpi_handle *handle, int seg, int bus)
+static void add_host_bridge(acpi_handle *handle, int seg, int bus)
 {
 	acpi_status status;
 	struct acpiphp_bridge *bridge;
@@ -423,7 +423,7 @@
 
 
 /* allocate and initialize PCI-to-PCI bridge data structure */
-static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int fn)
+static void add_p2p_bridge(acpi_handle *handle, int seg, int bus, int dev, int fn)
 {
 	struct acpiphp_bridge *bridge;
 	u8 tmp8;
@@ -573,7 +573,7 @@
 
 /* callback routine to find P2P bridges */
 static acpi_status
-find_p2p_bridge (acpi_handle handle, u32 lvl, void *context, void **rv)
+find_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv)
 {
 	acpi_status status;
 	acpi_handle dummy_handle;
@@ -673,13 +673,13 @@
 }
 
 
-static void remove_bridge (acpi_handle handle)
+static void remove_bridge(acpi_handle handle)
 {
 	/* No-op for now .. */
 }
 
 
-static int power_on_slot (struct acpiphp_slot *slot)
+static int power_on_slot(struct acpiphp_slot *slot)
 {
 	acpi_status status;
 	struct acpiphp_func *func;
@@ -714,7 +714,7 @@
 }
 
 
-static int power_off_slot (struct acpiphp_slot *slot)
+static int power_off_slot(struct acpiphp_slot *slot)
 {
 	acpi_status status;
 	struct acpiphp_func *func;
@@ -778,7 +778,7 @@
  * not per each slot object in ACPI namespace.
  *
  */
-static int enable_device (struct acpiphp_slot *slot)
+static int enable_device(struct acpiphp_slot *slot)
 {
 	u8 bus;
 	struct pci_dev *dev;
@@ -852,7 +852,7 @@
 /**
  * disable_device - disable a slot
  */
-static int disable_device (struct acpiphp_slot *slot)
+static int disable_device(struct acpiphp_slot *slot)
 {
 	int retval = 0;
 	struct acpiphp_func *func;
@@ -894,7 +894,7 @@
  *
  * otherwise return 0
  */
-static unsigned int get_slot_status (struct acpiphp_slot *slot)
+static unsigned int get_slot_status(struct acpiphp_slot *slot)
 {
 	acpi_status status;
 	unsigned long sta = 0;
@@ -939,7 +939,7 @@
  * handles ACPI event notification on {host,p2p} bridges
  *
  */
-static void handle_hotplug_event_bridge (acpi_handle handle, u32 type, void *context)
+static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *context)
 {
 	struct acpiphp_bridge *bridge;
 	char objname[64];
@@ -1005,7 +1005,7 @@
  * handles ACPI event notification on slots
  *
  */
-static void handle_hotplug_event_func (acpi_handle handle, u32 type, void *context)
+static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context)
 {
 	struct acpiphp_func *func;
 	char objname[64];
@@ -1171,7 +1171,7 @@
 
 
 /* search matching slot from id  */
-struct acpiphp_slot *get_slot_from_id (int id)
+struct acpiphp_slot *get_slot_from_id(int id)
 {
 	struct list_head *node;
 	struct acpiphp_bridge *bridge;
@@ -1193,7 +1193,7 @@
 /**
  * acpiphp_enable_slot - power on slot
  */
-int acpiphp_enable_slot (struct acpiphp_slot *slot)
+int acpiphp_enable_slot(struct acpiphp_slot *slot)
 {
 	int retval;
 
@@ -1217,7 +1217,7 @@
 /**
  * acpiphp_disable_slot - power off slot
  */
-int acpiphp_disable_slot (struct acpiphp_slot *slot)
+int acpiphp_disable_slot(struct acpiphp_slot *slot)
 {
 	int retval = 0;
 
@@ -1249,7 +1249,7 @@
 /**
  * acpiphp_check_bridge - re-enumerate devices
  */
-int acpiphp_check_bridge (struct acpiphp_bridge *bridge)
+int acpiphp_check_bridge(struct acpiphp_bridge *bridge)
 {
 	struct acpiphp_slot *slot;
 	unsigned int sta;
@@ -1296,7 +1296,7 @@
  * slot enabled:  1
  * slot disabled: 0
  */
-u8 acpiphp_get_power_status (struct acpiphp_slot *slot)
+u8 acpiphp_get_power_status(struct acpiphp_slot *slot)
 {
 	unsigned int sta;
 
@@ -1314,7 +1314,7 @@
  * no direct attention led status information via ACPI
  *
  */
-u8 acpiphp_get_attention_status (struct acpiphp_slot *slot)
+u8 acpiphp_get_attention_status(struct acpiphp_slot *slot)
 {
 	return 0;
 }
@@ -1324,7 +1324,7 @@
  * latch closed:  1
  * latch   open:  0
  */
-u8 acpiphp_get_latch_status (struct acpiphp_slot *slot)
+u8 acpiphp_get_latch_status(struct acpiphp_slot *slot)
 {
 	unsigned int sta;
 
@@ -1338,7 +1338,7 @@
  * adapter presence : 1
  *          absence : 0
  */
-u8 acpiphp_get_adapter_status (struct acpiphp_slot *slot)
+u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot)
 {
 	unsigned int sta;
 
@@ -1351,7 +1351,7 @@
 /*
  * pci address (seg/bus/dev)
  */
-u32 acpiphp_get_address (struct acpiphp_slot *slot)
+u32 acpiphp_get_address(struct acpiphp_slot *slot)
 {
 	u32 address;
 


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22         ` Greg KH
@ 2004-02-09 23:22           ` Greg KH
  2004-02-09 23:22             ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.6, 2004/02/02 11:29:59-08:00, greg@kroah.com

[PATCH] dmapool: use dev_err() whenever we can to get the better information in it.


 drivers/base/dmapool.c |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)


diff -Nru a/drivers/base/dmapool.c b/drivers/base/dmapool.c
--- a/drivers/base/dmapool.c	Mon Feb  9 14:59:26 2004
+++ b/drivers/base/dmapool.c	Mon Feb  9 14:59:26 2004
@@ -237,9 +237,12 @@
 		page = list_entry (pool->page_list.next,
 				struct dma_page, page_list);
 		if (is_page_busy (pool->blocks_per_page, page->bitmap)) {
-			printk (KERN_ERR "dma_pool_destroy %s/%s, %p busy\n",
-				pool->dev ? pool->dev->bus_id : NULL,
-				pool->name, page->vaddr);
+			if (pool->dev)
+				dev_err(pool->dev, "dma_pool_destroy %s, %p busy\n",
+					pool->name, page->vaddr);
+			else
+				printk (KERN_ERR "dma_pool_destroy %s, %p busy\n",
+					pool->name, page->vaddr);
 			/* leak the still-in-use consistent memory */
 			list_del (&page->page_list);
 			kfree (page);
@@ -362,9 +365,12 @@
 	int			map, block;
 
 	if ((page = pool_find_page (pool, dma)) == 0) {
-		printk (KERN_ERR "dma_pool_free %s/%s, %p/%lx (bad dma)\n",
-			pool->dev ? pool->dev->bus_id : NULL,
-			pool->name, vaddr, (unsigned long) dma);
+		if (pool->dev)
+			dev_err(pool->dev, "dma_pool_free %s, %p/%lx (bad dma)\n",
+				pool->name, vaddr, (unsigned long) dma);
+		else
+			printk (KERN_ERR "dma_pool_free %s, %p/%lx (bad dma)\n",
+				pool->name, vaddr, (unsigned long) dma);
 		return;
 	}
 
@@ -375,15 +381,21 @@
 
 #ifdef	CONFIG_DEBUG_SLAB
 	if (((dma - page->dma) + (void *)page->vaddr) != vaddr) {
-		printk (KERN_ERR "dma_pool_free %s/%s, %p (bad vaddr)/%Lx\n",
-			pool->dev ? pool->dev->bus_id : NULL,
-			pool->name, vaddr, (unsigned long long) dma);
+		if (pool->dev)
+			dev_err(pool->dev, "dma_pool_free %s, %p (bad vaddr)/%Lx\n",
+				pool->name, vaddr, (unsigned long long) dma);
+		else
+			printk (KERN_ERR "dma_pool_free %s, %p (bad vaddr)/%Lx\n",
+				pool->name, vaddr, (unsigned long long) dma);
 		return;
 	}
 	if (page->bitmap [map] & (1UL << block)) {
-		printk (KERN_ERR "dma_pool_free %s/%s, dma %Lx already free\n",
-			pool->dev ? pool->dev->bus_id : NULL,
-			pool->name, (unsigned long long)dma);
+		if (pool->dev)
+			dev_err(pool->dev, "dma_pool_free %s, dma %Lx already free\n",
+				pool->name, (unsigned long long)dma);
+		else
+			printk (KERN_ERR "dma_pool_free %s, dma %Lx already free\n",
+				pool->name, (unsigned long long)dma);
 		return;
 	}
 	memset (vaddr, POOL_POISON_FREED, pool->size);


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22             ` Greg KH
@ 2004-02-09 23:22               ` Greg KH
  2004-02-09 23:22                 ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.8, 2004/02/02 11:42:58-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI Hotplug: Kill spaces before \n in ibmphp*

Don't use a space directly before '\n' in error/debug messages. This adds
extra code size, causes unneeded line breaks in xterms, noone else does it
and it's just superfluos and ugly.

This also adds a missing ")" in a comment.


 drivers/pci/hotplug/ibmphp_core.c |   78 +++++++++++++++++++-------------------
 drivers/pci/hotplug/ibmphp_ebda.c |   22 +++++-----
 drivers/pci/hotplug/ibmphp_pci.c  |   76 ++++++++++++++++++-------------------
 drivers/pci/hotplug/ibmphp_res.c  |   56 +++++++++++++--------------
 4 files changed, 116 insertions(+), 116 deletions(-)


diff -Nru a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
--- a/drivers/pci/hotplug/ibmphp_core.c	Mon Feb  9 14:59:18 2004
+++ b/drivers/pci/hotplug/ibmphp_core.c	Mon Feb  9 14:59:18 2004
@@ -116,7 +116,7 @@
 
 	list_for_each (tmp, &ibmphp_slot_head) {
 		slot_cur = list_entry (tmp, struct slot, ibm_slot_list);
-		/* sometimes the hot-pluggable slots start with 4 (not always from 1 */
+		/* sometimes the hot-pluggable slots start with 4 (not always from 1) */
 		slot_count = max (slot_count, slot_cur->number);
 	}
 	return slot_count;
@@ -187,7 +187,7 @@
 		return retval;
 	}
 	if (CTLR_RESULT (slot_cur->ctrl->status)) {
-		err ("command not completed successfully in power_on \n");
+		err ("command not completed successfully in power_on\n");
 		return -EIO;
 	}
 	long_delay (3 * HZ); /* For ServeRAID cards, and some 66 PCI */
@@ -201,12 +201,12 @@
 
 	retval = ibmphp_hpc_writeslot (slot_cur, cmd);
 	if (retval) {
-		err ("power off failed \n");
+		err ("power off failed\n");
 		return retval;
 	}
 	if (CTLR_RESULT (slot_cur->ctrl->status)) {
-		err ("command not completed successfully in power_off \n");
-		return -EIO;
+		err ("command not completed successfully in power_off\n");
+		retval = -EIO;
 	}
 	return 0;
 }
@@ -520,7 +520,7 @@
 	int rc = -ENODEV;
 	struct slot *pslot = NULL;
 
-	debug ("get_bus_name - Entry hotplug_slot[%lx] \n", (ulong)hotplug_slot);
+	debug ("get_bus_name - Entry hotplug_slot[%lx]\n", (ulong)hotplug_slot);
 
 	ibmphp_lock_operations ();
 
@@ -654,7 +654,7 @@
 
 	info = kmalloc (sizeof (struct hotplug_slot_info), GFP_KERNEL);
 	if (!info) {
-		err ("out of system memory \n");
+		err ("out of system memory\n");
 		return -ENOMEM;
 	}
         
@@ -794,7 +794,7 @@
 	dev->bus = bus;
 	for (dev->devfn = 0; dev->devfn < 256; dev->devfn += 8) {
 		if (!pci_read_config_word (dev, PCI_VENDOR_ID, &l) &&  l != 0x0000 && l != 0xffff) {
-			debug ("%s - Inside bus_struture_fixup() \n", __FUNCTION__);
+			debug ("%s - Inside bus_struture_fixup()\n", __FUNCTION__);
 			pci_scan_bus (busno, ibmphp_pci_bus->ops, NULL);
 			break;
 		}
@@ -829,7 +829,7 @@
 
 		func->dev = pci_find_slot(func->busno, PCI_DEVFN(func->device, func->function));
 		if (func->dev == NULL) {
-			err ("ERROR... : pci_dev still NULL \n");
+			err ("ERROR... : pci_dev still NULL\n");
 			return 0;
 		}
 	}
@@ -883,7 +883,7 @@
 	struct pci_dev *dev = NULL;
 	int retval;
 
-	debug ("%s - entry slot # %d \n", __FUNCTION__, slot_cur->number);
+	debug ("%s - entry slot # %d\n", __FUNCTION__, slot_cur->number);
 	if (SET_BUS_STATUS (slot_cur->ctrl) && is_bus_empty (slot_cur)) {
 		rc = slot_update (&slot_cur);
 		if (rc)
@@ -934,12 +934,12 @@
 				cmd = HPC_BUS_133PCIXMODE;
 				break;
 			default:
-				err ("Wrong bus speed \n");
+				err ("Wrong bus speed\n");
 				return -ENODEV;
 			}
 			break;
 		default:
-			err ("wrong slot speed \n");
+			err ("wrong slot speed\n");
 			return -ENODEV;
 		}
 		debug ("setting bus speed for slot %d, cmd %x\n", slot_cur->number, cmd);
@@ -949,14 +949,14 @@
 			return retval;
 		}
 		if (CTLR_RESULT (slot_cur->ctrl->status)) {
-			err ("command not completed successfully in set_bus \n");
+			err ("command not completed successfully in set_bus\n");
 			return -EIO;
 		}
 	}
 	/* This is for x440, once Brandon fixes the firmware, 
 	will not need this delay */
 	long_delay (1 * HZ);
-	debug ("%s -Exit \n", __FUNCTION__);
+	debug ("%s -Exit\n", __FUNCTION__);
 	return 0;
 }
 
@@ -1009,13 +1009,13 @@
 {
 	info ("capability of the card is ");
 	if ((slot_cur->ext_status & CARD_INFO) == PCIX133) 
-		info ("   133 MHz PCI-X \n");
+		info ("   133 MHz PCI-X\n");
 	else if ((slot_cur->ext_status & CARD_INFO) == PCIX66)
-		info ("    66 MHz PCI-X \n");
+		info ("    66 MHz PCI-X\n");
 	else if ((slot_cur->ext_status & CARD_INFO) == PCI66)
-		info ("    66 MHz PCI \n");
+		info ("    66 MHz PCI\n");
 	else
-		info ("    33 MHz PCI \n");
+		info ("    33 MHz PCI\n");
 
 }
 
@@ -1033,11 +1033,11 @@
 
 	ibmphp_lock_operations ();
 
-	debug ("ENABLING SLOT........ \n");
+	debug ("ENABLING SLOT........\n");
 	slot_cur = (struct slot *) hs->private;
 
 	if ((rc = validate (slot_cur, ENABLE))) {
-		err ("validate function failed \n");
+		err ("validate function failed\n");
 		goto error_nopower;
 	}
 
@@ -1045,13 +1045,13 @@
 	
 	rc = set_bus (slot_cur);
 	if (rc) {
-		err ("was not able to set the bus \n");
+		err ("was not able to set the bus\n");
 		goto error_nopower;
 	}
 
 	/*-----------------debugging------------------------------*/
 	get_cur_bus_info (&slot_cur);
-	debug ("the current bus speed right after set_bus = %x \n", slot_cur->bus_on->current_speed); 
+	debug ("the current bus speed right after set_bus = %x\n", slot_cur->bus_on->current_speed); 
 	/*----------------------------------------------------------*/
 
 	rc = check_limitations (slot_cur);
@@ -1059,7 +1059,7 @@
 		err ("Adding this card exceeds the limitations of this bus.\n");
 		err ("(i.e., >1 133MHz cards running on same bus, or "
 		     ">2 66 PCI cards running on same bus\n.");
-		err ("Try hot-adding into another bus \n");
+		err ("Try hot-adding into another bus\n");
 		rc = -EINVAL;
 		goto error_nopower;
 	}
@@ -1079,12 +1079,12 @@
 		}
 		/* Check to see the error of why it failed */
 		if ((SLOT_POWER (slot_cur->status)) && !(SLOT_PWRGD (slot_cur->status)))
-			err ("power fault occurred trying to power up \n");
+			err ("power fault occurred trying to power up\n");
 		else if (SLOT_BUS_SPEED (slot_cur->status)) {
-			err ("bus speed mismatch occurred.  please check current bus speed and card capability \n");
+			err ("bus speed mismatch occurred.  please check current bus speed and card capability\n");
 			print_card_capability (slot_cur);
 		} else if (SLOT_BUS_MODE (slot_cur->ext_status)) {
-			err ("bus mode mismatch occurred.  please check current bus mode and card capability \n");
+			err ("bus mode mismatch occurred.  please check current bus mode and card capability\n");
 			print_card_capability (slot_cur);
 		}
 		ibmphp_update_slot_info (slot_cur);
@@ -1093,7 +1093,7 @@
 	debug ("after power_on\n");
 	/*-----------------------debugging---------------------------*/
 	get_cur_bus_info (&slot_cur);
-	debug ("the current bus speed right after power_on = %x \n", slot_cur->bus_on->current_speed);
+	debug ("the current bus speed right after power_on = %x\n", slot_cur->bus_on->current_speed);
 	/*----------------------------------------------------------*/
 
 	rc = slot_update (&slot_cur);
@@ -1102,17 +1102,17 @@
 	
 	rc = -EINVAL;
 	if (SLOT_POWER (slot_cur->status) && !(SLOT_PWRGD (slot_cur->status))) {
-		err ("power fault occurred trying to power up... \n");
+		err ("power fault occurred trying to power up...\n");
 		goto error_power;
 	}
 	if (SLOT_POWER (slot_cur->status) && (SLOT_BUS_SPEED (slot_cur->status))) {
-		err ("bus speed mismatch occurred.  please check current bus speed and card capability \n");
+		err ("bus speed mismatch occurred.  please check current bus speed and card capability\n");
 		print_card_capability (slot_cur);
 		goto error_power;
 	} 
 	/* Don't think this case will happen after above checks... but just in case, for paranoia sake */
 	if (!(SLOT_POWER (slot_cur->status))) {
-		err ("power on failed... \n");
+		err ("power on failed...\n");
 		goto error_power;
 	}
 
@@ -1120,7 +1120,7 @@
 	if (!slot_cur->func) {
 		/* We cannot do update_slot_info here, since no memory for
 		 * kmalloc n.e.ways, and update_slot_info allocates some */
-		err ("out of system memory \n");
+		err ("out of system memory\n");
 		rc = -ENOMEM;
 		goto error_power;
 	}
@@ -1133,7 +1133,7 @@
 	debug ("b4 configure_card, slot_cur->bus = %x, slot_cur->device = %x\n", slot_cur->bus, slot_cur->device);
 
 	if (ibmphp_configure_card (slot_cur->func, slot_cur->number)) {
-		err ("configure_card was unsuccessful... \n");
+		err ("configure_card was unsuccessful...\n");
 		ibmphp_unconfigure_card (&slot_cur, 1); /* true because don't need to actually deallocate resources, just remove references */
 		debug ("after unconfigure_card\n");
 		slot_cur->func = NULL;
@@ -1204,7 +1204,7 @@
 	int rc;
 	u8 flag;
 
-	debug ("DISABLING SLOT... \n"); 
+	debug ("DISABLING SLOT...\n"); 
 		
 	if ((slot_cur == NULL) || (slot_cur->ctrl == NULL)) {
 		return -ENODEV;
@@ -1224,7 +1224,7 @@
 		/* We need this for fncs's that were there on bootup */
 		slot_cur->func = (struct pci_func *) kmalloc (sizeof (struct pci_func), GFP_KERNEL);
 		if (!slot_cur->func) {
-			err ("out of system memory \n");
+			err ("out of system memory\n");
 			rc = -ENOMEM;
 			goto error;
 		}
@@ -1306,15 +1306,15 @@
 static void ibmphp_unload (void)
 {
 	free_slots ();
-	debug ("after slots \n");
+	debug ("after slots\n");
 	ibmphp_free_resources ();
-	debug ("after resources \n");
+	debug ("after resources\n");
 	ibmphp_free_bus_info_queue ();
-	debug ("after bus info \n");
+	debug ("after bus info\n");
 	ibmphp_free_ebda_hpc_queue ();
-	debug ("after ebda hpc \n");
+	debug ("after ebda hpc\n");
 	ibmphp_free_ebda_pci_rsrc_queue ();
-	debug ("after ebda pci rsrc \n");
+	debug ("after ebda pci rsrc\n");
 	kfree (ibmphp_pci_bus);
 }
 
diff -Nru a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c
--- a/drivers/pci/hotplug/ibmphp_ebda.c	Mon Feb  9 14:59:18 2004
+++ b/drivers/pci/hotplug/ibmphp_ebda.c	Mon Feb  9 14:59:18 2004
@@ -171,7 +171,7 @@
 {
 	struct rio_detail *ptr;
 	struct list_head *ptr1;
-	debug ("print_lo_info ---- \n");	
+	debug ("print_lo_info ----\n");	
 	list_for_each (ptr1, &rio_lo_head) {
 		ptr = list_entry (ptr1, struct rio_detail, rio_detail_list);
 		debug ("%s - rio_node_id = %x\n", __FUNCTION__, ptr->rio_node_id);
@@ -188,7 +188,7 @@
 {
 	struct rio_detail *ptr;
 	struct list_head *ptr1;
-	debug ("%s --- \n", __FUNCTION__);
+	debug ("%s ---\n", __FUNCTION__);
 	list_for_each (ptr1, &rio_vg_head) {
 		ptr = list_entry (ptr1, struct rio_detail, rio_detail_list);
 		debug ("%s - rio_node_id = %x\n", __FUNCTION__, ptr->rio_node_id);
@@ -220,7 +220,7 @@
 
 	list_for_each (ptr1, &ibmphp_slot_head) {
 		ptr = list_entry (ptr1, struct slot, ibm_slot_list);
-		debug ("%s - slot_number: %x \n", __FUNCTION__, ptr->number); 
+		debug ("%s - slot_number: %x\n", __FUNCTION__, ptr->number); 
 	}
 }
 
@@ -228,13 +228,13 @@
 {
 	struct opt_rio *ptr;
 	struct list_head *ptr1;
-	debug ("%s --- \n", __FUNCTION__);
+	debug ("%s ---\n", __FUNCTION__);
 	list_for_each (ptr1, &opt_vg_head) {
 		ptr = list_entry (ptr1, struct opt_rio, opt_rio_list);
-		debug ("%s - rio_type %x \n", __FUNCTION__, ptr->rio_type); 
-		debug ("%s - chassis_num: %x \n", __FUNCTION__, ptr->chassis_num); 
-		debug ("%s - first_slot_num: %x \n", __FUNCTION__, ptr->first_slot_num); 
-		debug ("%s - middle_num: %x \n", __FUNCTION__, ptr->middle_num); 
+		debug ("%s - rio_type %x\n", __FUNCTION__, ptr->rio_type); 
+		debug ("%s - chassis_num: %x\n", __FUNCTION__, ptr->chassis_num); 
+		debug ("%s - first_slot_num: %x\n", __FUNCTION__, ptr->first_slot_num); 
+		debug ("%s - middle_num: %x\n", __FUNCTION__, ptr->middle_num); 
 	}
 }
 
@@ -670,7 +670,7 @@
 	u8 flag = 0;
 
 	if (!slot_cur) {
-		err ("Structure passed is empty \n");
+		err ("Structure passed is empty\n");
 		return NULL;
 	}
 	
@@ -1269,14 +1269,14 @@
 	struct controller *ctrl;
 	struct list_head *tmp;
 
-	debug ("inside ibmphp_probe \n");
+	debug ("inside ibmphp_probe\n");
 	
 	list_for_each (tmp, &ebda_hpc_head) {
 		ctrl = list_entry (tmp, struct controller, ebda_hpc_list);
 		if (ctrl->ctlr_type == 1) {
 			if ((dev->devfn == ctrl->u.pci_ctlr.dev_fun) && (dev->bus->number == ctrl->u.pci_ctlr.bus)) {
 				ctrl->ctrl_dev = dev;
-				debug ("found device!!! \n");
+				debug ("found device!!!\n");
 				debug ("dev->device = %x, dev->subsystem_device = %x\n", dev->device, dev->subsystem_device);
 				return 0;
 			}
diff -Nru a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
--- a/drivers/pci/hotplug/ibmphp_pci.c	Mon Feb  9 14:59:18 2004
+++ b/drivers/pci/hotplug/ibmphp_pci.c	Mon Feb  9 14:59:18 2004
@@ -92,7 +92,7 @@
 	u8 flag;
 	u8 valid_device = 0x00; /* to see if we are able to read from card any device info at all */
 
-	debug ("inside configure_card, func->busno = %x \n", func->busno);
+	debug ("inside configure_card, func->busno = %x\n", func->busno);
 
 	device = func->device;
 	cur_func = func;
@@ -130,7 +130,7 @@
 			pci_bus_read_config_dword (ibmphp_pci_bus, devfn, PCI_CLASS_REVISION, &class);
 
 			class_code = class >> 24;
-			debug ("hrd_type = %x, class = %x, class_code %x \n", hdr_type, class, class_code);
+			debug ("hrd_type = %x, class = %x, class_code %x\n", hdr_type, class, class_code);
 			class >>= 8;	/* to take revision out, class = class.subclass.prog i/f */
 			if (class == PCI_CLASS_NOT_DEFINED_VGA) {
 				err ("The device %x is VGA compatible and as is not supported for hot plugging. "
@@ -147,7 +147,7 @@
 					assign_alt_irq (cur_func, class_code);
 					if ((rc = configure_device (cur_func)) < 0) {
 						/* We need to do this in case some other BARs were properly inserted */
-						err ("was not able to configure devfunc %x on bus %x. \n",
+						err ("was not able to configure devfunc %x on bus %x.\n",
 						     cur_func->device, cur_func->busno);
 						cleanup_count = 6;
 						goto error;
@@ -166,7 +166,7 @@
 					}
 					newfunc = (struct pci_func *) kmalloc (sizeof (struct pci_func), GFP_KERNEL);
 					if (!newfunc) {
-						err ("out of system memory \n");
+						err ("out of system memory\n");
 						return -ENOMEM;
 					}
 					memset (newfunc, 0, sizeof (struct pci_func));
@@ -188,7 +188,7 @@
 					rc = configure_bridge (&cur_func, slotno);
 					if (rc == -ENODEV) {
 						err ("You chose to insert Single Bridge, or nested bridges, this is not supported...\n");
-						err ("Bus %x, devfunc %x \n", cur_func->busno, cur_func->device);
+						err ("Bus %x, devfunc %x\n", cur_func->busno, cur_func->device);
 						return rc;
 					}
 					if (rc) {
@@ -205,7 +205,7 @@
 						if (func->devices[i]) {
 							newfunc = (struct pci_func *) kmalloc (sizeof (struct pci_func), GFP_KERNEL);
 							if (!newfunc) {
-								err ("out of system memory \n");
+								err ("out of system memory\n");
 								return -ENOMEM;
 							}
 							memset (newfunc, 0, sizeof (struct pci_func));
@@ -234,7 +234,7 @@
 
 					newfunc = (struct pci_func *) kmalloc (sizeof (struct pci_func), GFP_KERNEL);
 					if (!newfunc) {
-						err ("out of system memory \n");
+						err ("out of system memory\n");
 						return -ENOMEM;
 					}
 					memset (newfunc, 0, sizeof (struct pci_func));
@@ -261,7 +261,7 @@
 					rc = configure_bridge (&cur_func, slotno);
 					if (rc == -ENODEV) {
 						err ("You chose to insert Single Bridge, or nested bridges, this is not supported...\n");
-						err ("Bus %x, devfunc %x \n", cur_func->busno, cur_func->device);
+						err ("Bus %x, devfunc %x\n", cur_func->busno, cur_func->device);
 						return rc;
 					}
 					if (rc) {
@@ -281,7 +281,7 @@
 							debug ("inside for loop, device is %x\n", i);
 							newfunc = (struct pci_func *) kmalloc (sizeof (struct pci_func), GFP_KERNEL);
 							if (!newfunc) {
-								err (" out of system memory \n");
+								err (" out of system memory\n");
 								return -ENOMEM;
 							}
 							memset (newfunc, 0, sizeof (struct pci_func));
@@ -408,7 +408,7 @@
 			io[count] = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 
 			if (!io[count]) {
-				err ("out of system memory \n");
+				err ("out of system memory\n");
 				return -ENOMEM;
 			}
 			memset (io[count], 0, sizeof (struct resource_node));
@@ -446,7 +446,7 @@
 
 				pfmem[count] = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 				if (!pfmem[count]) {
-					err ("out of system memory \n");
+					err ("out of system memory\n");
 					return -ENOMEM;
 				}
 				memset (pfmem[count], 0, sizeof (struct resource_node));
@@ -461,7 +461,7 @@
 				} else {
 					mem_tmp = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 					if (!mem_tmp) {
-						err ("out of system memory \n");
+						err ("out of system memory\n");
 						kfree (pfmem[count]);
 						return -ENOMEM;
 					}
@@ -513,7 +513,7 @@
 
 				mem[count] = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 				if (!mem[count]) {
-					err ("out of system memory \n");
+					err ("out of system memory\n");
 					return -ENOMEM;
 				}
 				memset (mem[count], 0, sizeof (struct resource_node));
@@ -620,7 +620,7 @@
 	/* in EBDA, only get allocated 1 additional bus # per slot */
 	sec_number = find_sec_number (func->busno, slotno);
 	if (sec_number == 0xff) {
-		err ("cannot allocate secondary bus number for the bridged device \n");
+		err ("cannot allocate secondary bus number for the bridged device\n");
 		return -EINVAL;
 	}
 
@@ -678,7 +678,7 @@
 			bus_io[count] = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 		
 			if (!bus_io[count]) {
-				err ("out of system memory \n");
+				err ("out of system memory\n");
 				retval = -ENOMEM;
 				goto error;
 			}
@@ -710,7 +710,7 @@
 
 				bus_pfmem[count] = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 				if (!bus_pfmem[count]) {
-					err ("out of system memory \n");
+					err ("out of system memory\n");
 					retval = -ENOMEM;
 					goto error;
 				}
@@ -726,7 +726,7 @@
 				} else {
 					mem_tmp = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 					if (!mem_tmp) {
-						err ("out of system memory \n");
+						err ("out of system memory\n");
 						retval = -ENOMEM;
 						goto error;
 					}
@@ -768,7 +768,7 @@
 
 				bus_mem[count] = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 				if (!bus_mem[count]) {
-					err ("out of system memory \n");
+					err ("out of system memory\n");
 					retval = -ENOMEM;
 					goto error;
 				}
@@ -813,7 +813,7 @@
 	debug ("amount_needed->pfmem =  %x\n", amount_needed->pfmem);
 
 	if (amount_needed->not_correct) {		
-		debug ("amount_needed is not correct \n");
+		debug ("amount_needed is not correct\n");
 		for (count = 0; address[count]; count++) {
 			/* for 2 BARs */
 			if (bus_io[count]) {
@@ -835,11 +835,11 @@
 		debug ("it doesn't want IO?\n");
 		flag_io = TRUE;
 	} else {
-		debug ("it wants %x IO behind the bridge \n", amount_needed->io);
+		debug ("it wants %x IO behind the bridge\n", amount_needed->io);
 		io = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 		
 		if (!io) {
-			err ("out of system memory \n");
+			err ("out of system memory\n");
 			retval = -ENOMEM;
 			goto error;
 		}
@@ -862,7 +862,7 @@
 		debug ("it wants %x memory behind the bridge\n", amount_needed->mem);
 		mem = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 		if (!mem) {
-			err ("out of system memory \n");
+			err ("out of system memory\n");
 			retval = -ENOMEM;
 			goto error;
 		}
@@ -885,7 +885,7 @@
 		debug ("it wants %x pfmemory behind the bridge\n", amount_needed->pfmem);
 		pfmem = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 		if (!pfmem) {
-			err ("out of system memory \n");
+			err ("out of system memory\n");
 			retval = -ENOMEM;
 			goto error;
 		}
@@ -901,7 +901,7 @@
 		} else {
 			mem_tmp = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 			if (!mem_tmp) {
-				err ("out of system memory \n");
+				err ("out of system memory\n");
 				retval = -ENOMEM;
 				goto error;
 			}
@@ -933,7 +933,7 @@
 		if (!bus) {
 			bus = kmalloc (sizeof (struct bus_node), GFP_KERNEL);
 			if (!bus) {
-				err ("out of system memory \n");
+				err ("out of system memory\n");
 				retval = -ENOMEM;
 				goto error;
 			}
@@ -944,7 +944,7 @@
 		} else if (!(bus->rangeIO) && !(bus->rangeMem) && !(bus->rangePFMem))
 			rc = add_new_bus (bus, io, mem, pfmem, 0xFF);
 		else {
-			err ("expected bus structure not empty? \n");
+			err ("expected bus structure not empty?\n");
 			retval = -EIO;
 			goto error;
 		}
@@ -1050,7 +1050,7 @@
 		kfree (amount_needed);
 		return 0;
 	} else {
-		err ("Configuring bridge was unsuccessful... \n");
+		err ("Configuring bridge was unsuccessful...\n");
 		mem_tmp = NULL;
 		retval = -EIO;
 		goto error;
@@ -1171,7 +1171,7 @@
 
 					//tmp_bar = bar[count];
 
-					debug ("count %d device %x function %x wants %x resources \n", count, device, function, bar[count]);
+					debug ("count %d device %x function %x wants %x resources\n", count, device, function, bar[count]);
 
 					if (bar[count] & PCI_BASE_ADDRESS_SPACE_IO) {
 						/* This is IO */
@@ -1522,7 +1522,7 @@
 				case PCI_HEADER_TYPE_NORMAL:
 					rc = unconfigure_boot_device (busno, device, function);
 					if (rc) {
-						err ("was not able to unconfigure device %x func %x on bus %x. bailing out... \n",
+						err ("was not able to unconfigure device %x func %x on bus %x. bailing out...\n",
 						     device, function, busno);
 						return rc;
 					}
@@ -1531,7 +1531,7 @@
 				case PCI_HEADER_TYPE_MULTIDEVICE:
 					rc = unconfigure_boot_device (busno, device, function);
 					if (rc) {
-						err ("was not able to unconfigure device %x func %x on bus %x. bailing out... \n",
+						err ("was not able to unconfigure device %x func %x on bus %x. bailing out...\n",
 						     device, function, busno);
 						return rc;
 					}
@@ -1567,7 +1567,7 @@
 					}
 					break;
 				default:
-					err ("MAJOR PROBLEM!!!! Cannot read device's header \n");
+					err ("MAJOR PROBLEM!!!! Cannot read device's header\n");
 					return -1;
 					break;
 			}	/* end of switch */
@@ -1575,7 +1575,7 @@
 	}	/* end of for */
 
 	if (!valid_device) {
-		err ("Could not find device to unconfigure.  Or could not read the card. \n");
+		err ("Could not find device to unconfigure.  Or could not read the card.\n");
 		return -1;
 	}
 	return 0;
@@ -1623,19 +1623,19 @@
 
 			for (i = 0; i < count; i++) {
 				if (cur_func->io[i]) {
-					debug ("io[%d] exists \n", i);
+					debug ("io[%d] exists\n", i);
 					if (the_end > 0)
 						ibmphp_remove_resource (cur_func->io[i]);
 					cur_func->io[i] = NULL;
 				}
 				if (cur_func->mem[i]) {
-					debug ("mem[%d] exists \n", i);
+					debug ("mem[%d] exists\n", i);
 					if (the_end > 0)
 						ibmphp_remove_resource (cur_func->mem[i]);
 					cur_func->mem[i] = NULL;
 				}
 				if (cur_func->pfmem[i]) {
-					debug ("pfmem[%d] exists \n", i);
+					debug ("pfmem[%d] exists\n", i);
 					if (the_end > 0)
 						ibmphp_remove_resource (cur_func->pfmem[i]);
 					cur_func->pfmem[i] = NULL;
@@ -1682,7 +1682,7 @@
 	if (io) {
 		io_range = kmalloc (sizeof (struct range_node), GFP_KERNEL);
 		if (!io_range) {
-			err ("out of system memory \n");
+			err ("out of system memory\n");
 			return -ENOMEM;
 		}
 		memset (io_range, 0, sizeof (struct range_node));
@@ -1695,7 +1695,7 @@
 	if (mem) {
 		mem_range = kmalloc (sizeof (struct range_node), GFP_KERNEL);
 		if (!mem_range) {
-			err ("out of system memory \n");
+			err ("out of system memory\n");
 			return -ENOMEM;
 		}
 		memset (mem_range, 0, sizeof (struct range_node));
@@ -1708,7 +1708,7 @@
 	if (pfmem) {
 		pfmem_range = kmalloc (sizeof (struct range_node), GFP_KERNEL);
 		if (!pfmem_range) {	
-			err ("out of system memory \n");
+			err ("out of system memory\n");
 			return -ENOMEM;
 		}
 		memset (pfmem_range, 0, sizeof (struct range_node));
diff -Nru a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c
--- a/drivers/pci/hotplug/ibmphp_res.c	Mon Feb  9 14:59:18 2004
+++ b/drivers/pci/hotplug/ibmphp_res.c	Mon Feb  9 14:59:18 2004
@@ -52,13 +52,13 @@
 	struct bus_node * newbus;
 
 	if (!(curr) && !(flag)) {
-		err ("NULL pointer passed \n");
+		err ("NULL pointer passed\n");
 		return NULL;
 	}
 
 	newbus = kmalloc (sizeof (struct bus_node), GFP_KERNEL);
 	if (!newbus) {
-		err ("out of system memory \n");
+		err ("out of system memory\n");
 		return NULL;
 	}
 
@@ -76,13 +76,13 @@
 	struct resource_node *rs;
 	
 	if (!curr) {
-		err ("NULL passed to allocate \n");
+		err ("NULL passed to allocate\n");
 		return NULL;
 	}
 
 	rs = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 	if (!rs) {
-		err ("out of system memory \n");
+		err ("out of system memory\n");
 		return NULL;
 	}
 	memset (rs, 0, sizeof (struct resource_node));
@@ -103,7 +103,7 @@
 	if (first_bus) {
 		newbus = kmalloc (sizeof (struct bus_node), GFP_KERNEL);
 		if (!newbus) {
-			err ("out of system memory. \n");
+			err ("out of system memory.\n");
 			return -ENOMEM;
 		}
 		memset (newbus, 0, sizeof (struct bus_node));
@@ -127,7 +127,7 @@
 	if (!newrange) {
 		if (first_bus)
 			kfree (newbus);
-		err ("out of system memory \n");
+		err ("out of system memory\n");
 		return -ENOMEM;
 	}
 	memset (newrange, 0, sizeof (struct range_node));
@@ -607,7 +607,7 @@
 	debug ("%s - enter\n", __FUNCTION__);
 
 	if (!res) {
-		err ("NULL passed to add \n");
+		err ("NULL passed to add\n");
 		return -ENODEV;
 	}
 	
@@ -634,7 +634,7 @@
 			res_start = bus_cur->firstPFMem;
 			break;
 		default:
-			err ("cannot read the type of the resource to add... problem \n");
+			err ("cannot read the type of the resource to add... problem\n");
 			return -EINVAL;
 	}
 	while (range_cur) {
@@ -787,7 +787,7 @@
 	char * type = "";
 
 	if (!res)  {
-		err ("resource to remove is NULL \n");
+		err ("resource to remove is NULL\n");
 		return -ENODEV;
 	}
 
@@ -813,7 +813,7 @@
 			type = "pfmem";
 			break;
 		default:
-			err ("unknown type for resource to remove \n");
+			err ("unknown type for resource to remove\n");
 			return -EINVAL;
 	}
 	res_prev = NULL;
@@ -954,7 +954,7 @@
 			range = bus_cur->rangePFMem;
 			break;
 		default:
-			err ("cannot read resource type in find_range \n");
+			err ("cannot read resource type in find_range\n");
 	}
 
 	while (range) {
@@ -1002,7 +1002,7 @@
 
 	if (!bus_cur) {
 		/* didn't find a bus, smth's wrong!!! */
-		debug ("no bus in the system, either pci_dev's wrong or allocation failed \n");
+		debug ("no bus in the system, either pci_dev's wrong or allocation failed\n");
 		return -EINVAL;
 	}
 
@@ -1027,7 +1027,7 @@
 			noranges = bus_cur->noPFMemRanges;
 			break;
 		default:
-			err ("wrong type of resource to check \n");
+			err ("wrong type of resource to check\n");
 			return -EINVAL;
 	}
 	res_prev = NULL;
@@ -1496,7 +1496,7 @@
 	char * type = "";
 
 	if (!bus) {
-		err ("The bus passed in NULL to find resource \n");
+		err ("The bus passed in NULL to find resource\n");
 		return -ENODEV;
 	}
 
@@ -1514,7 +1514,7 @@
 			type = "pfmem";
 			break;
 		default:
-			err ("wrong type of flag \n");
+			err ("wrong type of flag\n");
 			return -EINVAL;
 	}
 	
@@ -1540,17 +1540,17 @@
 				res_cur = res_cur->next;
 			}
 			if (!res_cur) {
-				debug ("SOS...cannot find %s resource in the bus. \n", type);
+				debug ("SOS...cannot find %s resource in the bus.\n", type);
 				return -EINVAL;
 			}
 		} else {
-			debug ("SOS... cannot find %s resource in the bus. \n", type);
+			debug ("SOS... cannot find %s resource in the bus.\n", type);
 			return -EINVAL;
 		}
 	}
 
 	if (*res)
-		debug ("*res->start = %x \n", (*res)->start);
+		debug ("*res->start = %x\n", (*res)->start);
 
 	return 0;
 }
@@ -1708,7 +1708,7 @@
 
 				mem = kmalloc (sizeof (struct resource_node), GFP_KERNEL);		
 				if (!mem) {
-					err ("out of system memory \n");
+					err ("out of system memory\n");
 					return -ENOMEM;
 				}
 				memset (mem, 0, sizeof (struct resource_node));
@@ -1792,7 +1792,7 @@
 
 	list_for_each (tmp, &gbuses) {
 		bus_cur = list_entry (tmp, struct bus_node, bus_list);
-		debug_pci ("This is bus # %d.  There are \n", bus_cur->busno);
+		debug_pci ("This is bus # %d.  There are\n", bus_cur->busno);
 		debug_pci ("IORanges = %d\t", bus_cur->noIORanges);
 		debug_pci ("MemRanges = %d\t", bus_cur->noMemRanges);
 		debug_pci ("PFMemRanges = %d\n", bus_cur->noPFMemRanges);
@@ -1903,7 +1903,7 @@
 			range_cur = bus_cur->rangePFMem;
 			break;
 		default:
-			err ("wrong type passed to find out if range already exists \n");
+			err ("wrong type passed to find out if range already exists\n");
 			return -ENODEV;
 	}
 
@@ -1948,7 +1948,7 @@
 		return -ENODEV;
 	ibmphp_pci_bus->number = bus_cur->busno;
 
-	debug ("inside %s \n", __FUNCTION__);
+	debug ("inside %s\n", __FUNCTION__);
 	debug ("bus_cur->busno = %x\n", bus_cur->busno);
 
 	for (device = 0; device < 32; device++) {
@@ -1997,7 +1997,7 @@
 						if ((start_address) && (start_address <= end_address)) {
 							range = kmalloc (sizeof (struct range_node), GFP_KERNEL);
 							if (!range) {
-								err ("out of system memory \n");
+								err ("out of system memory\n");
 								return -ENOMEM;
 							}
 							memset (range, 0, sizeof (struct range_node));
@@ -2024,7 +2024,7 @@
 								io = kmalloc (sizeof (struct resource_node), GFP_KERNEL);							
 								if (!io) {
 									kfree (range);
-									err ("out of system memory \n");
+									err ("out of system memory\n");
 									return -ENOMEM;
 								}
 								memset (io, 0, sizeof (struct resource_node));
@@ -2048,7 +2048,7 @@
 
 							range = kmalloc (sizeof (struct range_node), GFP_KERNEL);
 							if (!range) {
-								err ("out of system memory \n");
+								err ("out of system memory\n");
 								return -ENOMEM;
 							}
 							memset (range, 0, sizeof (struct range_node));
@@ -2076,7 +2076,7 @@
 								mem = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 								if (!mem) {
 									kfree (range);
-									err ("out of system memory \n");
+									err ("out of system memory\n");
 									return -ENOMEM;
 								}
 								memset (mem, 0, sizeof (struct resource_node));
@@ -2104,7 +2104,7 @@
 
 							range = kmalloc (sizeof (struct range_node), GFP_KERNEL);
 							if (!range) {
-								err ("out of system memory \n");
+								err ("out of system memory\n");
 								return -ENOMEM;
 							}
 							memset (range, 0, sizeof (struct range_node));
@@ -2131,7 +2131,7 @@
 								pfmem = kmalloc (sizeof (struct resource_node), GFP_KERNEL);
 								if (!pfmem) {
 									kfree (range);
-									err ("out of system memory \n");
+									err ("out of system memory\n");
 									return -ENOMEM;
 								}
 								memset (pfmem, 0, sizeof (struct resource_node));


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22               ` Greg KH
@ 2004-02-09 23:22                 ` Greg KH
  2004-02-09 23:22                   ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.9, 2004/02/02 11:50:52-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI Hotplug: Kill useless instructions from ibmphp_core.c

This kills the explicit setting of rc to -ENODEV in 2 places where it is
not necessary because it will have this value on this path anyway.


 drivers/pci/hotplug/ibmphp_core.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)


diff -Nru a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
--- a/drivers/pci/hotplug/ibmphp_core.c	Mon Feb  9 14:59:13 2004
+++ b/drivers/pci/hotplug/ibmphp_core.c	Mon Feb  9 14:59:13 2004
@@ -418,8 +418,7 @@
 				rc = -ENODEV;
 			}
 		}
-	} else
-		rc = -ENODEV;
+	}
 
 	ibmphp_unlock_operations ();
 	debug ("%s - Exit rc[%d] value[%x]\n", __FUNCTION__, rc, *value);
@@ -465,8 +464,7 @@
 				}
 			}
 		}
-	} else
-		rc = -ENODEV;
+	}
 
 	ibmphp_unlock_operations ();
 	debug ("%s - Exit rc[%d] value[%x]\n", __FUNCTION__, rc, *value);


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                   ` Greg KH
@ 2004-02-09 23:22                     ` Greg KH
  2004-02-09 23:22                       ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.11, 2004/02/03 16:22:27-08:00, david-b@pacbell.net

[PATCH] PCI: dma_pool fixups


 Documentation/DMA-API.txt |   83 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/base/dmapool.c    |    6 +--
 2 files changed, 86 insertions(+), 3 deletions(-)


diff -Nru a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
--- a/Documentation/DMA-API.txt	Mon Feb  9 14:59:04 2004
+++ b/Documentation/DMA-API.txt	Mon Feb  9 14:59:04 2004
@@ -20,6 +20,10 @@
 To get the pci_ API, you must #include <linux/pci.h>
 To get the dma_ API, you must #include <linux/dma-mapping.h>
 
+
+Part Ia - Using large dma-coherent buffers
+------------------------------------------
+
 void *
 dma_alloc_coherent(struct device *dev, size_t size,
 			     dma_addr_t *dma_handle, int flag)
@@ -42,6 +46,7 @@
 Note: consistent memory can be expensive on some platforms, and the
 minimum allocation length may be as big as a page, so you should
 consolidate your requests for consistent memory as much as possible.
+The simplest way to do that is to use the dma_pool calls (see below).
 
 The flag parameter (dma_alloc_coherent only) allows the caller to
 specify the GFP_ flags (see kmalloc) for the allocation (the
@@ -61,6 +66,79 @@
 consistent allocate.  cpu_addr must be the virtual address returned by
 the consistent allocate
 
+
+Part Ib - Using small dma-coherent buffers
+------------------------------------------
+
+To get this part of the dma_ API, you must #include <linux/dmapool.h>
+
+Many drivers need lots of small dma-coherent memory regions for DMA
+descriptors or I/O buffers.  Rather than allocating in units of a page
+or more using dma_alloc_coherent(), you can use DMA pools.  These work
+much like a kmem_cache_t, except that they use the dma-coherent allocator
+not __get_free_pages().  Also, they understand common hardware constraints
+for alignment, like queue heads needing to be aligned on N byte boundaries.
+
+
+	struct dma_pool *
+	dma_pool_create(const char *name, struct device *dev,
+			size_t size, size_t align, size_t alloc);
+
+	struct pci_pool *
+	pci_pool_create(const char *name, struct pci_device *dev,
+			size_t size, size_t align, size_t alloc);
+
+The pool create() routines initialize a pool of dma-coherent buffers
+for use with a given device.  It must be called in a context which
+can sleep.
+
+The "name" is for diagnostics (like a kmem_cache_t name); dev and size
+are like what you'd pass to dma_alloc_coherent().  The device's hardware
+alignment requirement for this type of data is "align" (which is expressed
+in bytes, and must be a power of two).  If your device has no boundary
+crossing restrictions, pass 0 for alloc; passing 4096 says memory allocated
+from this pool must not cross 4KByte boundaries.
+
+
+	void *dma_pool_alloc(struct dma_pool *pool, int gfp_flags,
+			dma_addr_t *dma_handle);
+
+	void *pci_pool_alloc(struct pci_pool *pool, int gfp_flags,
+			dma_addr_t *dma_handle);
+
+This allocates memory from the pool; the returned memory will meet the size
+and alignment requirements specified at creation time.  Pass GFP_ATOMIC to
+prevent blocking, or if it's permitted (not in_interrupt, not holding SMP locks)
+pass GFP_KERNEL to allow blocking.  Like dma_alloc_coherent(), this returns
+two values:  an address usable by the cpu, and the dma address usable by the
+pool's device.
+
+
+	void dma_pool_free(struct dma_pool *pool, void *vaddr,
+			dma_addr_t addr);
+
+	void pci_pool_free(struct pci_pool *pool, void *vaddr,
+			dma_addr_t addr);
+
+This puts memory back into the pool.  The pool is what was passed to
+the the pool allocation routine; the cpu and dma addresses are what
+were returned when that routine allocated the memory being freed.
+
+
+	void dma_pool_destroy(struct dma_pool *pool);
+
+	void pci_pool_destroy(struct pci_pool *pool);
+
+The pool destroy() routines free the resources of the pool.  They must be
+called in a context which can sleep.  Make sure you've freed all allocated
+memory back to the pool before you destroy it.  While pci_pool_destroy()
+may not be called in interrupt context, it's perfectly safe to do that with
+dma_pool_destroy().
+
+
+Part Ic - DMA addressing limitations
+------------------------------------
+
 int
 dma_supported(struct device *dev, u64 mask)
 int
@@ -86,6 +164,10 @@
 
 Returns: 1 if successful and 0 if not
 
+
+Part Id - Streaming DMA mappings
+--------------------------------
+
 dma_addr_t
 dma_map_single(struct device *dev, void *cpu_addr, size_t size,
 		      enum dma_data_direction direction)
@@ -253,6 +335,7 @@
   DMA_BIDIRECTIONAL
 
 See also dma_map_single().
+
 
 Part II - Advanced dma_ usage
 -----------------------------
diff -Nru a/drivers/base/dmapool.c b/drivers/base/dmapool.c
--- a/drivers/base/dmapool.c	Mon Feb  9 14:59:04 2004
+++ b/drivers/base/dmapool.c	Mon Feb  9 14:59:04 2004
@@ -257,7 +257,7 @@
 /**
  * dma_pool_alloc - get a block of consistent memory
  * @pool: dma pool that will produce the block
- * @mem_flags: SLAB_KERNEL or SLAB_ATOMIC
+ * @mem_flags: GFP_* bitmask
  * @handle: pointer to dma address of block
  *
  * This returns the kernel virtual address of a currently unused block,
@@ -295,7 +295,7 @@
 		}
 	}
 	if (!(page = pool_alloc_page (pool, SLAB_ATOMIC))) {
-		if (mem_flags == SLAB_KERNEL) {
+		if (mem_flags & __GFP_WAIT) {
 			DECLARE_WAITQUEUE (wait, current);
 
 			current->state = TASK_INTERRUPTIBLE;
@@ -409,7 +409,7 @@
 	/*
 	 * Resist a temptation to do
 	 *    if (!is_page_busy(bpp, page->bitmap)) pool_free_page(pool, page);
-	 * it is not interrupt safe. Better have empty pages hang around.
+	 * Better have a few empty pages hang around.
 	 */
 	spin_unlock_irqrestore (&pool->lock, flags);
 }


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                 ` Greg KH
@ 2004-02-09 23:22                   ` Greg KH
  2004-02-09 23:22                     ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.10, 2004/02/02 12:19:50-08:00, dlsy@snoqualmie.dp.intel.com

[PATCH] PCI: Patch to get cpqphp working with IOAPIC

Here is a patch for to get cpqphp working with IOAPIC.
My earlier statement that a kernel patch is not needed for 2.6 is
true only when ACPI is enabled.  A similar patch is needed in
pcibios_enable_irq() for 2.4 kernel and I will send it out
later.

The fix is in pirq_enable_irq().  This function is called indirectly
by pci_enable_device().  For device present during boot up, it should
get the proper dev->irq for pcibios_fixup_irqs() has been called to
get the dev->irq from MP table. If the value is still zero, then
this is properly caused by "buggy MP table".  For hot-plug device,
its dev->irq is 0 when the pci_enable_device() is called for it hasn't
gone through the fixup.  Therefore, the code (similiar to the code
in pcibios_fixup_irqs) is needed here.


 arch/i386/pci/irq.c               |   44 +++++++++++++++++++++++++++++++++++---
 drivers/pci/hotplug/cpqphp_ctrl.c |    4 ++-
 drivers/pci/hotplug/cpqphp_pci.c  |    2 +
 3 files changed, 46 insertions(+), 4 deletions(-)


diff -Nru a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
--- a/arch/i386/pci/irq.c	Mon Feb  9 14:59:09 2004
+++ b/arch/i386/pci/irq.c	Mon Feb  9 14:59:09 2004
@@ -943,12 +943,50 @@
 {
 	u8 pin;
 	extern int interrupt_line_quirk;
+	struct pci_dev *temp_dev;
+
 	pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
 	if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
 		char *msg;
-		if (io_apic_assign_pci_irqs)
-			msg = " Probably buggy MP table.";
-		else if (pci_probe & PCI_BIOS_IRQ_SCAN)
+		msg = "";
+		if (io_apic_assign_pci_irqs) {
+			int irq;
+
+			if (pin) {
+				pin--;		/* interrupt pins are numbered starting from 1 */
+				irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin);
+				/*
+				 * Busses behind bridges are typically not listed in the MP-table.
+				 * In this case we have to look up the IRQ based on the parent bus,
+				 * parent slot, and pin number. The SMP code detects such bridged
+				 * busses itself so we should get into this branch reliably.
+				 */
+				temp_dev = dev;
+				while (irq < 0 && dev->bus->parent) { /* go back to the bridge */
+					struct pci_dev * bridge = dev->bus->self;
+
+					pin = (pin + PCI_SLOT(dev->devfn)) % 4;
+					irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
+							PCI_SLOT(bridge->devfn), pin);
+					if (irq >= 0)
+						printk(KERN_WARNING "PCI: using PPB(B%d,I%d,P%d) to get irq %d\n", 
+							bridge->bus->number, PCI_SLOT(bridge->devfn), pin, irq);
+					dev = bridge;
+				}
+				dev = temp_dev;
+				if (irq >= 0) {
+#ifdef CONFIG_PCI_USE_VECTOR
+					if (!platform_legacy_irq(irq))
+						irq = IO_APIC_VECTOR(irq);
+#endif
+					printk(KERN_INFO "PCI->APIC IRQ transform: (B%d,I%d,P%d) -> %d\n",
+						dev->bus->number, PCI_SLOT(dev->devfn), pin, irq);
+					dev->irq = irq;
+					return 0;
+				} else
+					msg = " Probably buggy MP table.";
+			}
+		} else if (pci_probe & PCI_BIOS_IRQ_SCAN)
 			msg = "";
 		else
 			msg = " Please try using pci=biosirq.";
diff -Nru a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c
--- a/drivers/pci/hotplug/cpqphp_ctrl.c	Mon Feb  9 14:59:09 2004
+++ b/drivers/pci/hotplug/cpqphp_ctrl.c	Mon Feb  9 14:59:09 2004
@@ -2446,7 +2446,7 @@
 				   u8 behind_bridge, struct resource_lists * resources)
 {
 	int cloop;
-	u8 IRQ;
+	u8 IRQ = 0;
 	u8 temp_byte;
 	u8 device;
 	u8 class_code;
@@ -3021,6 +3021,7 @@
 			}
 		}		// End of base register loop
 
+#if !defined(CONFIG_X86_IO_APIC)
 		// Figure out which interrupt pin this function uses
 		rc = pci_bus_read_config_byte (pci_bus, devfn, PCI_INTERRUPT_PIN, &temp_byte);
 
@@ -3045,6 +3046,7 @@
 
 		// IRQ Line
 		rc = pci_bus_write_config_byte (pci_bus, devfn, PCI_INTERRUPT_LINE, IRQ);
+#endif
 
 		if (!behind_bridge) {
 			rc = cpqhp_set_irq(func->bus, func->device, temp_byte + 0x09, IRQ);
diff -Nru a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c
--- a/drivers/pci/hotplug/cpqphp_pci.c	Mon Feb  9 14:59:09 2004
+++ b/drivers/pci/hotplug/cpqphp_pci.c	Mon Feb  9 14:59:09 2004
@@ -151,6 +151,7 @@
  */
 int cpqhp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num)
 {
+#if !defined(CONFIG_X86_IO_APIC)	
 	int rc;
 	u16 temp_word;
 	struct pci_dev fakedev;
@@ -175,6 +176,7 @@
 	// This should only be for x86 as it sets the Edge Level Control Register
 	outb((u8) (temp_word & 0xFF), 0x4d0);
 	outb((u8) ((temp_word & 0xFF00) >> 8), 0x4d1);
+#endif
 
 	return 0;
 }


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                           ` Greg KH
@ 2004-02-09 23:22                             ` Greg KH
  2004-02-09 23:22                               ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.15, 2004/02/03 16:49:40-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI Hotplug: kill hpcrc from several functions in ibmphp_core.c

This patch kills the variable hpcrc from many places. It is used as a
temporary storage for the return code before this is copied to rc which
contains the "real" return code. There are some checks if to copy or not
but at the end they will always have the same value, so we can directly
put the return code in rc and kill hpcrc.


 drivers/pci/hotplug/ibmphp_core.c |   93 +++++++++++---------------------------
 1 files changed, 27 insertions(+), 66 deletions(-)


diff -Nru a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
--- a/drivers/pci/hotplug/ibmphp_core.c	Mon Feb  9 14:58:47 2004
+++ b/drivers/pci/hotplug/ibmphp_core.c	Mon Feb  9 14:58:47 2004
@@ -104,7 +104,7 @@
 	if (rc) 
 		return rc;
 	if (!init_flag)
-		return get_cur_bus_info (sl);
+		rc = get_cur_bus_info(sl);
 	return rc;
 }
 
@@ -208,7 +208,7 @@
 		err ("command not completed successfully in power_off\n");
 		retval = -EIO;
 	}
-	return 0;
+	return retval;
 }
 
 static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 value)
@@ -216,7 +216,6 @@
 	int rc = 0;
 	struct slot *pslot;
 	u8 cmd;
-	int hpcrc = 0;
 
 	debug ("set_attention_status - Entry hotplug_slot[%lx] value[%x]\n", (ulong) hotplug_slot, value);
 	ibmphp_lock_operations ();
@@ -241,16 +240,13 @@
 		if (rc == 0) {
 			pslot = (struct slot *) hotplug_slot->private;
 			if (pslot)
-				hpcrc = ibmphp_hpc_writeslot (pslot, cmd);
+				rc = ibmphp_hpc_writeslot(pslot, cmd);
 			else
 				rc = -ENODEV;
 		}
 	} else	
 		rc = -ENODEV;
 
-	if (hpcrc)
-		rc = hpcrc;
-
 	ibmphp_unlock_operations ();
 
 	debug ("set_attention_status - Exit rc[%d]\n", rc);
@@ -261,7 +257,6 @@
 {
 	int rc = -ENODEV;
 	struct slot *pslot;
-	int hpcrc = 0;
 	struct slot myslot;
 
 	debug ("get_attention_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong) hotplug_slot, (ulong) value);
@@ -271,22 +266,16 @@
 		pslot = (struct slot *) hotplug_slot->private;
 		if (pslot) {
 			memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
-			hpcrc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &(myslot.status));
-			if (!hpcrc)
-				hpcrc = ibmphp_hpc_readslot (pslot, READ_EXTSLOTSTATUS, &(myslot.ext_status));
-			if (!hpcrc) {
+			rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
+			if (!rc)
+				rc = ibmphp_hpc_readslot(pslot, READ_EXTSLOTSTATUS, &(myslot.ext_status));
+			if (!rc)
 				*value = SLOT_ATTN (myslot.status, myslot.ext_status);
-				rc = 0;
-			}
 		}
-	} else
-		rc = -ENODEV;
-
-	if (hpcrc)
-		rc = hpcrc;
+	}
 
 	ibmphp_unlock_operations ();
-	debug ("get_attention_status - Exit rc[%d] hpcrc[%x] value[%x]\n", rc, hpcrc, *value);
+	debug("get_attention_status - Exit rc[%d] value[%x]\n", rc, *value);
 	return rc;
 }
 
@@ -294,7 +283,6 @@
 {
 	int rc = -ENODEV;
 	struct slot *pslot;
-	int hpcrc = 0;
 	struct slot myslot;
 
 	debug ("get_latch_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong) hotplug_slot, (ulong) value);
@@ -303,20 +291,14 @@
 		pslot = (struct slot *) hotplug_slot->private;
 		if (pslot) {
 			memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
-			hpcrc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &(myslot.status));
-			if (!hpcrc) {
+			rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
+			if (!rc)
 				*value = SLOT_LATCH (myslot.status);
-				rc = 0;
-			}
 		}
-	} else
-		rc = -ENODEV;
-
-	if (hpcrc)
-		rc = hpcrc;
+	}
 
 	ibmphp_unlock_operations ();
-	debug ("get_latch_status - Exit rc[%d] hpcrc[%x] value[%x]\n", rc, hpcrc, *value);
+	debug("get_latch_status - Exit rc[%d] rc[%x] value[%x]\n", rc, rc, *value);
 	return rc;
 }
 
@@ -325,7 +307,6 @@
 {
 	int rc = -ENODEV;
 	struct slot *pslot;
-	int hpcrc = 0;
 	struct slot myslot;
 
 	debug ("get_power_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong) hotplug_slot, (ulong) value);
@@ -334,20 +315,14 @@
 		pslot = (struct slot *) hotplug_slot->private;
 		if (pslot) {
 			memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
-			hpcrc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &(myslot.status));
-			if (!hpcrc) {
+			rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
+			if (!rc)
 				*value = SLOT_PWRGD (myslot.status);
-				rc = 0;
-			}
 		}
-	} else
-		rc = -ENODEV;
-
-	if (hpcrc)
-		rc = hpcrc;
+	}
 
 	ibmphp_unlock_operations ();
-	debug ("get_power_status - Exit rc[%d] hpcrc[%x] value[%x]\n", rc, hpcrc, *value);
+	debug("get_power_status - Exit rc[%d] rc[%x] value[%x]\n", rc, rc, *value);
 	return rc;
 }
 
@@ -356,7 +331,6 @@
 	int rc = -ENODEV;
 	struct slot *pslot;
 	u8 present;
-	int hpcrc = 0;
 	struct slot myslot;
 
 	debug ("get_adapter_status - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong) hotplug_slot, (ulong) value);
@@ -365,23 +339,19 @@
 		pslot = (struct slot *) hotplug_slot->private;
 		if (pslot) {
 			memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
-			hpcrc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &(myslot.status));
-			if (!hpcrc) {
+			rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
+			if (!rc) {
 				present = SLOT_PRESENT (myslot.status);
 				if (present == HPC_SLOT_EMPTY)
 					*value = 0;
 				else
 					*value = 1;
-				rc = 0;
 			}
 		}
-	} else
-		rc = -ENODEV;
-	if (hpcrc)
-		rc = hpcrc;
+	}
 
 	ibmphp_unlock_operations ();
-	debug ("get_adapter_present - Exit rc[%d] hpcrc[%x] value[%x]\n", rc, hpcrc, *value);
+	debug("get_adapter_present - Exit rc[%d] value[%x]\n", rc, *value);
 	return rc;
 }
 
@@ -475,7 +445,6 @@
 {
 	int rc = -ENODEV;
 	struct slot *pslot;
-	int hpcrc = 0;
 	struct slot myslot;
 
 	debug ("get_max_adapter_speed_1 - Entry hotplug_slot[%lx] pvalue[%lx]\n", (ulong)hotplug_slot, (ulong) value);
@@ -487,29 +456,21 @@
 		pslot = (struct slot *) hotplug_slot->private;
 		if (pslot) {
 			memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
-			hpcrc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &(myslot.status));
+			rc = ibmphp_hpc_readslot(pslot, READ_SLOTSTATUS, &(myslot.status));
 
 			if (!(SLOT_LATCH (myslot.status)) && (SLOT_PRESENT (myslot.status))) {
-				hpcrc = ibmphp_hpc_readslot (pslot, READ_EXTSLOTSTATUS, &(myslot.ext_status));
-				if (!hpcrc) {
+				rc = ibmphp_hpc_readslot(pslot, READ_EXTSLOTSTATUS, &(myslot.ext_status));
+				if (!rc)
 					*value = SLOT_SPEED (myslot.ext_status);
-					rc = 0;
-				}
-			} else {
+			} else
 				*value = MAX_ADAPTER_NONE;
-				rc = 0;
-			}
                 }
-        } else
-		rc = -ENODEV;
-
-	if (hpcrc)
-		rc = hpcrc;
+	}
 
 	if (flag)
 		ibmphp_unlock_operations ();
 
-	debug ("get_max_adapter_speed_1 - Exit rc[%d] hpcrc[%x] value[%x]\n", rc, hpcrc, *value);
+	debug("get_max_adapter_speed_1 - Exit rc[%d] value[%x]\n", rc, *value);
 	return rc;
 }
 


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                         ` Greg KH
@ 2004-02-09 23:22                           ` Greg KH
  2004-02-09 23:22                             ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.14, 2004/02/03 16:49:23-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI Hotplug: very small optimisations for ibmphp_pci.c


 drivers/pci/hotplug/ibmphp_pci.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Nru a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
--- a/drivers/pci/hotplug/ibmphp_pci.c	Mon Feb  9 14:58:51 2004
+++ b/drivers/pci/hotplug/ibmphp_pci.c	Mon Feb  9 14:58:51 2004
@@ -49,7 +49,7 @@
  */
 static void assign_alt_irq (struct pci_func * cur_func, u8 class_code)
 {
-	int j = 0;
+	int j;
 	for (j = 0; j < 4; j++) {
 		if (cur_func->irq[j] == 0xff) {
 			switch (class_code) {


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                       ` Greg KH
@ 2004-02-09 23:22                         ` Greg KH
  2004-02-09 23:22                           ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.13, 2004/02/03 16:49:05-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI Hotplug: Coding style fixes for drivers/pci/hotplug.c


 drivers/pci/hotplug.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)


diff -Nru a/drivers/pci/hotplug.c b/drivers/pci/hotplug.c
--- a/drivers/pci/hotplug.c	Mon Feb  9 14:58:56 2004
+++ b/drivers/pci/hotplug.c	Mon Feb  9 14:58:56 2004
@@ -116,7 +116,7 @@
 	}
 
 	bus = wrapped_dev->dev->subordinate;
-	if(bus) {
+	if (bus) {
 		memset(&wrapped_bus, 0, sizeof(struct pci_bus_wrapped));
 		wrapped_bus.bus = bus;
 
@@ -130,8 +130,8 @@
  * Every bus and every function is presented to a custom
  * function that can act upon it.
  */
-int pci_visit_dev (struct pci_visit *fn, struct pci_dev_wrapped *wrapped_dev,
-		   struct pci_bus_wrapped *wrapped_parent)
+int pci_visit_dev(struct pci_visit *fn, struct pci_dev_wrapped *wrapped_dev,
+		  struct pci_bus_wrapped *wrapped_parent)
 {
 	struct pci_dev* dev = wrapped_dev ? wrapped_dev->dev : NULL;
 	int result = 0;


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                     ` Greg KH
@ 2004-02-09 23:22                       ` Greg KH
  2004-02-09 23:22                         ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.12, 2004/02/03 16:48:38-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI: avoid two returns directly after each other in pcidriver.c

This avoids a return direct before the final return of a function. Better
only modify the return code and fall through to the final return.


 drivers/pci/pci-driver.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Nru a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
--- a/drivers/pci/pci-driver.c	Mon Feb  9 14:59:00 2004
+++ b/drivers/pci/pci-driver.c	Mon Feb  9 14:59:00 2004
@@ -241,7 +241,7 @@
 		error = drv->probe(pci_dev, id);
 	if (error >= 0) {
 		pci_dev->driver = drv;
-		return 0;
+		error = 0;
 	}
 	return error;
 }


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                               ` Greg KH
@ 2004-02-09 23:22                                 ` Greg KH
  2004-02-09 23:22                                   ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.17, 2004/02/04 10:03:35-08:00, colpatch@us.ibm.com

[PATCH] PCI: fix "pcibus_class" Device Class, release function

John Rose wrote:
> The function release_pcibus_dev() in probe.c defines the release procedure for
> device class pcibus_class.  I want to suggest that this function be scrapped :)
>
> This release function is called in the code path of class_device_unregister().
> The pcibus_class devices aren't currently unregistered anywhere, from what I
> can tell, so this release function is currently unused.  The runtime removal of
> PCI buses from logical partitions on PPC64 requires the unregistration of these
> class devices.  The natural place to do this IMHO is in pci_remove_bus_device()
> in remove.c.

You're right that the class device isn't currently unregistered, and
that was an oversight in the patch I originally sent.  Attatched is a
patch that remedies that situation.  pci_remove_bus_device() *is* the
natural place to unregister the class_dev, and that's just what the
patch does.


> The problem is that this calls pci_destroy_dev(), which calls put() on the same
> "bridge" device that the release function does.  This should only be done once
> in the course of removing a pci_bus, and I doubt that we want to change
> pci_destroy_dev().   The kfree() of the pci_bus struct is also done in both
> pci_remove_bus_device() and release_pcibus_dev().

Yep.  The patch pulls the kfree() out of pci_remove_bus_device() and
calls class_device_unregister() in it's place.  This will put() the
bridge device and free the pci_bus as needed.  put() does need to be
called twice because the bridge device is get()'d twice: once when the
device is registered and once when it's bus device grabs a reference to it.


 drivers/pci/remove.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Nru a/drivers/pci/remove.c b/drivers/pci/remove.c
--- a/drivers/pci/remove.c	Mon Feb  9 14:58:38 2004
+++ b/drivers/pci/remove.c	Mon Feb  9 14:58:38 2004
@@ -83,7 +83,7 @@
 		list_del(&b->node);
 		spin_unlock(&pci_bus_lock);
 
-		kfree(b);
+		class_device_unregister(&b->class_dev);
 		dev->subordinate = NULL;
 	}
 


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                             ` Greg KH
@ 2004-02-09 23:22                               ` Greg KH
  2004-02-09 23:22                                 ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.16, 2004/02/03 16:54:54-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI Hotplug: make ibm_unconfigure_device void

ibm_unconfigure_device always returns 0, so we do not need to check for a
return value != 0 and can kill the warning. And if the return value is always
the same we don't need a return value. Also some whitespace fixing. And this
time not line wrapped. Really. Absolutely sure. Checked twice.


 drivers/pci/hotplug/ibmphp_core.c |   18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)


diff -Nru a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
--- a/drivers/pci/hotplug/ibmphp_core.c	Mon Feb  9 14:58:42 2004
+++ b/drivers/pci/hotplug/ibmphp_core.c	Mon Feb  9 14:58:42 2004
@@ -704,21 +704,20 @@
 	debug ("%s -- exit\n", __FUNCTION__);
 }
 
-static int ibm_unconfigure_device (struct pci_func *func)
+static void ibm_unconfigure_device(struct pci_func *func)
 {
 	struct pci_dev *temp;
 	u8 j;
 
-	debug ("inside %s\n", __FUNCTION__);
-	debug ("func->device = %x, func->function = %x\n", func->device, func->function);
-	debug ("func->device << 3 | 0x0  = %x\n", func->device << 3 | 0x0);
+	debug("inside %s\n", __FUNCTION__);
+	debug("func->device = %x, func->function = %x\n", func->device, func->function);
+	debug("func->device << 3 | 0x0  = %x\n", func->device << 3 | 0x0);
 
 	for (j = 0; j < 0x08; j++) {
-		temp = pci_find_slot (func->busno, (func->device << 3) | j);
+		temp = pci_find_slot(func->busno, (func->device << 3) | j);
 		if (temp)
 			pci_remove_bus_device(temp);
 	}
-	return 0;
 }
 
 /*
@@ -1192,12 +1191,7 @@
 		slot_cur->func->device = slot_cur->device;
 	}
 
-	if ((rc = ibm_unconfigure_device (slot_cur->func))) {
-		err ("removing from kernel failed... \n");
-		err ("Please check to see if it was statically linked or is "
-		     "in use otherwise. (perhaps the driver is not 'hot-removable')\n");
-		goto error;
-	}
+	ibm_unconfigure_device(slot_cur->func);
         
 	/* If we got here from latch suddenly opening on operating card or 
 	a power fault, there's no power to the card, so cannot


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                                   ` Greg KH
@ 2004-02-09 23:22                                     ` Greg KH
  2004-02-09 23:22                                       ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.19, 2004/02/04 17:23:50-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI Hotplug: mark functions __init/__exit in acpiphp

These functions are only called from places marked __init or __exit, so
we can mark them also.


 drivers/pci/hotplug/acpiphp_core.c |    6 +++---
 drivers/pci/hotplug/acpiphp_glue.c |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)


diff -Nru a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c
--- a/drivers/pci/hotplug/acpiphp_core.c	Mon Feb  9 14:58:29 2004
+++ b/drivers/pci/hotplug/acpiphp_core.c	Mon Feb  9 14:58:29 2004
@@ -374,7 +374,7 @@
 }
 
 
-static int init_acpi (void)
+static int __init init_acpi (void)
 {
 	int retval;
 
@@ -426,7 +426,7 @@
  * init_slots - initialize 'struct slot' structures for each slot
  *
  */
-static int init_slots (void)
+static int __init init_slots (void)
 {
 	struct slot *slot;
 	int retval = 0;
@@ -492,7 +492,7 @@
 }
 
 
-static void cleanup_slots (void)
+static void __exit cleanup_slots (void)
 {
 	struct list_head *tmp, *n;
 	struct slot *slot;
diff -Nru a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
--- a/drivers/pci/hotplug/acpiphp_glue.c	Mon Feb  9 14:58:29 2004
+++ b/drivers/pci/hotplug/acpiphp_glue.c	Mon Feb  9 14:58:29 2004
@@ -1056,7 +1056,7 @@
  * acpiphp_glue_init - initializes all PCI hotplug - ACPI glue data structures
  *
  */
-int acpiphp_glue_init (void)
+int __init acpiphp_glue_init(void)
 {
 	int num;
 
@@ -1077,7 +1077,7 @@
  *
  * This function frees all data allocated in acpiphp_glue_init()
  */
-void acpiphp_glue_exit (void)
+void __exit acpiphp_glue_exit(void)
 {
 	struct list_head *l1, *l2, *n1, *n2;
 	struct acpiphp_bridge *bridge;
@@ -1124,7 +1124,7 @@
 /**
  * acpiphp_get_num_slots - count number of slots in a system
  */
-int acpiphp_get_num_slots (void)
+int __init acpiphp_get_num_slots(void)
 {
 	struct list_head *node;
 	struct acpiphp_bridge *bridge;


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                                 ` Greg KH
@ 2004-02-09 23:22                                   ` Greg KH
  2004-02-09 23:22                                     ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.18, 2004/02/04 14:03:31-08:00, greg@kroah.com

[PATCH] dmapool: Remove sentance in documentation that is now false on 2.6


 Documentation/DMA-API.txt |    4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)


diff -Nru a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
--- a/Documentation/DMA-API.txt	Mon Feb  9 14:58:34 2004
+++ b/Documentation/DMA-API.txt	Mon Feb  9 14:58:34 2004
@@ -131,9 +131,7 @@
 
 The pool destroy() routines free the resources of the pool.  They must be
 called in a context which can sleep.  Make sure you've freed all allocated
-memory back to the pool before you destroy it.  While pci_pool_destroy()
-may not be called in interrupt context, it's perfectly safe to do that with
-dma_pool_destroy().
+memory back to the pool before you destroy it.
 
 
 Part Ic - DMA addressing limitations


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                                     ` Greg KH
@ 2004-02-09 23:22                                       ` Greg KH
  2004-02-09 23:22                                         ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.20, 2004/02/06 14:23:33-08:00, eike-hotplug@sf-tec.de

[PATCH] PCI Hotplug: Convert error paths in ibmphp to use goto

This patch converts the error paths in several functions in ibmphp to use
goto to the end of the function to kill code duplication.

It also kills some memsets of pointer members of a struct where the struct
itself is freed directly after.

This one has 2 modification from the first version: the if is back as
discussed and one extra long line (>> 150 chars) is wrapped now.


 drivers/pci/hotplug/ibmphp_ebda.c |   96 ++++++++++++++++----------------------
 1 files changed, 42 insertions(+), 54 deletions(-)


diff -Nru a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c
--- a/drivers/pci/hotplug/ibmphp_ebda.c	Mon Feb  9 14:58:25 2004
+++ b/drivers/pci/hotplug/ibmphp_ebda.c	Mon Feb  9 14:58:25 2004
@@ -89,36 +89,34 @@
 
 	controller = kmalloc (sizeof (struct controller), GFP_KERNEL);
 	if (!controller)
-		return NULL;
+		goto error;
 	memset (controller, 0, sizeof (*controller));
 
 	slots = kmalloc (sizeof (struct ebda_hpc_slot) * slot_count, GFP_KERNEL);
-	if (!slots) {
-		kfree (controller);
-		return NULL;
-	}
+	if (!slots)
+		goto error_contr;
 	memset (slots, 0, sizeof (*slots) * slot_count);
 	controller->slots = slots;
 
 	buses = kmalloc (sizeof (struct ebda_hpc_bus) * bus_count, GFP_KERNEL);
-	if (!buses) {
-		kfree (controller->slots);
-		kfree (controller);
-		return NULL;
-	}
+	if (!buses)
+		goto error_slots;
 	memset (buses, 0, sizeof (*buses) * bus_count);
 	controller->buses = buses;
 
 	return controller;
+error_slots:
+	kfree(controller->slots);
+error_contr:
+	kfree(controller);
+error:
+	return NULL;
 }
 
 static void free_ebda_hpc (struct controller *controller)
 {
 	kfree (controller->slots);
-	controller->slots = NULL;
 	kfree (controller->buses);
-	controller->buses = NULL;
-	controller->ctrl_dev = NULL;
 	kfree (controller);
 }
 
@@ -286,7 +284,8 @@
 int __init ibmphp_access_ebda (void)
 {
 	u8 format, num_ctlrs, rio_complete, hs_complete;
-	u16 ebda_seg, num_entries, next_offset, offset, blk_id, sub_addr, rc, re, rc_id, re_id, base;
+	u16 ebda_seg, num_entries, next_offset, offset, blk_id, sub_addr, re, rc_id, re_id, base;
+	int rc = 0;
 
 
 	rio_complete = 0;
@@ -324,10 +323,8 @@
 			format = readb (io_mem + offset);
 
 			offset += 1;
-			if (format != 4) {
-				iounmap (io_mem);
-				return -ENODEV;
-			}
+			if (format != 4)
+				goto error_nodev;
 			debug ("hot blk format: %x\n", format);
 			/* hot swap sub blk */
 			base = offset;
@@ -339,18 +336,16 @@
 			rc_id = readw (io_mem + sub_addr); 	/* sub blk id */
 
 			sub_addr += 2;
-			if (rc_id != 0x5243) {
-				iounmap (io_mem);
-				return -ENODEV;
-			}
+			if (rc_id != 0x5243)
+				goto error_nodev;
 			/* rc sub blk signature  */
 			num_ctlrs = readb (io_mem + sub_addr);
 
 			sub_addr += 1;
 			hpc_list_ptr = alloc_ebda_hpc_list ();
 			if (!hpc_list_ptr) {
-				iounmap (io_mem);
-				return -ENOMEM;
+				rc = -ENOMEM;
+				goto out;
 			}
 			hpc_list_ptr->format = format;
 			hpc_list_ptr->num_ctlrs = num_ctlrs;
@@ -361,16 +356,15 @@
 			debug ("offset of hpc data structure enteries: %x\n ", sub_addr);
 
 			sub_addr = base + re;	/* re sub blk */
+			/* FIXME: rc is never used/checked */
 			rc = readw (io_mem + sub_addr);	/* next sub blk */
 
 			sub_addr += 2;
 			re_id = readw (io_mem + sub_addr);	/* sub blk id */
 
 			sub_addr += 2;
-			if (re_id != 0x5245) {
-				iounmap (io_mem);
-				return -ENODEV;
-			}
+			if (re_id != 0x5245)
+				goto error_nodev;
 
 			/* signature of re */
 			num_entries = readw (io_mem + sub_addr);
@@ -378,8 +372,8 @@
 			sub_addr += 2;	/* offset of RSRC_ENTRIES blk */
 			rsrc_list_ptr = alloc_ebda_rsrc_list ();
 			if (!rsrc_list_ptr ) {
-				iounmap (io_mem);
-				return -ENOMEM;
+				rc = -ENOMEM;
+				goto out;
 			}
 			rsrc_list_ptr->format = format;
 			rsrc_list_ptr->num_entries = num_entries;
@@ -391,9 +385,8 @@
 			debug ("offset of rsrc data structure enteries: %x\n ", sub_addr);
 
 			hs_complete = 1;
-		}
-		/* found rio table */
-		else if (blk_id == 0x4752) {
+		} else {
+		/* found rio table, blk_id == 0x4752 */
 			debug ("now enter io table ---\n");
 			debug ("rio blk id: %x\n", blk_id);
 
@@ -406,41 +399,36 @@
 			rio_table_ptr->riodev_count = readb (io_mem + offset + 2);
 			rio_table_ptr->offset = offset +3 ;
 			
-			debug ("info about rio table hdr ---\n");
-			debug ("ver_num: %x\nscal_count: %x\nriodev_count: %x\noffset of rio table: %x\n ", rio_table_ptr->ver_num, rio_table_ptr->scal_count, rio_table_ptr->riodev_count, rio_table_ptr->offset);
+			debug("info about rio table hdr ---\n");
+			debug("ver_num: %x\nscal_count: %x\nriodev_count: %x\noffset of rio table: %x\n ",
+				rio_table_ptr->ver_num, rio_table_ptr->scal_count,
+				rio_table_ptr->riodev_count, rio_table_ptr->offset);
 
 			rio_complete = 1;
 		}
 	}
 
-	if (!hs_complete && !rio_complete) {
-		iounmap (io_mem);
-		return -ENODEV;
-	}
+	if (!hs_complete && !rio_complete)
+		goto error_nodev;
 
 	if (rio_table_ptr) {
-		if (rio_complete == 1 && rio_table_ptr->ver_num == 3) {
+		if (rio_complete && rio_table_ptr->ver_num == 3) {
 			rc = ebda_rio_table ();
-			if (rc) {
-				iounmap (io_mem);
-				return rc;
-			}
+			if (rc)
+				goto out;
 		}
 	}
 	rc = ebda_rsrc_controller ();
-	if (rc) {
-		iounmap (io_mem);
-		return rc;
-	}
+	if (rc)
+		goto out;
 
 	rc = ebda_rsrc_rsrc ();
-	if (rc) {
-		iounmap (io_mem);
-		return rc;
-	}
-
+	goto out;
+error_nodev:
+	rc = -ENODEV;
+out:
 	iounmap (io_mem);
-	return 0;
+	return rc;
 }
 
 /*


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                                       ` Greg KH
@ 2004-02-09 23:22                                         ` Greg KH
  2004-02-09 23:22                                           ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.21, 2004/02/09 11:03:22-08:00, greg@kroah.com

PCI: remove stupid MSI debugging code that was never used.


 drivers/pci/msi.c       |    1 -
 include/linux/pci_msi.h |   29 +++--------------------------
 2 files changed, 3 insertions(+), 27 deletions(-)


diff -Nru a/drivers/pci/msi.c b/drivers/pci/msi.c
--- a/drivers/pci/msi.c	Mon Feb  9 14:58:21 2004
+++ b/drivers/pci/msi.c	Mon Feb  9 14:58:21 2004
@@ -21,7 +21,6 @@
 
 #include <linux/pci_msi.h>
 
-_DEFINE_DBG_BUFFER
 
 static spinlock_t msi_lock = SPIN_LOCK_UNLOCKED;
 static struct msi_desc* msi_desc[NR_IRQS] = { [0 ... NR_IRQS-1] = NULL };
diff -Nru a/include/linux/pci_msi.h b/include/linux/pci_msi.h
--- a/include/linux/pci_msi.h	Mon Feb  9 14:58:21 2004
+++ b/include/linux/pci_msi.h	Mon Feb  9 14:58:21 2004
@@ -3,8 +3,8 @@
  *
  */
 
-#ifndef _ASM_PCI_MSI_H
-#define _ASM_PCI_MSI_H
+#ifndef PCI_MSI_H
+#define PCI_MSI_H
 
 #include <linux/pci.h>
 
@@ -82,29 +82,6 @@
 #define msix_mask(address)		(address | PCI_MSIX_FLAGS_BITMASK)
 #define msix_is_pending(address) 	(address & PCI_MSIX_FLAGS_PENDMASK)
 
-extern char __dbg_str_buf[256];
-#define _DEFINE_DBG_BUFFER	char __dbg_str_buf[256];
-#define _DBG_K_TRACE_ENTRY	((unsigned int)0x00000001)
-#define _DBG_K_TRACE_EXIT	((unsigned int)0x00000002)
-#define _DBG_K_INFO		((unsigned int)0x00000004)
-#define _DBG_K_ERROR		((unsigned int)0x00000008)
-#define _DBG_K_TRACE	(_DBG_K_TRACE_ENTRY | _DBG_K_TRACE_EXIT)
-
-#define _DEBUG_LEVEL	(_DBG_K_INFO | _DBG_K_ERROR | _DBG_K_TRACE)
-#define _DBG_PRINT( dbg_flags, args... )		\
-if ( _DEBUG_LEVEL & (dbg_flags) )			\
-{							\
-	int len;					\
-	len = sprintf(__dbg_str_buf, "%s:%d: %s ", 	\
-		__FILE__, __LINE__, __FUNCTION__ ); 	\
-	sprintf(__dbg_str_buf + len, args);		\
-	printk(KERN_INFO "%s\n", __dbg_str_buf);	\
-}
-
-#define MSI_FUNCTION_TRACE_ENTER	\
-	_DBG_PRINT (_DBG_K_TRACE_ENTRY, "%s", "[Entry]");
-#define MSI_FUNCTION_TRACE_EXIT		\
-	_DBG_PRINT (_DBG_K_TRACE_EXIT, "%s", "[Entry]");
 
 /*
  * MSI Defined Data Structures
@@ -190,4 +167,4 @@
 	struct pci_dev *dev;
 };
 
-#endif /* _ASM_PCI_MSI_H */
+#endif /* PCI_MSI_H */


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                                         ` Greg KH
@ 2004-02-09 23:22                                           ` Greg KH
  2004-02-09 23:22                                             ` Greg KH
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1500.11.22, 2004/02/09 11:04:55-08:00, greg@kroah.com

PCI: move pci_msi.h out of include/linux to drivers/pci where it belongs.


 include/linux/pci_msi.h |  170 ------------------------------------------------
 drivers/pci/msi.c       |    2 
 drivers/pci/msi.h       |  168 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 169 insertions(+), 171 deletions(-)


diff -Nru a/drivers/pci/msi.c b/drivers/pci/msi.c
--- a/drivers/pci/msi.c	Mon Feb  9 14:58:16 2004
+++ b/drivers/pci/msi.c	Mon Feb  9 14:58:16 2004
@@ -19,7 +19,7 @@
 #include <asm/io_apic.h>
 #include <mach_apic.h>
 
-#include <linux/pci_msi.h>
+#include "msi.h"
 
 
 static spinlock_t msi_lock = SPIN_LOCK_UNLOCKED;
diff -Nru a/drivers/pci/msi.h b/drivers/pci/msi.h
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/drivers/pci/msi.h	Mon Feb  9 14:58:16 2004
@@ -0,0 +1,168 @@
+/*
+ *	msi.h
+ *
+ */
+
+#ifndef MSI_H
+#define MSI_H
+
+#define MSI_AUTO -1
+#define NR_REPEATS	23
+#define NR_RESERVED_VECTORS 3 /*FIRST_DEVICE_VECTOR,FIRST_SYSTEM_VECTOR,0x80 */
+
+/*
+ * Assume the maximum number of hot plug slots supported by the system is about
+ * ten. The worstcase is that each of these slots is hot-added with a device,
+ * which has two MSI/MSI-X capable functions. To avoid any MSI-X driver, which
+ * attempts to request all available vectors, NR_HP_RESERVED_VECTORS is defined
+ * as below to ensure at least one message is assigned to each detected MSI/
+ * MSI-X device function.
+ */
+#define NR_HP_RESERVED_VECTORS 	20
+
+extern int vector_irq[NR_IRQS];
+extern cpumask_t pending_irq_balance_cpumask[NR_IRQS];
+extern void (*interrupt[NR_IRQS])(void);
+
+#ifdef CONFIG_SMP
+#define set_msi_irq_affinity	set_msi_affinity
+#else
+#define set_msi_irq_affinity	NULL
+static inline void move_msi(int vector) {}
+#endif
+
+#ifndef CONFIG_X86_IO_APIC
+static inline int get_ioapic_vector(struct pci_dev *dev) { return -1;}
+static inline void restore_ioapic_irq_handler(int irq) {}
+#else
+extern void restore_ioapic_irq_handler(int irq);
+#endif
+
+/*
+ * MSI-X Address Register
+ */
+#define PCI_MSIX_FLAGS_QSIZE		0x7FF
+#define PCI_MSIX_FLAGS_ENABLE		(1 << 15)
+#define PCI_MSIX_FLAGS_BIRMASK		(7 << 0)
+#define PCI_MSIX_FLAGS_BITMASK		(1 << 0)
+
+#define PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET	0
+#define PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET	4
+#define PCI_MSIX_ENTRY_DATA_OFFSET		8
+#define PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET	12
+#define PCI_MSIX_ENTRY_SIZE			16
+
+#define msi_control_reg(base)		(base + PCI_MSI_FLAGS)
+#define msi_lower_address_reg(base)	(base + PCI_MSI_ADDRESS_LO)
+#define msi_upper_address_reg(base)	(base + PCI_MSI_ADDRESS_HI)
+#define msi_data_reg(base, is64bit)	\
+	( (is64bit == 1) ? base+PCI_MSI_DATA_64 : base+PCI_MSI_DATA_32 )
+#define msi_mask_bits_reg(base, is64bit) \
+	( (is64bit == 1) ? base+PCI_MSI_MASK_BIT : base+PCI_MSI_MASK_BIT-4)
+#define msi_disable(control)		control &= ~PCI_MSI_FLAGS_ENABLE
+#define multi_msi_capable(control) \
+	(1 << ((control & PCI_MSI_FLAGS_QMASK) >> 1))
+#define multi_msi_enable(control, num) \
+	control |= (((num >> 1) << 4) & PCI_MSI_FLAGS_QSIZE);
+#define is_64bit_address(control)	(control & PCI_MSI_FLAGS_64BIT)
+#define is_mask_bit_support(control)	(control & PCI_MSI_FLAGS_MASKBIT)
+#define msi_enable(control, num) multi_msi_enable(control, num); \
+	control |= PCI_MSI_FLAGS_ENABLE
+
+#define msix_control_reg		msi_control_reg
+#define msix_table_offset_reg(base)	(base + 0x04)
+#define msix_pba_offset_reg(base)	(base + 0x08)
+#define msix_enable(control)	 	control |= PCI_MSIX_FLAGS_ENABLE
+#define msix_disable(control)	 	control &= ~PCI_MSIX_FLAGS_ENABLE
+#define msix_table_size(control) 	((control & PCI_MSIX_FLAGS_QSIZE)+1)
+#define multi_msix_capable		msix_table_size
+#define msix_unmask(address)	 	(address & ~PCI_MSIX_FLAGS_BITMASK)
+#define msix_mask(address)		(address | PCI_MSIX_FLAGS_BITMASK)
+#define msix_is_pending(address) 	(address & PCI_MSIX_FLAGS_PENDMASK)
+
+
+/*
+ * MSI Defined Data Structures
+ */
+#define MSI_ADDRESS_HEADER		0xfee
+#define MSI_ADDRESS_HEADER_SHIFT	12
+#define MSI_ADDRESS_HEADER_MASK		0xfff000
+#define MSI_TARGET_CPU_SHIFT		4
+#define MSI_TARGET_CPU_MASK		0xff
+#define MSI_DELIVERY_MODE		0
+#define MSI_LEVEL_MODE			1	/* Edge always assert */
+#define MSI_TRIGGER_MODE		0	/* MSI is edge sensitive */
+#define MSI_LOGICAL_MODE		1
+#define MSI_REDIRECTION_HINT_MODE	0
+#ifdef CONFIG_SMP
+#define MSI_TARGET_CPU			logical_smp_processor_id()
+#else
+#define MSI_TARGET_CPU			TARGET_CPUS
+#endif
+
+struct msg_data {
+#if defined(__LITTLE_ENDIAN_BITFIELD)
+	__u32	vector		:  8;
+	__u32	delivery_mode	:  3;	/* 000b: FIXED | 001b: lowest prior */
+	__u32	reserved_1	:  3;
+	__u32	level		:  1;	/* 0: deassert | 1: assert */
+	__u32	trigger		:  1;	/* 0: edge | 1: level */
+	__u32	reserved_2	: 16;
+#elif defined(__BIG_ENDIAN_BITFIELD)
+	__u32	reserved_2	: 16;
+	__u32	trigger		:  1;	/* 0: edge | 1: level */
+	__u32	level		:  1;	/* 0: deassert | 1: assert */
+	__u32	reserved_1	:  3;
+	__u32	delivery_mode	:  3;	/* 000b: FIXED | 001b: lowest prior */
+	__u32	vector		:  8;
+#else
+#error "Bitfield endianness not defined! Check your byteorder.h"
+#endif
+} __attribute__ ((packed));
+
+struct msg_address {
+	union {
+		struct {
+#if defined(__LITTLE_ENDIAN_BITFIELD)
+			__u32	reserved_1	:  2;
+			__u32	dest_mode	:  1;	/*0:physic | 1:logic */
+			__u32	redirection_hint:  1;  	/*0: dedicated CPU
+							  1: lowest priority */
+			__u32	reserved_2	:  4;
+ 			__u32	dest_id		: 24;	/* Destination ID */
+#elif defined(__BIG_ENDIAN_BITFIELD)
+ 			__u32	dest_id		: 24;	/* Destination ID */
+			__u32	reserved_2	:  4;
+			__u32	redirection_hint:  1;  	/*0: dedicated CPU
+							  1: lowest priority */
+			__u32	dest_mode	:  1;	/*0:physic | 1:logic */
+			__u32	reserved_1	:  2;
+#else
+#error "Bitfield endianness not defined! Check your byteorder.h"
+#endif
+      		}u;
+       		__u32  value;
+	}lo_address;
+	__u32 	hi_address;
+} __attribute__ ((packed));
+
+struct msi_desc {
+	struct {
+		__u8	type	: 5; 	/* {0: unused, 5h:MSI, 11h:MSI-X} */
+		__u8	maskbit	: 1; 	/* mask-pending bit supported ?   */
+		__u8	reserved: 2; 	/* reserved			  */
+		__u8	entry_nr;    	/* specific enabled entry 	  */
+		__u8	default_vector; /* default pre-assigned vector    */
+		__u8	current_cpu; 	/* current destination cpu	  */
+	}msi_attrib;
+
+	struct {
+		__u16	head;
+		__u16	tail;
+	}link;
+
+	unsigned long mask_base;
+	struct pci_dev *dev;
+};
+
+#endif /* MSI_H */
diff -Nru a/include/linux/pci_msi.h b/include/linux/pci_msi.h
--- a/include/linux/pci_msi.h	Mon Feb  9 14:58:16 2004
+++ /dev/null	Wed Dec 31 16:00:00 1969
@@ -1,170 +0,0 @@
-/*
- *	../include/linux/pci_msi.h
- *
- */
-
-#ifndef PCI_MSI_H
-#define PCI_MSI_H
-
-#include <linux/pci.h>
-
-#define MSI_AUTO -1
-#define NR_REPEATS	23
-#define NR_RESERVED_VECTORS 3 /*FIRST_DEVICE_VECTOR,FIRST_SYSTEM_VECTOR,0x80 */
-
-/*
- * Assume the maximum number of hot plug slots supported by the system is about
- * ten. The worstcase is that each of these slots is hot-added with a device,
- * which has two MSI/MSI-X capable functions. To avoid any MSI-X driver, which
- * attempts to request all available vectors, NR_HP_RESERVED_VECTORS is defined
- * as below to ensure at least one message is assigned to each detected MSI/
- * MSI-X device function.
- */
-#define NR_HP_RESERVED_VECTORS 	20
-
-extern int vector_irq[NR_IRQS];
-extern cpumask_t pending_irq_balance_cpumask[NR_IRQS];
-extern void (*interrupt[NR_IRQS])(void);
-
-#ifdef CONFIG_SMP
-#define set_msi_irq_affinity	set_msi_affinity
-#else
-#define set_msi_irq_affinity	NULL
-static inline void move_msi(int vector) {}
-#endif
-
-#ifndef CONFIG_X86_IO_APIC
-static inline int get_ioapic_vector(struct pci_dev *dev) { return -1;}
-static inline void restore_ioapic_irq_handler(int irq) {}
-#else
-extern void restore_ioapic_irq_handler(int irq);
-#endif
-
-/*
- * MSI-X Address Register
- */
-#define PCI_MSIX_FLAGS_QSIZE		0x7FF
-#define PCI_MSIX_FLAGS_ENABLE		(1 << 15)
-#define PCI_MSIX_FLAGS_BIRMASK		(7 << 0)
-#define PCI_MSIX_FLAGS_BITMASK		(1 << 0)
-
-#define PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET	0
-#define PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET	4
-#define PCI_MSIX_ENTRY_DATA_OFFSET		8
-#define PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET	12
-#define PCI_MSIX_ENTRY_SIZE			16
-
-#define msi_control_reg(base)		(base + PCI_MSI_FLAGS)
-#define msi_lower_address_reg(base)	(base + PCI_MSI_ADDRESS_LO)
-#define msi_upper_address_reg(base)	(base + PCI_MSI_ADDRESS_HI)
-#define msi_data_reg(base, is64bit)	\
-	( (is64bit == 1) ? base+PCI_MSI_DATA_64 : base+PCI_MSI_DATA_32 )
-#define msi_mask_bits_reg(base, is64bit) \
-	( (is64bit == 1) ? base+PCI_MSI_MASK_BIT : base+PCI_MSI_MASK_BIT-4)
-#define msi_disable(control)		control &= ~PCI_MSI_FLAGS_ENABLE
-#define multi_msi_capable(control) \
-	(1 << ((control & PCI_MSI_FLAGS_QMASK) >> 1))
-#define multi_msi_enable(control, num) \
-	control |= (((num >> 1) << 4) & PCI_MSI_FLAGS_QSIZE);
-#define is_64bit_address(control)	(control & PCI_MSI_FLAGS_64BIT)
-#define is_mask_bit_support(control)	(control & PCI_MSI_FLAGS_MASKBIT)
-#define msi_enable(control, num) multi_msi_enable(control, num); \
-	control |= PCI_MSI_FLAGS_ENABLE
-
-#define msix_control_reg		msi_control_reg
-#define msix_table_offset_reg(base)	(base + 0x04)
-#define msix_pba_offset_reg(base)	(base + 0x08)
-#define msix_enable(control)	 	control |= PCI_MSIX_FLAGS_ENABLE
-#define msix_disable(control)	 	control &= ~PCI_MSIX_FLAGS_ENABLE
-#define msix_table_size(control) 	((control & PCI_MSIX_FLAGS_QSIZE)+1)
-#define multi_msix_capable		msix_table_size
-#define msix_unmask(address)	 	(address & ~PCI_MSIX_FLAGS_BITMASK)
-#define msix_mask(address)		(address | PCI_MSIX_FLAGS_BITMASK)
-#define msix_is_pending(address) 	(address & PCI_MSIX_FLAGS_PENDMASK)
-
-
-/*
- * MSI Defined Data Structures
- */
-#define MSI_ADDRESS_HEADER		0xfee
-#define MSI_ADDRESS_HEADER_SHIFT	12
-#define MSI_ADDRESS_HEADER_MASK		0xfff000
-#define MSI_TARGET_CPU_SHIFT		4
-#define MSI_TARGET_CPU_MASK		0xff
-#define MSI_DELIVERY_MODE		0
-#define MSI_LEVEL_MODE			1	/* Edge always assert */
-#define MSI_TRIGGER_MODE		0	/* MSI is edge sensitive */
-#define MSI_LOGICAL_MODE		1
-#define MSI_REDIRECTION_HINT_MODE	0
-#ifdef CONFIG_SMP
-#define MSI_TARGET_CPU			logical_smp_processor_id()
-#else
-#define MSI_TARGET_CPU			TARGET_CPUS
-#endif
-
-struct msg_data {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-	__u32	vector		:  8;
-	__u32	delivery_mode	:  3;	/* 000b: FIXED | 001b: lowest prior */
-	__u32	reserved_1	:  3;
-	__u32	level		:  1;	/* 0: deassert | 1: assert */
-	__u32	trigger		:  1;	/* 0: edge | 1: level */
-	__u32	reserved_2	: 16;
-#elif defined(__BIG_ENDIAN_BITFIELD)
-	__u32	reserved_2	: 16;
-	__u32	trigger		:  1;	/* 0: edge | 1: level */
-	__u32	level		:  1;	/* 0: deassert | 1: assert */
-	__u32	reserved_1	:  3;
-	__u32	delivery_mode	:  3;	/* 000b: FIXED | 001b: lowest prior */
-	__u32	vector		:  8;
-#else
-#error "Bitfield endianness not defined! Check your byteorder.h"
-#endif
-} __attribute__ ((packed));
-
-struct msg_address {
-	union {
-		struct {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
-			__u32	reserved_1	:  2;
-			__u32	dest_mode	:  1;	/*0:physic | 1:logic */
-			__u32	redirection_hint:  1;  	/*0: dedicated CPU
-							  1: lowest priority */
-			__u32	reserved_2	:  4;
- 			__u32	dest_id		: 24;	/* Destination ID */
-#elif defined(__BIG_ENDIAN_BITFIELD)
- 			__u32	dest_id		: 24;	/* Destination ID */
-			__u32	reserved_2	:  4;
-			__u32	redirection_hint:  1;  	/*0: dedicated CPU
-							  1: lowest priority */
-			__u32	dest_mode	:  1;	/*0:physic | 1:logic */
-			__u32	reserved_1	:  2;
-#else
-#error "Bitfield endianness not defined! Check your byteorder.h"
-#endif
-      		}u;
-       		__u32  value;
-	}lo_address;
-	__u32 	hi_address;
-} __attribute__ ((packed));
-
-struct msi_desc {
-	struct {
-		__u8	type	: 5; 	/* {0: unused, 5h:MSI, 11h:MSI-X} */
-		__u8	maskbit	: 1; 	/* mask-pending bit supported ?   */
-		__u8	reserved: 2; 	/* reserved			  */
-		__u8	entry_nr;    	/* specific enabled entry 	  */
-		__u8	default_vector; /* default pre-assigned vector    */
-		__u8	current_cpu; 	/* current destination cpu	  */
-	}msi_attrib;
-
-	struct {
-		__u16	head;
-		__u16	tail;
-	}link;
-
-	unsigned long mask_base;
-	struct pci_dev *dev;
-};
-
-#endif /* PCI_MSI_H */


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                                           ` Greg KH
@ 2004-02-09 23:22                                             ` Greg KH
  2004-02-10 11:11                                               ` Marcelo Tosatti
  0 siblings, 1 reply; 32+ messages in thread
From: Greg KH @ 2004-02-09 23:22 UTC (permalink / raw)
  To: linux-kernel

ChangeSet 1.1607, 2004/02/09 14:05:33-08:00, greg@kroah.com

dmapool: fix up list_for_each() calls to list_for_each_entry()
  
Now this should get that Rusty^Wmonkey off my back...


 drivers/base/dmapool.c |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)


diff -Nru a/drivers/base/dmapool.c b/drivers/base/dmapool.c
--- a/drivers/base/dmapool.c	Mon Feb  9 14:58:07 2004
+++ b/drivers/base/dmapool.c	Mon Feb  9 14:58:07 2004
@@ -43,9 +43,11 @@
 static ssize_t
 show_pools (struct device *dev, char *buf)
 {
-	unsigned		temp, size;
-	char			*next;
-	struct list_head	*i, *j;
+	unsigned temp;
+	unsigned size;
+	char *next;
+	struct dma_page *page;
+	struct dma_pool *pool;
 
 	next = buf;
 	size = PAGE_SIZE;
@@ -55,16 +57,11 @@
 	next += temp;
 
 	down (&pools_lock);
-	list_for_each (i, &dev->dma_pools) {
-		struct dma_pool	*pool;
-		unsigned	pages = 0, blocks = 0;
+	list_for_each_entry(pool, &dev->dma_pools, pools) {
+		unsigned pages = 0;
+		unsigned blocks = 0;
 
-		pool = list_entry (i, struct dma_pool, pools);
-
-		list_for_each (j, &pool->page_list) {
-			struct dma_page	*page;
-
-			page = list_entry (j, struct dma_page, page_list);
+		list_for_each_entry(page, &pool->page_list, page_list) {
 			pages++;
 			blocks += page->in_use;
 		}
@@ -268,7 +265,6 @@
 dma_pool_alloc (struct dma_pool *pool, int mem_flags, dma_addr_t *handle)
 {
 	unsigned long		flags;
-	struct list_head	*entry;
 	struct dma_page		*page;
 	int			map, block;
 	size_t			offset;
@@ -276,9 +272,8 @@
 
 restart:
 	spin_lock_irqsave (&pool->lock, flags);
-	list_for_each (entry, &pool->page_list) {
+	list_for_each_entry(page, &pool->page_list, page_list) {
 		int		i;
-		page = list_entry (entry, struct dma_page, page_list);
 		/* only cachable accesses here ... */
 		for (map = 0, i = 0;
 				i < pool->blocks_per_page;
@@ -330,12 +325,10 @@
 pool_find_page (struct dma_pool *pool, dma_addr_t dma)
 {
 	unsigned long		flags;
-	struct list_head	*entry;
 	struct dma_page		*page;
 
 	spin_lock_irqsave (&pool->lock, flags);
-	list_for_each (entry, &pool->page_list) {
-		page = list_entry (entry, struct dma_page, page_list);
+	list_for_each_entry(page, &pool->page_list, page_list) {
 		if (dma < page->dma)
 			continue;
 		if (dma < (page->dma + pool->allocation))


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22                                             ` Greg KH
@ 2004-02-10 11:11                                               ` Marcelo Tosatti
  0 siblings, 0 replies; 32+ messages in thread
From: Marcelo Tosatti @ 2004-02-10 11:11 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, Rusty Russell



On Mon, 9 Feb 2004, Greg KH wrote:

> ChangeSet 1.1607, 2004/02/09 14:05:33-08:00, greg@kroah.com
>
> dmapool: fix up list_for_each() calls to list_for_each_entry()
>
> Now this should get that Rusty^Wmonkey off my back...
>
>
>  drivers/base/dmapool.c |   29 +++++++++++------------------
>  1 files changed, 11 insertions(+), 18 deletions(-)
>
>
> diff -Nru a/drivers/base/dmapool.c b/drivers/base/dmapool.c
> --- a/drivers/base/dmapool.c	Mon Feb  9 14:58:07 2004
> +++ b/drivers/base/dmapool.c	Mon Feb  9 14:58:07 2004
> @@ -43,9 +43,11 @@
>  static ssize_t
>  show_pools (struct device *dev, char *buf)
>  {
> -	unsigned		temp, size;
> -	char			*next;
> -	struct list_head	*i, *j;
> +	unsigned temp;
> +	unsigned size;
> +	char *next;
> +	struct dma_page *page;
> +	struct dma_pool *pool;
>
>  	next = buf;
>  	size = PAGE_SIZE;
> @@ -55,16 +57,11 @@
>  	next += temp;
>
>  	down (&pools_lock);
> -	list_for_each (i, &dev->dma_pools) {
> -		struct dma_pool	*pool;
> -		unsigned	pages = 0, blocks = 0;
> +	list_for_each_entry(pool, &dev->dma_pools, pools) {
> +		unsigned pages = 0;
> +		unsigned blocks = 0;
>
> -		pool = list_entry (i, struct dma_pool, pools);
> -
> -		list_for_each (j, &pool->page_list) {
> -			struct dma_page	*page;
> -
> -			page = list_entry (j, struct dma_page, page_list);
> +		list_for_each_entry(page, &pool->page_list, page_list) {
>  			pages++;
>  			blocks += page->in_use;

Hi Rusty,

I have you ask riel to use list_for_each_entry() instead list_for_each()
in the 2.4 inode highmem patches.

Is this a "beauty" only modification or is there any potential problem
with "list_for_each()" ?

Thank you.

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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-09 23:22   ` Greg KH
  2004-02-09 23:22     ` Greg KH
@ 2004-02-10 16:03     ` Geert Uytterhoeven
  2004-02-10 16:46       ` Greg KH
  1 sibling, 1 reply; 32+ messages in thread
From: Geert Uytterhoeven @ 2004-02-10 16:03 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux Kernel Development

On Mon, 9 Feb 2004, Greg KH wrote:
> ChangeSet 1.1500.11.2, 2004/01/30 16:34:48-08:00, ambx1@neo.rr.com
>
> [PATCH] PCI: Remove uneeded resource structures from pci_dev
>
> 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.

FYI, at least one ISDN driver seems to need it as well:

| drivers/isdn/hardware/avm/b1isa.c: In function `b1isa_init':
| drivers/isdn/hardware/avm/b1isa.c:183: structure has no member named `irq_resource'

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-10 16:03     ` Geert Uytterhoeven
@ 2004-02-10 16:46       ` Greg KH
  2004-02-10 17:03         ` Kai Germaschewski
                           ` (2 more replies)
  0 siblings, 3 replies; 32+ messages in thread
From: Greg KH @ 2004-02-10 16:46 UTC (permalink / raw)
  To: Geert Uytterhoeven, kkeil, isdn4linux, kai.germaschewski
  Cc: Linux Kernel Development

On Tue, Feb 10, 2004 at 05:03:17PM +0100, Geert Uytterhoeven wrote:
> On Mon, 9 Feb 2004, Greg KH wrote:
> > ChangeSet 1.1500.11.2, 2004/01/30 16:34:48-08:00, ambx1@neo.rr.com
> >
> > [PATCH] PCI: Remove uneeded resource structures from pci_dev
> >
> > 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.
> 
> FYI, at least one ISDN driver seems to need it as well:
> 
> | drivers/isdn/hardware/avm/b1isa.c: In function `b1isa_init':
> | drivers/isdn/hardware/avm/b1isa.c:183: structure has no member named `irq_resource'

Ick, I don't really think we want users trying to override the irq
number of their pci cards...

Here's the patch that fixes this, and one other isdn driver up.  ISDN
people, feel free to add this to your huge patch :)

thanks,

greg k-h


===== b1isa.c 1.9 vs edited =====
--- 1.9/drivers/isdn/hardware/avm/b1isa.c	Tue Jul 15 03:01:29 2003
+++ edited/b1isa.c	Tue Feb 10 08:43:39 2004
@@ -180,7 +180,6 @@
 			break;
 
 		isa_dev[i].resource[0].start = io[i];
-		isa_dev[i].irq_resource[0].start = irq[i];
 
 		if (b1isa_probe(&isa_dev[i]) == 0)
 			found++;
===== t1isa.c 1.11 vs edited =====
--- 1.11/drivers/isdn/hardware/avm/t1isa.c	Tue Jul 15 03:01:29 2003
+++ edited/t1isa.c	Tue Feb 10 08:44:01 2004
@@ -519,7 +519,6 @@
 			break;
 
 		isa_dev[i].resource[0].start = io[i];
-		isa_dev[i].irq_resource[0].start = irq[i];
 
 		if (t1isa_probe(&isa_dev[i], cardnr[i]) == 0)
 			found++;

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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-10 16:46       ` Greg KH
@ 2004-02-10 17:03         ` Kai Germaschewski
  2004-02-10 17:49         ` Karsten Keil
  2004-02-10 18:05         ` Adam Belay
  2 siblings, 0 replies; 32+ messages in thread
From: Kai Germaschewski @ 2004-02-10 17:03 UTC (permalink / raw)
  To: Greg KH; +Cc: Geert Uytterhoeven, kkeil, isdn4linux, Linux Kernel Development

On Tue, 10 Feb 2004, Greg KH wrote:

> > | drivers/isdn/hardware/avm/b1isa.c: In function `b1isa_init':
> > | drivers/isdn/hardware/avm/b1isa.c:183: structure has no member named `irq_resource'
> 
> Ick, I don't really think we want users trying to override the irq
> number of their pci cards...

Well, in fact these are actually ISA cards, so nothing wrong with the user 
specifying the interrupts. This dates back to before the driver model, we 
were abusing struct pci_dev as a more general struct device to streamline 
support of PCI and ISA cards within the same code.

--Kai


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-10 16:46       ` Greg KH
  2004-02-10 17:03         ` Kai Germaschewski
@ 2004-02-10 17:49         ` Karsten Keil
  2004-02-11 22:27           ` Adrian Bunk
  2004-02-10 18:05         ` Adam Belay
  2 siblings, 1 reply; 32+ messages in thread
From: Karsten Keil @ 2004-02-10 17:49 UTC (permalink / raw)
  To: Greg KH
  Cc: Geert Uytterhoeven, kkeil, kai.germaschewski,
	Linux Kernel Development

Hi Greg,

On Tue, Feb 10, 2004 at 08:46:12AM -0800, Greg KH wrote:
> On Tue, Feb 10, 2004 at 05:03:17PM +0100, Geert Uytterhoeven wrote:
> > On Mon, 9 Feb 2004, Greg KH wrote:
> > > ChangeSet 1.1500.11.2, 2004/01/30 16:34:48-08:00, ambx1@neo.rr.com
> > >
> > > [PATCH] PCI: Remove uneeded resource structures from pci_dev
> > >
> > > 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.
> > 
> > FYI, at least one ISDN driver seems to need it as well:
> > 
> > | drivers/isdn/hardware/avm/b1isa.c: In function `b1isa_init':
> > | drivers/isdn/hardware/avm/b1isa.c:183: structure has no member named `irq_resource'
> 
> Ick, I don't really think we want users trying to override the irq
> number of their pci cards...

No but this driver use the PCI struct to deliver IO/IRQ values
to the card init routines (used by ISA and PCI)
also for old (not PnP) ISA cards.

The bug is to use irq_resource[0].start here, it must be isa_dev[i].irq
instead, allready fixed in last night patch.

> 
> Here's the patch that fixes this, and one other isdn driver up.  ISDN
> people, feel free to add this to your huge patch :)
> 
> thanks,
> 
> greg k-h
> 
> 
> ===== b1isa.c 1.9 vs edited =====
> --- 1.9/drivers/isdn/hardware/avm/b1isa.c	Tue Jul 15 03:01:29 2003
> +++ edited/b1isa.c	Tue Feb 10 08:43:39 2004
> @@ -180,7 +180,6 @@
>  			break;
>  
>  		isa_dev[i].resource[0].start = io[i];
> -		isa_dev[i].irq_resource[0].start = irq[i];
>  
>  		if (b1isa_probe(&isa_dev[i]) == 0)
>  			found++;
> ===== t1isa.c 1.11 vs edited =====
> --- 1.11/drivers/isdn/hardware/avm/t1isa.c	Tue Jul 15 03:01:29 2003
> +++ edited/t1isa.c	Tue Feb 10 08:44:01 2004
> @@ -519,7 +519,6 @@
>  			break;
>  
>  		isa_dev[i].resource[0].start = io[i];
> -		isa_dev[i].irq_resource[0].start = irq[i];
>  
>  		if (t1isa_probe(&isa_dev[i], cardnr[i]) == 0)
>  			found++;
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Karsten Keil
SuSE Labs
ISDN development

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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-10 16:46       ` Greg KH
  2004-02-10 17:03         ` Kai Germaschewski
  2004-02-10 17:49         ` Karsten Keil
@ 2004-02-10 18:05         ` Adam Belay
  2004-02-18 19:40           ` Greg KH
  2 siblings, 1 reply; 32+ messages in thread
From: Adam Belay @ 2004-02-10 18:05 UTC (permalink / raw)
  To: Greg KH
  Cc: Geert Uytterhoeven, kkeil, isdn4linux, kai.germaschewski,
	Linux Kernel Development

On Tue, Feb 10, 2004 at 08:46:12AM -0800, Greg KH wrote:
> On Tue, Feb 10, 2004 at 05:03:17PM +0100, Geert Uytterhoeven wrote:
> > On Mon, 9 Feb 2004, Greg KH wrote:
> > > ChangeSet 1.1500.11.2, 2004/01/30 16:34:48-08:00, ambx1@neo.rr.com
> > >
> > > [PATCH] PCI: Remove uneeded resource structures from pci_dev
> > >
> > > 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.
> >
> > FYI, at least one ISDN driver seems to need it as well:
> >
> > | drivers/isdn/hardware/avm/b1isa.c: In function `b1isa_init':
> > | drivers/isdn/hardware/avm/b1isa.c:183: structure has no member named `irq_resource'
>
> Ick, I don't really think we want users trying to override the irq
> number of their pci cards...

Yeah, I have plans for a struct isa_dev in 2.7.  It seems we currently
have a few cases of drivers sharing pci_dev.

>
> Here's the patch that fixes this, and one other isdn driver up.  ISDN
> people, feel free to add this to your huge patch :)
>
> thanks,
>
> greg k-h
>


It occured to me that we also have the following related code in pci.h:

--- a/include/linux/pci.h       2004-01-09 06:59:33.000000000 +0000
+++ b/include/linux/pci.h       2004-02-10 17:51:08.000000000 +0000
@@ -362,8 +362,6 @@
 #define PCI_DMA_NONE           3

 #define DEVICE_COUNT_COMPATIBLE        4
-#define DEVICE_COUNT_IRQ       2
-#define DEVICE_COUNT_DMA       2
 #define DEVICE_COUNT_RESOURCE  12

 /*

Perhaps this should be removed as well?

A quick compile and cscope didn't reveal any dependencies but it's
difficult to be positive.

Thanks,
Adam

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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-10 17:49         ` Karsten Keil
@ 2004-02-11 22:27           ` Adrian Bunk
  0 siblings, 0 replies; 32+ messages in thread
From: Adrian Bunk @ 2004-02-11 22:27 UTC (permalink / raw)
  To: Greg KH, Geert Uytterhoeven, kkeil, kai.germaschewski,
	Linux Kernel Development

On Tue, Feb 10, 2004 at 06:49:03PM +0100, Karsten Keil wrote:
>...
> The bug is to use irq_resource[0].start here, it must be isa_dev[i].irq
> instead, allready fixed in last night patch.
>...

Additionally, the following file needs to be fixed:
  drivers/isdn/hisax/hisax_fcclassic.c


Fixes for compilation errors introduced in 2.6.3-rc should not end in
the big ISDN patch, they belong into 2.6.3-final.

Please submit these fixes alone to Linus.


> Karsten Keil

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [PATCH] PCI Update for 2.6.3-rc1
  2004-02-10 18:05         ` Adam Belay
@ 2004-02-18 19:40           ` Greg KH
  0 siblings, 0 replies; 32+ messages in thread
From: Greg KH @ 2004-02-18 19:40 UTC (permalink / raw)
  To: Adam Belay, Geert Uytterhoeven, kkeil, isdn4linux,
	kai.germaschewski, Linux Kernel Development

On Tue, Feb 10, 2004 at 06:05:04PM +0000, Adam Belay wrote:
> 
> 
> It occured to me that we also have the following related code in pci.h:
> 
> --- a/include/linux/pci.h       2004-01-09 06:59:33.000000000 +0000
> +++ b/include/linux/pci.h       2004-02-10 17:51:08.000000000 +0000
> @@ -362,8 +362,6 @@
>  #define PCI_DMA_NONE           3
> 
>  #define DEVICE_COUNT_COMPATIBLE        4
> -#define DEVICE_COUNT_IRQ       2
> -#define DEVICE_COUNT_DMA       2
>  #define DEVICE_COUNT_RESOURCE  12
> 
>  /*
> 
> Perhaps this should be removed as well?

Yup, looks like it.  I've applied this patch to my trees, thanks.

greg k-h

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

end of thread, other threads:[~2004-02-18 19:43 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-09 23:13 [BK PATCH] PCI update for 2.6.3-rc1 Greg KH
2004-02-09 23:22 ` [PATCH] PCI Update " Greg KH
2004-02-09 23:22   ` Greg KH
2004-02-09 23:22     ` Greg KH
2004-02-09 23:22       ` Greg KH
2004-02-09 23:22         ` Greg KH
2004-02-09 23:22           ` Greg KH
2004-02-09 23:22             ` Greg KH
2004-02-09 23:22               ` Greg KH
2004-02-09 23:22                 ` Greg KH
2004-02-09 23:22                   ` Greg KH
2004-02-09 23:22                     ` Greg KH
2004-02-09 23:22                       ` Greg KH
2004-02-09 23:22                         ` Greg KH
2004-02-09 23:22                           ` Greg KH
2004-02-09 23:22                             ` Greg KH
2004-02-09 23:22                               ` Greg KH
2004-02-09 23:22                                 ` Greg KH
2004-02-09 23:22                                   ` Greg KH
2004-02-09 23:22                                     ` Greg KH
2004-02-09 23:22                                       ` Greg KH
2004-02-09 23:22                                         ` Greg KH
2004-02-09 23:22                                           ` Greg KH
2004-02-09 23:22                                             ` Greg KH
2004-02-10 11:11                                               ` Marcelo Tosatti
2004-02-10 16:03     ` Geert Uytterhoeven
2004-02-10 16:46       ` Greg KH
2004-02-10 17:03         ` Kai Germaschewski
2004-02-10 17:49         ` Karsten Keil
2004-02-11 22:27           ` Adrian Bunk
2004-02-10 18:05         ` Adam Belay
2004-02-18 19:40           ` Greg KH

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