]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
mac68k: move macsonic and macmace platform devices
authorFinn Thain <fthain@telegraphics.com.au>
Tue, 3 Nov 2009 13:42:02 +0000 (00:42 +1100)
committerGeert Uytterhoeven <geert@linux-m68k.org>
Sat, 27 Feb 2010 17:31:11 +0000 (18:31 +0100)
Move platform device code from the drivers to the platform init function.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
arch/m68k/mac/config.c
drivers/net/macmace.c
drivers/net/macsonic.c

index 91245ade2290eb7748f7fdda02a9676a00071f60..816452b3e50f9cd733310e1caeb6868a5e0faa5e 100644 (file)
@@ -921,6 +921,16 @@ static struct platform_device esp_1_pdev = {
        .id             = 1,
 };
 
+static struct platform_device sonic_pdev = {
+       .name           = "macsonic",
+       .id             = -1,
+};
+
+static struct platform_device mace_pdev = {
+       .name           = "macmace",
+       .id             = -1,
+};
+
 int __init mac_platform_init(void)
 {
        u8 *swim_base;
@@ -971,6 +981,19 @@ int __init mac_platform_init(void)
                break;
        }
 
+       /*
+        * Ethernet device
+        */
+
+       switch (macintosh_config->ether_type) {
+       case MAC_ETHER_SONIC:
+               platform_device_register(&sonic_pdev);
+               break;
+       case MAC_ETHER_MACE:
+               platform_device_register(&mace_pdev);
+               break;
+       }
+
        return 0;
 }
 
index 44f3c2896f2086cf92510b42761cb4b9b08a2eee..79408c37787503aeb0228b6ed09ec9aa2845adb5 100644 (file)
@@ -39,7 +39,6 @@
 #include "mace.h"
 
 static char mac_mace_string[] = "macmace";
-static struct platform_device *mac_mace_device;
 
 #define N_TX_BUFF_ORDER        0
 #define N_TX_RING      (1 << N_TX_BUFF_ORDER)
@@ -752,6 +751,7 @@ static irqreturn_t mace_dma_intr(int irq, void *dev_id)
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Macintosh MACE ethernet driver");
+MODULE_ALIAS("platform:macmace");
 
 static int __devexit mac_mace_device_remove (struct platform_device *pdev)
 {
@@ -777,47 +777,22 @@ static struct platform_driver mac_mace_driver = {
        .probe  = mace_probe,
        .remove = __devexit_p(mac_mace_device_remove),
        .driver = {
-               .name = mac_mace_string,
+               .name   = mac_mace_string,
+               .owner  = THIS_MODULE,
        },
 };
 
 static int __init mac_mace_init_module(void)
 {
-       int err;
-
        if (!MACH_IS_MAC)
                return -ENODEV;
 
-       if ((err = platform_driver_register(&mac_mace_driver))) {
-               printk(KERN_ERR "Driver registration failed\n");
-               return err;
-       }
-
-       mac_mace_device = platform_device_alloc(mac_mace_string, 0);
-       if (!mac_mace_device)
-               goto out_unregister;
-
-       if (platform_device_add(mac_mace_device)) {
-               platform_device_put(mac_mace_device);
-               mac_mace_device = NULL;
-       }
-
-       return 0;
-
-out_unregister:
-       platform_driver_unregister(&mac_mace_driver);
-
-       return -ENOMEM;
+       return platform_driver_register(&mac_mace_driver);
 }
 
 static void __exit mac_mace_cleanup_module(void)
 {
        platform_driver_unregister(&mac_mace_driver);
-
-       if (mac_mace_device) {
-               platform_device_unregister(mac_mace_device);
-               mac_mace_device = NULL;
-       }
 }
 
 module_init(mac_mace_init_module);
index 875d361fb79d2063dab239284767eb67607c2429..24109c288108109575fdba9d7e0b8cff3c917d9c 100644 (file)
@@ -62,7 +62,6 @@
 #include <asm/mac_via.h>
 
 static char mac_sonic_string[] = "macsonic";
-static struct platform_device *mac_sonic_device;
 
 #include "sonic.h"
 
@@ -607,6 +606,7 @@ out:
 MODULE_DESCRIPTION("Macintosh SONIC ethernet driver");
 module_param(sonic_debug, int, 0);
 MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)");
+MODULE_ALIAS("platform:macsonic");
 
 #include "sonic.c"
 
@@ -627,44 +627,19 @@ static struct platform_driver mac_sonic_driver = {
        .probe  = mac_sonic_probe,
        .remove = __devexit_p(mac_sonic_device_remove),
        .driver = {
-               .name = mac_sonic_string,
+               .name   = mac_sonic_string,
+               .owner  = THIS_MODULE,
        },
 };
 
 static int __init mac_sonic_init_module(void)
 {
-       int err;
-
-       if ((err = platform_driver_register(&mac_sonic_driver))) {
-               printk(KERN_ERR "Driver registration failed\n");
-               return err;
-       }
-
-       mac_sonic_device = platform_device_alloc(mac_sonic_string, 0);
-       if (!mac_sonic_device)
-               goto out_unregister;
-
-       if (platform_device_add(mac_sonic_device)) {
-               platform_device_put(mac_sonic_device);
-               mac_sonic_device = NULL;
-       }
-
-       return 0;
-
-out_unregister:
-       platform_driver_unregister(&mac_sonic_driver);
-
-       return -ENOMEM;
+       return platform_driver_register(&mac_sonic_driver);
 }
 
 static void __exit mac_sonic_cleanup_module(void)
 {
        platform_driver_unregister(&mac_sonic_driver);
-
-       if (mac_sonic_device) {
-               platform_device_unregister(mac_sonic_device);
-               mac_sonic_device = NULL;
-       }
 }
 
 module_init(mac_sonic_init_module);