]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/tokenring/proteon.c
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6-omap-h63xx.git] / drivers / net / tokenring / proteon.c
index eb1423ede75cae8032a0729fdb115e54fa9e7c86..cb7dbb63c9d9da6b6794dc30045943f4cac4eced 100644 (file)
@@ -29,6 +29,7 @@ static const char version[] = "proteon.c: v1.00 02/01/2003 by Jochen Friedrich\n
 #include <linux/init.h>
 #include <linux/netdevice.h>
 #include <linux/trdevice.h>
+#include <linux/platform_device.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -343,9 +344,10 @@ module_param_array(dma, int, NULL, 0);
 
 static struct platform_device *proteon_dev[ISATR_MAX_ADAPTERS];
 
-static struct device_driver proteon_driver = {
-       .name           = "proteon",
-       .bus            = &platform_bus_type,
+static struct platform_driver proteon_driver = {
+       .driver         = {
+               .name   = "proteon",
+       },
 };
 
 static int __init proteon_init(void)
@@ -354,7 +356,7 @@ static int __init proteon_init(void)
        struct platform_device *pdev;
        int i, num = 0, err = 0;
 
-       err = driver_register(&proteon_driver);
+       err = platform_driver_register(&proteon_driver);
        if (err)
                return err;
 
@@ -368,10 +370,14 @@ static int __init proteon_init(void)
                dev->dma = dma[i];
                pdev = platform_device_register_simple("proteon",
                        i, NULL, 0);
+               if (IS_ERR(pdev)) {
+                       free_netdev(dev);
+                       continue;
+               }
                err = setup_card(dev, &pdev->dev);
                if (!err) {
                        proteon_dev[i] = pdev;
-                       dev_set_drvdata(&pdev->dev, dev);
+                       platform_set_drvdata(pdev, dev);
                        ++num;
                } else {
                        platform_device_unregister(pdev);
@@ -383,9 +389,10 @@ static int __init proteon_init(void)
        /* Probe for cards. */
        if (num == 0) {
                printk(KERN_NOTICE "proteon.c: No cards found.\n");
-               return (-ENODEV);
+               platform_driver_unregister(&proteon_driver);
+               return -ENODEV;
        }
-       return (0);
+       return 0;
 }
 
 static void __exit proteon_cleanup(void)
@@ -398,17 +405,17 @@ static void __exit proteon_cleanup(void)
                
                if (!pdev)
                        continue;
-               dev = dev_get_drvdata(&pdev->dev);
+               dev = platform_get_drvdata(pdev);
                unregister_netdev(dev);
                release_region(dev->base_addr, PROTEON_IO_EXTENT);
                free_irq(dev->irq, dev);
                free_dma(dev->dma);
                tmsdev_term(dev);
                free_netdev(dev);
-               dev_set_drvdata(&pdev->dev, NULL);
+               platform_set_drvdata(pdev, NULL);
                platform_device_unregister(pdev);
        }
-       driver_unregister(&proteon_driver);
+       platform_driver_unregister(&proteon_driver);
 }
 
 module_init(proteon_init);