Commit eda60420 authored by David S. Miller's avatar David S. Miller

[NET]: Convert PPC 8xx_io/enet.c away from init_etherdev().

parent 86fa60e5
...@@ -643,7 +643,7 @@ int __init scc_enet_init(void) ...@@ -643,7 +643,7 @@ int __init scc_enet_init(void)
{ {
struct net_device *dev; struct net_device *dev;
struct scc_enet_private *cep; struct scc_enet_private *cep;
int i, j, k; int i, j, k, err;
unsigned char *eap, *ba; unsigned char *eap, *ba;
dma_addr_t mem_addr; dma_addr_t mem_addr;
bd_t *bd; bd_t *bd;
...@@ -659,19 +659,13 @@ int __init scc_enet_init(void) ...@@ -659,19 +659,13 @@ int __init scc_enet_init(void)
bd = (bd_t *)__res; bd = (bd_t *)__res;
/* Allocate some private information. dev = alloc_etherdev(sizeof(*cep));
*/ if (!dev)
cep = (struct scc_enet_private *)kmalloc(sizeof(*cep), GFP_KERNEL);
if (cep == NULL)
return -ENOMEM; return -ENOMEM;
__clear_user(cep,sizeof(*cep)); cep = dev->priv;
spin_lock_init(&cep->lock); spin_lock_init(&cep->lock);
/* Create an Ethernet device instance.
*/
dev = init_etherdev(0, 0);
/* Get pointer to SCC area in parameter RAM. /* Get pointer to SCC area in parameter RAM.
*/ */
ep = (scc_enet_t *)(&cp->cp_dparam[PROFF_ENET]); ep = (scc_enet_t *)(&cp->cp_dparam[PROFF_ENET]);
...@@ -841,6 +835,7 @@ int __init scc_enet_init(void) ...@@ -841,6 +835,7 @@ int __init scc_enet_init(void)
/* Allocate a page. /* Allocate a page.
*/ */
ba = (unsigned char *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr); ba = (unsigned char *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr);
/* BUG: no check for failure */
/* Initialize the BD for every fragment in the page. /* Initialize the BD for every fragment in the page.
*/ */
...@@ -939,7 +934,6 @@ int __init scc_enet_init(void) ...@@ -939,7 +934,6 @@ int __init scc_enet_init(void)
#endif #endif
dev->base_addr = (unsigned long)ep; dev->base_addr = (unsigned long)ep;
dev->priv = cep;
#if 0 #if 0
dev->name = "CPM_ENET"; dev->name = "CPM_ENET";
#endif #endif
...@@ -953,6 +947,12 @@ int __init scc_enet_init(void) ...@@ -953,6 +947,12 @@ int __init scc_enet_init(void)
dev->get_stats = scc_enet_get_stats; dev->get_stats = scc_enet_get_stats;
dev->set_multicast_list = set_multicast_list; dev->set_multicast_list = set_multicast_list;
err = register_netdev(dev);
if (err) {
kfree(dev);
return err;
}
/* And last, enable the transmit and receive processing. /* And last, enable the transmit and receive processing.
*/ */
sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT); sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
......
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