Commit eeb9c182 authored by Finn Thain's avatar Finn Thain Committed by Geert Uytterhoeven

mac68k: move macsonic and macmace platform devices

Move platform device code from the drivers to the platform init function.
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent cff75f1f
...@@ -921,6 +921,16 @@ static struct platform_device esp_1_pdev = { ...@@ -921,6 +921,16 @@ static struct platform_device esp_1_pdev = {
.id = 1, .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) int __init mac_platform_init(void)
{ {
u8 *swim_base; u8 *swim_base;
...@@ -971,6 +981,19 @@ int __init mac_platform_init(void) ...@@ -971,6 +981,19 @@ int __init mac_platform_init(void)
break; 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; return 0;
} }
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "mace.h" #include "mace.h"
static char mac_mace_string[] = "macmace"; static char mac_mace_string[] = "macmace";
static struct platform_device *mac_mace_device;
#define N_TX_BUFF_ORDER 0 #define N_TX_BUFF_ORDER 0
#define N_TX_RING (1 << N_TX_BUFF_ORDER) #define N_TX_RING (1 << N_TX_BUFF_ORDER)
...@@ -752,6 +751,7 @@ static irqreturn_t mace_dma_intr(int irq, void *dev_id) ...@@ -752,6 +751,7 @@ static irqreturn_t mace_dma_intr(int irq, void *dev_id)
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Macintosh MACE ethernet driver"); MODULE_DESCRIPTION("Macintosh MACE ethernet driver");
MODULE_ALIAS("platform:macmace");
static int __devexit mac_mace_device_remove (struct platform_device *pdev) static int __devexit mac_mace_device_remove (struct platform_device *pdev)
{ {
...@@ -777,47 +777,22 @@ static struct platform_driver mac_mace_driver = { ...@@ -777,47 +777,22 @@ static struct platform_driver mac_mace_driver = {
.probe = mace_probe, .probe = mace_probe,
.remove = __devexit_p(mac_mace_device_remove), .remove = __devexit_p(mac_mace_device_remove),
.driver = { .driver = {
.name = mac_mace_string, .name = mac_mace_string,
.owner = THIS_MODULE,
}, },
}; };
static int __init mac_mace_init_module(void) static int __init mac_mace_init_module(void)
{ {
int err;
if (!MACH_IS_MAC) if (!MACH_IS_MAC)
return -ENODEV; return -ENODEV;
if ((err = platform_driver_register(&mac_mace_driver))) { return 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;
} }
static void __exit mac_mace_cleanup_module(void) static void __exit mac_mace_cleanup_module(void)
{ {
platform_driver_unregister(&mac_mace_driver); 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); module_init(mac_mace_init_module);
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
#include <asm/mac_via.h> #include <asm/mac_via.h>
static char mac_sonic_string[] = "macsonic"; static char mac_sonic_string[] = "macsonic";
static struct platform_device *mac_sonic_device;
#include "sonic.h" #include "sonic.h"
...@@ -607,6 +606,7 @@ out: ...@@ -607,6 +606,7 @@ out:
MODULE_DESCRIPTION("Macintosh SONIC ethernet driver"); MODULE_DESCRIPTION("Macintosh SONIC ethernet driver");
module_param(sonic_debug, int, 0); module_param(sonic_debug, int, 0);
MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)"); MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)");
MODULE_ALIAS("platform:macsonic");
#include "sonic.c" #include "sonic.c"
...@@ -627,44 +627,19 @@ static struct platform_driver mac_sonic_driver = { ...@@ -627,44 +627,19 @@ static struct platform_driver mac_sonic_driver = {
.probe = mac_sonic_probe, .probe = mac_sonic_probe,
.remove = __devexit_p(mac_sonic_device_remove), .remove = __devexit_p(mac_sonic_device_remove),
.driver = { .driver = {
.name = mac_sonic_string, .name = mac_sonic_string,
.owner = THIS_MODULE,
}, },
}; };
static int __init mac_sonic_init_module(void) static int __init mac_sonic_init_module(void)
{ {
int err; return platform_driver_register(&mac_sonic_driver);
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;
} }
static void __exit mac_sonic_cleanup_module(void) static void __exit mac_sonic_cleanup_module(void)
{ {
platform_driver_unregister(&mac_sonic_driver); 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); module_init(mac_sonic_init_module);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment