
From: Domen Puncer <domen@coderock.org>

The problem in pcnet32 is, that it doesn't unregister pci, if there's no
hardware.

This patch solves the problem.



 drivers/net/pcnet32.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff -puN drivers/net/pcnet32.c~pcnet32-unregister_pci-fix drivers/net/pcnet32.c
--- 25/drivers/net/pcnet32.c~pcnet32-unregister_pci-fix	2003-08-24 23:51:21.000000000 -0700
+++ 25-akpm/drivers/net/pcnet32.c	2003-08-24 23:51:21.000000000 -0700
@@ -1726,6 +1726,7 @@ MODULE_LICENSE("GPL");
 /* An additional parameter that may be passed in... */
 static int debug = -1;
 static int tx_start_pt = -1;
+static int pcnet32_have_pci;
 
 static int __init pcnet32_init_module(void)
 {
@@ -1738,7 +1739,8 @@ static int __init pcnet32_init_module(vo
 	tx_start = tx_start_pt;
 
     /* find the PCI devices */
-    pci_module_init(&pcnet32_driver);
+    if (!pci_module_init(&pcnet32_driver))
+	pcnet32_have_pci = 1;
 
     /* should we find any remaining VLbus devices ? */
     if (pcnet32vlb)
@@ -1747,7 +1749,7 @@ static int __init pcnet32_init_module(vo
     if (cards_found)
 	printk(KERN_INFO PFX "%d cards_found.\n", cards_found);
     
-    return cards_found ? 0 : -ENODEV;
+    return (pcnet32_have_pci + cards_found) ? 0 : -ENODEV;
 }
 
 static void __exit pcnet32_cleanup_module(void)
@@ -1765,6 +1767,9 @@ static void __exit pcnet32_cleanup_modul
 	free_netdev(pcnet32_dev);
 	pcnet32_dev = next_dev;
     }
+
+    if (pcnet32_have_pci)
+	pci_unregister_driver(&pcnet32_driver);
 }
 
 module_init(pcnet32_init_module);

_
