aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/mipsnet.c53
2 files changed, 4 insertions, 53 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 3e9b37055ea4..ee920ad1a5f5 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -486,8 +486,8 @@ config SGI_IOC3_ETH_HW_TX_CSUM
486 enables offloading for checksums on transmit. If unsure, say Y. 486 enables offloading for checksums on transmit. If unsure, say Y.
487 487
488config MIPS_SIM_NET 488config MIPS_SIM_NET
489 tristate "MIPS simulator Network device (EXPERIMENTAL)" 489 tristate "MIPS simulator Network device"
490 depends on MIPS_SIM && EXPERIMENTAL 490 depends on NET_ETHERNET && MIPS_SIM
491 help 491 help
492 The MIPSNET device is a simple Ethernet network device which is 492 The MIPSNET device is a simple Ethernet network device which is
493 emulated by the MIPS Simulator. 493 emulated by the MIPS Simulator.
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c
index 403f63afd201..638a279ec505 100644
--- a/drivers/net/mipsnet.c
+++ b/drivers/net/mipsnet.c
@@ -26,8 +26,6 @@ struct mipsnet_priv {
26 struct net_device_stats stats; 26 struct net_device_stats stats;
27}; 27};
28 28
29static struct platform_device *mips_plat_dev;
30
31static char mipsnet_string[] = "mipsnet"; 29static char mipsnet_string[] = "mipsnet";
32 30
33/* 31/*
@@ -297,64 +295,17 @@ static struct device_driver mipsnet_driver = {
297 .remove = __devexit_p(mipsnet_device_remove), 295 .remove = __devexit_p(mipsnet_device_remove),
298}; 296};
299 297
300static void mipsnet_platform_release(struct device *device)
301{
302 struct platform_device *pldev;
303
304 /* free device */
305 pldev = to_platform_device(device);
306 kfree(pldev);
307}
308
309static int __init mipsnet_init_module(void) 298static int __init mipsnet_init_module(void)
310{ 299{
311 struct platform_device *pldev;
312 int err; 300 int err;
313 301
314 printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. " 302 printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. "
315 "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION); 303 "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION);
316 304
317 if (driver_register(&mipsnet_driver)) { 305 err = driver_register(&mipsnet_driver);
306 if (err)
318 printk(KERN_ERR "Driver registration failed\n"); 307 printk(KERN_ERR "Driver registration failed\n");
319 err = -ENODEV;
320 goto out;
321 }
322
323 if (!(pldev = kmalloc (sizeof (*pldev), GFP_KERNEL))) {
324 err = -ENOMEM;
325 goto out_unregister_driver;
326 }
327
328 memset (pldev, 0, sizeof (*pldev));
329 pldev->name = mipsnet_string;
330 pldev->id = 0;
331 pldev->dev.release = mipsnet_platform_release;
332 308
333 if (platform_device_register(pldev)) {
334 err = -ENODEV;
335 goto out_free_pldev;
336 }
337
338 if (!pldev->dev.driver) {
339 /*
340 * The driver was not bound to this device, there was
341 * no hardware at this address. Unregister it, as the
342 * release fuction will take care of freeing the
343 * allocated structure
344 */
345 platform_device_unregister (pldev);
346 }
347
348 mips_plat_dev = pldev;
349
350 return 0;
351
352out_free_pldev:
353 kfree(pldev);
354
355out_unregister_driver:
356 driver_unregister(&mipsnet_driver);
357out:
358 return err; 309 return err;
359} 310}
360 311