patch-2.4.5 linux/drivers/pci/pci.c

Next file: linux/drivers/pci/pci.ids
Previous file: linux/drivers/pci/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.4/linux/drivers/pci/pci.c linux/drivers/pci/pci.c
@@ -843,7 +843,7 @@
 		 * Ugh. We don't know enough about this bridge. Just assume
 		 * that it's entirely transparent.
 		 */
-		printk("Unknown bridge resource %d: assuming transparent\n", 0);
+		printk(KERN_ERR "Unknown bridge resource %d: assuming transparent\n", 0);
 		child->resource[0] = child->parent->resource[0];
 	}
 
@@ -859,7 +859,7 @@
 		res->name = child->name;
 	} else {
 		/* See comment above. Same thing */
-		printk("Unknown bridge resource %d: assuming transparent\n", 1);
+		printk(KERN_ERR "Unknown bridge resource %d: assuming transparent\n", 1);
 		child->resource[1] = child->parent->resource[1];
 	}
 
@@ -886,7 +886,7 @@
 		res->name = child->name;
 	} else {
 		/* See comments above */
-		printk("Unknown bridge resource %d: assuming transparent\n", 2);
+		printk(KERN_ERR "Unknown bridge resource %d: assuming transparent\n", 2);
 		child->resource[2] = child->parent->resource[2];
 	}
 }
@@ -1484,7 +1484,7 @@
 	page->vaddr = pci_alloc_consistent (pool->dev,
 				pool->allocation, &page->dma);
 	if (page->vaddr) {
-		memset (page->bitmap, ~0, mapsize);	// bit set == free
+		memset (page->bitmap, 0xff, mapsize);	// bit set == free
 		if (pool->flags & SLAB_POISON)
 			memset (page->vaddr, POOL_POISON_BYTE, pool->allocation);
 		list_add (&page->page_list, &pool->page_list);
@@ -1500,7 +1500,7 @@
 is_page_busy (int blocks, unsigned long *bitmap)
 {
 	while (blocks > 0) {
-		if (*bitmap++ != ~0)
+		if (*bitmap++ != ~0UL)
 			return 1;
 		blocks -= BITS_PER_LONG;
 	}
@@ -1589,9 +1589,8 @@
 				i += BITS_PER_LONG, map++) {
 			if (page->bitmap [map] == 0)
 				continue;
-			block = ffs (page->bitmap [map]);
-			if ((i + block) <= pool->blocks_per_page) {
-				block--;
+			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;
@@ -1687,7 +1686,7 @@
 	block %= BITS_PER_LONG;
 
 #ifdef	CONFIG_PCIPOOL_DEBUG
-	if (page->bitmap [map] & (1 << block)) {
+	if (page->bitmap [map] & (1UL << block)) {
 		printk (KERN_ERR "pci_pool_free %s/%s, dma %x already free\n",
 			pool->dev ? pool->dev->slot_name : NULL,
 			pool->name, dma);
@@ -1701,8 +1700,11 @@
 	set_bit (block, &page->bitmap [map]);
 	if (waitqueue_active (&pool->waitq))
 		wake_up (&pool->waitq);
-	else if (!is_page_busy (pool->blocks_per_page, page->bitmap))
-		pool_free_page (pool, page);
+	/*
+	 * 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);
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)