| 
				
			 | 
			
			
				
				@@ -165,23 +165,22 @@ void adjust_pci_device ( struct pci_device *pci ) { 
			 | 
		
		
	
		
			
			| 
				165
			 | 
			
				165
			 | 
			
			
				
				 } 
			 | 
		
		
	
		
			
			| 
				166
			 | 
			
				166
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				167
			 | 
			
				167
			 | 
			
			
				
				 /** 
			 | 
		
		
	
		
			
			| 
				168
			 | 
			
				
			 | 
			
			
				
				- * Register PCI device 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				168
			 | 
			
			
				
				+ * Probe a PCI device 
			 | 
		
		
	
		
			
			| 
				169
			 | 
			
				169
			 | 
			
			
				
				  * 
			 | 
		
		
	
		
			
			| 
				170
			 | 
			
				170
			 | 
			
			
				
				  * @v pci		PCI device 
			 | 
		
		
	
		
			
			| 
				171
			 | 
			
				171
			 | 
			
			
				
				  * @ret rc		Return status code 
			 | 
		
		
	
		
			
			| 
				172
			 | 
			
				172
			 | 
			
			
				
				  * 
			 | 
		
		
	
		
			
			| 
				173
			 | 
			
				173
			 | 
			
			
				
				  * Searches for a driver for the PCI device.  If a driver is found, 
			 | 
		
		
	
		
			
			| 
				174
			 | 
			
				
			 | 
			
			
				
				- * its probe() routine is called, and the device is added to the 
			 | 
		
		
	
		
			
			| 
				175
			 | 
			
				
			 | 
			
			
				
				- * device hierarchy. 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				174
			 | 
			
			
				
				+ * its probe() routine is called. 
			 | 
		
		
	
		
			
			| 
				176
			 | 
			
				175
			 | 
			
			
				
				  */ 
			 | 
		
		
	
		
			
			| 
				177
			 | 
			
				
			 | 
			
			
				
				-static int register_pcidev ( struct pci_device *pci ) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				176
			 | 
			
			
				
				+static int pci_probe ( struct pci_device *pci ) { 
			 | 
		
		
	
		
			
			| 
				178
			 | 
			
				177
			 | 
			
			
				
				 	struct pci_driver *driver; 
			 | 
		
		
	
		
			
			| 
				179
			 | 
			
				178
			 | 
			
			
				
				 	struct pci_device_id *id; 
			 | 
		
		
	
		
			
			| 
				180
			 | 
			
				179
			 | 
			
			
				
				 	unsigned int i; 
			 | 
		
		
	
		
			
			| 
				181
			 | 
			
				180
			 | 
			
			
				
				 	int rc; 
			 | 
		
		
	
		
			
			| 
				182
			 | 
			
				181
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				183
			 | 
			
				
			 | 
			
			
				
				-	DBG ( "Registering PCI device %02x:%02x.%x (%04x:%04x mem %lx " 
			 | 
		
		
	
		
			
			| 
				184
			 | 
			
				
			 | 
			
			
				
				-	      "io %lx irq %d)\n", pci->bus, PCI_SLOT ( pci->devfn ), 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				182
			 | 
			
			
				
				+	DBG ( "Adding PCI device %02x:%02x.%x (%04x:%04x mem %lx io %lx " 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				183
			 | 
			
			
				
				+	      "irq %d)\n", pci->bus, PCI_SLOT ( pci->devfn ), 
			 | 
		
		
	
		
			
			| 
				185
			 | 
			
				184
			 | 
			
			
				
				 	      PCI_FUNC ( pci->devfn ), pci->vendor, pci->device, 
			 | 
		
		
	
		
			
			| 
				186
			 | 
			
				185
			 | 
			
			
				
				 	      pci->membase, pci->ioaddr, pci->irq ); 
			 | 
		
		
	
		
			
			| 
				187
			 | 
			
				186
			 | 
			
			
				
				  
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -198,8 +197,6 @@ static int register_pcidev ( struct pci_device *pci ) { 
			 | 
		
		
	
		
			
			| 
				198
			 | 
			
				197
			 | 
			
			
				
				 				DBG ( "......probe failed\n" ); 
			 | 
		
		
	
		
			
			| 
				199
			 | 
			
				198
			 | 
			
			
				
				 				continue; 
			 | 
		
		
	
		
			
			| 
				200
			 | 
			
				199
			 | 
			
			
				
				 			} 
			 | 
		
		
	
		
			
			| 
				201
			 | 
			
				
			 | 
			
			
				
				-			list_add ( &pci->dev.siblings, 
			 | 
		
		
	
		
			
			| 
				202
			 | 
			
				
			 | 
			
			
				
				-				   &pci->dev.parent->children ); 
			 | 
		
		
	
		
			
			| 
				203
			 | 
			
				200
			 | 
			
			
				
				 			return 0; 
			 | 
		
		
	
		
			
			| 
				204
			 | 
			
				201
			 | 
			
			
				
				 		} 
			 | 
		
		
	
		
			
			| 
				205
			 | 
			
				202
			 | 
			
			
				
				 	} 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -209,17 +206,13 @@ static int register_pcidev ( struct pci_device *pci ) { 
			 | 
		
		
	
		
			
			| 
				209
			 | 
			
				206
			 | 
			
			
				
				 } 
			 | 
		
		
	
		
			
			| 
				210
			 | 
			
				207
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				211
			 | 
			
				208
			 | 
			
			
				
				 /** 
			 | 
		
		
	
		
			
			| 
				212
			 | 
			
				
			 | 
			
			
				
				- * Unregister a PCI device 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				209
			 | 
			
			
				
				+ * Remove a PCI device 
			 | 
		
		
	
		
			
			| 
				213
			 | 
			
				210
			 | 
			
			
				
				  * 
			 | 
		
		
	
		
			
			| 
				214
			 | 
			
				211
			 | 
			
			
				
				  * @v pci		PCI device 
			 | 
		
		
	
		
			
			| 
				215
			 | 
			
				
			 | 
			
			
				
				- * 
			 | 
		
		
	
		
			
			| 
				216
			 | 
			
				
			 | 
			
			
				
				- * Calls the device's driver's remove() routine, and removes the 
			 | 
		
		
	
		
			
			| 
				217
			 | 
			
				
			 | 
			
			
				
				- * device from the device hierarchy. 
			 | 
		
		
	
		
			
			| 
				218
			 | 
			
				212
			 | 
			
			
				
				  */ 
			 | 
		
		
	
		
			
			| 
				219
			 | 
			
				
			 | 
			
			
				
				-static void unregister_pcidev ( struct pci_device *pci ) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				213
			 | 
			
			
				
				+static void pci_remove ( struct pci_device *pci ) { 
			 | 
		
		
	
		
			
			| 
				220
			 | 
			
				214
			 | 
			
			
				
				 	pci->driver->remove ( pci ); 
			 | 
		
		
	
		
			
			| 
				221
			 | 
			
				
			 | 
			
			
				
				-	list_del ( &pci->dev.siblings ); 
			 | 
		
		
	
		
			
			| 
				222
			 | 
			
				
			 | 
			
			
				
				-	DBG ( "Unregistered PCI device %02x:%02x.%x\n", pci->bus, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				215
			 | 
			
			
				
				+	DBG ( "Removed PCI device %02x:%02x.%x\n", pci->bus, 
			 | 
		
		
	
		
			
			| 
				223
			 | 
			
				216
			 | 
			
			
				
				 	      PCI_SLOT ( pci->devfn ), PCI_FUNC ( pci->devfn ) ); 
			 | 
		
		
	
		
			
			| 
				224
			 | 
			
				217
			 | 
			
			
				
				 } 
			 | 
		
		
	
		
			
			| 
				225
			 | 
			
				218
			 | 
			
			
				
				  
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -278,15 +271,19 @@ static int pcibus_probe ( struct root_device *rootdev ) { 
			 | 
		
		
	
		
			
			| 
				278
			 | 
			
				271
			 | 
			
			
				
				 			pci_read_config_byte ( pci, PCI_INTERRUPT_LINE, 
			 | 
		
		
	
		
			
			| 
				279
			 | 
			
				272
			 | 
			
			
				
				 					       &pci->irq ); 
			 | 
		
		
	
		
			
			| 
				280
			 | 
			
				273
			 | 
			
			
				
				 			pci_read_bases ( pci ); 
			 | 
		
		
	
		
			
			| 
				281
			 | 
			
				
			 | 
			
			
				
				-			INIT_LIST_HEAD ( &pci->dev.children ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				274
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				275
			 | 
			
			
				
				+			/* Add to device hierarchy */ 
			 | 
		
		
	
		
			
			| 
				282
			 | 
			
				276
			 | 
			
			
				
				 			pci->dev.parent = &rootdev->dev; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				277
			 | 
			
			
				
				+			list_add ( &pci->dev.siblings, &rootdev->dev.children); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				278
			 | 
			
			
				
				+			INIT_LIST_HEAD ( &pci->dev.children ); 
			 | 
		
		
	
		
			
			| 
				283
			 | 
			
				279
			 | 
			
			
				
				 			 
			 | 
		
		
	
		
			
			| 
				284
			 | 
			
				280
			 | 
			
			
				
				 			/* Look for a driver */ 
			 | 
		
		
	
		
			
			| 
				285
			 | 
			
				
			 | 
			
			
				
				-			if ( register_pcidev ( pci ) == 0 ) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				281
			 | 
			
			
				
				+			if ( pci_probe ( pci ) == 0 ) { 
			 | 
		
		
	
		
			
			| 
				286
			 | 
			
				282
			 | 
			
			
				
				 				/* pcidev registered, we can drop our ref */ 
			 | 
		
		
	
		
			
			| 
				287
			 | 
			
				283
			 | 
			
			
				
				 				pci = NULL; 
			 | 
		
		
	
		
			
			| 
				288
			 | 
			
				284
			 | 
			
			
				
				 			} else { 
			 | 
		
		
	
		
			
			| 
				289
			 | 
			
				285
			 | 
			
			
				
				 				/* Not registered; re-use struct pci_device */ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				286
			 | 
			
			
				
				+				list_del ( &pci->dev.siblings ); 
			 | 
		
		
	
		
			
			| 
				290
			 | 
			
				287
			 | 
			
			
				
				 			} 
			 | 
		
		
	
		
			
			| 
				291
			 | 
			
				288
			 | 
			
			
				
				 		} 
			 | 
		
		
	
		
			
			| 
				292
			 | 
			
				289
			 | 
			
			
				
				 	} 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -311,7 +308,8 @@ static void pcibus_remove ( struct root_device *rootdev ) { 
			 | 
		
		
	
		
			
			| 
				311
			 | 
			
				308
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				312
			 | 
			
				309
			 | 
			
			
				
				 	list_for_each_entry_safe ( pci, tmp, &rootdev->dev.children, 
			 | 
		
		
	
		
			
			| 
				313
			 | 
			
				310
			 | 
			
			
				
				 				   dev.siblings ) { 
			 | 
		
		
	
		
			
			| 
				314
			 | 
			
				
			 | 
			
			
				
				-		unregister_pcidev ( pci ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				311
			 | 
			
			
				
				+		pci_remove ( pci ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				312
			 | 
			
			
				
				+		list_del ( &pci->dev.siblings ); 
			 | 
		
		
	
		
			
			| 
				315
			 | 
			
				313
			 | 
			
			
				
				 		free ( pci ); 
			 | 
		
		
	
		
			
			| 
				316
			 | 
			
				314
			 | 
			
			
				
				 	} 
			 | 
		
		
	
		
			
			| 
				317
			 | 
			
				315
			 | 
			
			
				
				 } 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -326,7 +324,4 @@ static struct root_driver pci_root_driver = { 
			 | 
		
		
	
		
			
			| 
				326
			 | 
			
				324
			 | 
			
			
				
				 struct root_device pci_root_device __root_device = { 
			 | 
		
		
	
		
			
			| 
				327
			 | 
			
				325
			 | 
			
			
				
				 	.name = "PCI", 
			 | 
		
		
	
		
			
			| 
				328
			 | 
			
				326
			 | 
			
			
				
				 	.driver = &pci_root_driver, 
			 | 
		
		
	
		
			
			| 
				329
			 | 
			
				
			 | 
			
			
				
				-	.dev = { 
			 | 
		
		
	
		
			
			| 
				330
			 | 
			
				
			 | 
			
			
				
				-		.children = LIST_HEAD_INIT ( pci_root_device.dev.children ), 
			 | 
		
		
	
		
			
			| 
				331
			 | 
			
				
			 | 
			
			
				
				-	}, 
			 | 
		
		
	
		
			
			| 
				332
			 | 
			
				327
			 | 
			
			
				
				 }; 
			 |