Browse Source

Add missing {register,free}_netdev().

Tie into existing driver API; we'll fix that up soon.
tags/v0.9.3
Michael Brown 18 years ago
parent
commit
fcf765e42d
1 changed files with 15 additions and 1 deletions
  1. 15
    1
      src/drivers/net/pnic.c

+ 15
- 1
src/drivers/net/pnic.c View File

@@ -191,6 +191,7 @@ static void pnic_remove ( struct pci_device *pci ) {
191 191
 
192 192
 	unregister_netdev ( netdev );
193 193
 	pnic_command ( pnic, PNIC_CMD_RESET, NULL, 0, NULL, 0, NULL );
194
+	free_netdev ( netdev );
194 195
 }
195 196
 
196 197
 /**************************************************************************
@@ -233,6 +234,10 @@ static int pnic_probe ( struct pci_device *pci ) {
233 234
 	netdev->poll	 = pnic_poll;
234 235
 	netdev->transmit = pnic_transmit;
235 236
 
237
+	/* Register network device */
238
+	if ( ( rc = register_netdev ( netdev ) ) != 0 )
239
+		goto err;
240
+
236 241
 	return 0;
237 242
 
238 243
  err:
@@ -256,8 +261,17 @@ static struct pci_driver pnic_driver = {
256 261
 
257 262
 // PCI_DRIVER ( pnic_driver );
258 263
 
264
+
265
+static int pnic_hack_probe ( void *dummy, struct pci_device *pci ) {
266
+	return ( pnic_probe ( pci ) == 0 );
267
+}
268
+
269
+static void pnic_hack_disable ( void *dummy, struct pci_device *pci ) {
270
+	pnic_remove ( pci );
271
+}
272
+
259 273
 #include "dev.h"
260 274
 extern struct type_driver test_driver;
261 275
 
262 276
 DRIVER ( "PNIC", test_driver, pci_driver, pnic_driver,
263
-	 pnic_probe, pnic_remove );
277
+	 pnic_hack_probe, pnic_hack_disable );

Loading…
Cancel
Save