summaryrefslogtreecommitdiff
path: root/drivers/net/mipsnet.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2007-03-18 23:21:22 +0000
committerJeff Garzik <jeff@garzik.org>2007-04-28 11:01:01 -0400
commit1e2b980fdfb6189baa779ba7de93f7dba70aa3fd (patch)
treecd3188ada5197acb52c8322b560915524c797f16 /drivers/net/mipsnet.c
parenta5f8f3b6c91b07ee9aa2445a92a1d6c00a71a3cd (diff)
MIPSnet: Modernize use platform_device API.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/mipsnet.c')
-rw-r--r--drivers/net/mipsnet.c53
1 files changed, 2 insertions, 51 deletions
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 {
struct net_device_stats stats;
};
-static struct platform_device *mips_plat_dev;
-
static char mipsnet_string[] = "mipsnet";
/*
@@ -297,64 +295,17 @@ static struct device_driver mipsnet_driver = {
.remove = __devexit_p(mipsnet_device_remove),
};
-static void mipsnet_platform_release(struct device *device)
-{
- struct platform_device *pldev;
-
- /* free device */
- pldev = to_platform_device(device);
- kfree(pldev);
-}
-
static int __init mipsnet_init_module(void)
{
- struct platform_device *pldev;
int err;
printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. "
"(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION);
- if (driver_register(&mipsnet_driver)) {
+ err = driver_register(&mipsnet_driver);
+ if (err)
printk(KERN_ERR "Driver registration failed\n");
- err = -ENODEV;
- goto out;
- }
-
- if (!(pldev = kmalloc (sizeof (*pldev), GFP_KERNEL))) {
- err = -ENOMEM;
- goto out_unregister_driver;
- }
-
- memset (pldev, 0, sizeof (*pldev));
- pldev->name = mipsnet_string;
- pldev->id = 0;
- pldev->dev.release = mipsnet_platform_release;
- if (platform_device_register(pldev)) {
- err = -ENODEV;
- goto out_free_pldev;
- }
-
- if (!pldev->dev.driver) {
- /*
- * The driver was not bound to this device, there was
- * no hardware at this address. Unregister it, as the
- * release fuction will take care of freeing the
- * allocated structure
- */
- platform_device_unregister (pldev);
- }
-
- mips_plat_dev = pldev;
-
- return 0;
-
-out_free_pldev:
- kfree(pldev);
-
-out_unregister_driver:
- driver_unregister(&mipsnet_driver);
-out:
return err;
}