public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.6.0 aic7xxx and aic79xx stale pci_device list entry
@ 2004-01-02 20:50 Eric Kerin
  2004-01-03  9:01 ` Arjan van de Ven
  2004-01-03 22:24 ` Justin T. Gibbs
  0 siblings, 2 replies; 11+ messages in thread
From: Eric Kerin @ 2004-01-02 20:50 UTC (permalink / raw)
  To: linux-scsi

Loading the aic7xxx or aic79xx modules, on a machine that did not
contain the card, left a stale entry in the pci_device list.  This
caused an oops upon loading the next module that registered a
pci_device. 

The patches below will unregister the pci_device if it successfully
registers the device, but does not find any cards. 

Comments are appreciated.


Also, I created a bug in bugzilla.kernel.org for this (before I got in
the mood to fix it myself). What should I do about closing it out?
Attach the patch, or put "posted fix to linux-scsi mailing list"?


Eric Kerin



diff -puN aic7xxx_osm.c aic7xxx_osm.c.oopsfix
--- aic7xxx_osm.c	2004-01-02 03:56:32.606291000 -0500
+++ aic7xxx_osm.c.oopsfix	2004-01-02 03:53:15.236291000 -0500
@@ -844,7 +844,8 @@ ahc_linux_detect(Scsi_Host_Template *tem
 {
 	struct	ahc_softc *ahc;
 	int     found;
-
+	int	pci_reg_stat;
+	
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 	/*
 	 * It is a bug that the upper layer takes
@@ -891,8 +892,9 @@ ahc_linux_detect(Scsi_Host_Template *tem
 	 */
 	ahc_list_lockinit();
 
+	pci_reg_stat = -1;
 #ifdef CONFIG_PCI
-	ahc_linux_pci_init();
+	pci_reg_stat = ahc_linux_pci_init();
 #endif
 
 #ifdef CONFIG_EISA
@@ -913,7 +915,24 @@ ahc_linux_detect(Scsi_Host_Template *tem
 	spin_lock_irq(&io_request_lock);
 #endif
 	aic7xxx_detect_complete++;
-	return (found);
+	if(found){
+		return (found);
+	}
+
+	/*
+	 * Cleanup everything we registered, 
+	 * because we didn't find any cards.
+	 */
+	
+#ifdef CONFIG_PCI
+	if(pci_reg_stat == 0){
+		ahc_linux_pci_exit();
+	}
+#endif
+#ifdef CONFIG_EISA
+	ahc_linux_eisa_exit();
+#endif
+	return 0;
 }
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)

 



 
diff -puN aic79xx_osm.c aic79xx_osm.c.oopsfix
--- aic79xx_osm.c	2004-01-02 02:46:43.000000000 -0500
+++ aic79xx_osm.c.oopsfix	2004-01-02 03:54:43.846291000 -0500
@@ -856,7 +856,8 @@ ahd_linux_detect(Scsi_Host_Template *tem
 {
 	struct	ahd_softc *ahd;
 	int     found;
-
+	int	pci_reg_stat;
+	
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 	/*
 	 * It is a bug that the upper layer takes
@@ -906,8 +907,9 @@ ahd_linux_detect(Scsi_Host_Template *tem
 	 */
 	ahd_list_lockinit();
 
+	pci_reg_stat = -1;
 #ifdef CONFIG_PCI
-	ahd_linux_pci_init();
+	pci_reg_stat = ahd_linux_pci_init();
 #endif
 
 	/*
@@ -924,7 +926,20 @@ ahd_linux_detect(Scsi_Host_Template *tem
 	spin_lock_irq(&io_request_lock);
 #endif
 	aic79xx_detect_complete++;
-	return (found);
+	if(found){
+		return (found);
+	}
+
+	/*
+	 * Cleanup everything we registered, 
+	 * because we didn't find any cards.
+	 */
+#ifdef CONFIG_PCI	
+	if(pci_reg_stat == 0){
+		ahd_linux_pci_exit();
+	}
+#endif	
+	return 0;
 }
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)



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

end of thread, other threads:[~2004-01-30 15:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-02 20:50 [PATCH] 2.6.0 aic7xxx and aic79xx stale pci_device list entry Eric Kerin
2004-01-03  9:01 ` Arjan van de Ven
2004-01-03 11:12   ` Eric Kerin
2004-01-03 13:59     ` Jan-Benedict Glaw
2004-01-24 16:09     ` Eric Kerin
2004-01-03 22:24   ` Justin T. Gibbs
2004-01-04 10:04     ` Arjan van de Ven
2004-01-30  5:25       ` Justin T. Gibbs
2004-01-30 14:41         ` Arjan van de Ven
2004-01-30 15:03           ` Justin T. Gibbs
2004-01-03 22:24 ` Justin T. Gibbs

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