Commit 3eb8c6c0 authored by David S. Miller's avatar David S. Miller

Merge davem@nuts.ninka.net:/home/davem/src/BK/net-2.5

into kernel.bkbits.net:/home/davem/net-2.5
parents 9e319251 d965ce81
...@@ -24,18 +24,13 @@ void daemon_init(struct net_device *dev, void *data) ...@@ -24,18 +24,13 @@ void daemon_init(struct net_device *dev, void *data)
struct daemon_data *dpri; struct daemon_data *dpri;
struct daemon_init *init = data; struct daemon_init *init = data;
init_etherdev(dev, 0);
pri = dev->priv; pri = dev->priv;
dpri = (struct daemon_data *) pri->user; dpri = (struct daemon_data *) pri->user;
*dpri = ((struct daemon_data) dpri->sock_type = init->sock_type;
{ .sock_type = init->sock_type, dpri->ctl_sock = init->ctl_sock;
.ctl_sock = init->ctl_sock, dpri->fd = -1;
.ctl_addr = NULL, dpri->control = -1;
.data_addr = NULL, dpri->dev = dev;
.local_addr = NULL,
.fd = -1,
.control = -1,
.dev = dev });
printk("daemon backend (uml_switch version %d) - %s:%s", printk("daemon backend (uml_switch version %d) - %s:%s",
SWITCH_VERSION, dpri->sock_type, dpri->ctl_sock); SWITCH_VERSION, dpri->sock_type, dpri->ctl_sock);
......
...@@ -32,15 +32,13 @@ void mcast_init(struct net_device *dev, void *data) ...@@ -32,15 +32,13 @@ void mcast_init(struct net_device *dev, void *data)
struct mcast_data *dpri; struct mcast_data *dpri;
struct mcast_init *init = data; struct mcast_init *init = data;
init_etherdev(dev, 0);
pri = dev->priv; pri = dev->priv;
dpri = (struct mcast_data *) pri->user; dpri = (struct mcast_data *) pri->user;
*dpri = ((struct mcast_data) dpri->addr = init->addr;
{ .addr = init->addr, dpri->port = init->port;
.port = init->port, dpri->ttl = init->ttl;
.ttl = init->ttl, dpri->dev = dev;
.mcast_addr = NULL,
.dev = dev });
printk("mcast backend "); printk("mcast backend ");
printk("multicast adddress: %s:%u, TTL:%u ", printk("multicast adddress: %s:%u, TTL:%u ",
dpri->addr, dpri->port, dpri->ttl); dpri->addr, dpri->port, dpri->ttl);
......
...@@ -292,45 +292,46 @@ static int eth_configure(int n, void *init, char *mac, ...@@ -292,45 +292,46 @@ static int eth_configure(int n, void *init, char *mac,
struct uml_net *device; struct uml_net *device;
struct net_device *dev; struct net_device *dev;
struct uml_net_private *lp; struct uml_net_private *lp;
int save, err, size; int err, size;
size = transport->private_size + sizeof(struct uml_net_private) + size = transport->private_size + sizeof(struct uml_net_private) +
sizeof(((struct uml_net_private *) 0)->user); sizeof(((struct uml_net_private *) 0)->user);
device = kmalloc(sizeof(*device), GFP_KERNEL); device = kmalloc(sizeof(*device), GFP_KERNEL);
if(device == NULL){ if (device == NULL) {
printk(KERN_ERR "eth_configure failed to allocate uml_net\n"); printk(KERN_ERR "eth_configure failed to allocate uml_net\n");
return(1); return(1);
} }
*device = ((struct uml_net) { .list = LIST_HEAD_INIT(device->list), memset(device, 0, sizeof(*device));
.dev = NULL, device->list = INIT_LIST_HEAD(device->list);
.index = n, device->index = n;
.mac = { [ 0 ... 5 ] = 0 },
.have_mac = 0 });
spin_lock(&devices_lock); spin_lock(&devices_lock);
list_add(&device->list, &devices); list_add(&device->list, &devices);
spin_unlock(&devices_lock); spin_unlock(&devices_lock);
if(setup_etheraddr(mac, device->mac)) if (setup_etheraddr(mac, device->mac))
device->have_mac = 1; device->have_mac = 1;
printk(KERN_INFO "Netdevice %d ", n); printk(KERN_INFO "Netdevice %d ", n);
if(device->have_mac) printk("(%02x:%02x:%02x:%02x:%02x:%02x) ", if (device->have_mac)
device->mac[0], device->mac[1], printk("(%02x:%02x:%02x:%02x:%02x:%02x) ",
device->mac[2], device->mac[3], device->mac[0], device->mac[1],
device->mac[4], device->mac[5]); device->mac[2], device->mac[3],
device->mac[4], device->mac[5]);
printk(": "); printk(": ");
dev = kmalloc(sizeof(*dev) + size, GFP_KERNEL); dev = alloc_etherdev(size);
if(dev == NULL){ if (dev == NULL) {
printk(KERN_ERR "eth_configure: failed to allocate device\n"); printk(KERN_ERR "eth_configure: failed to allocate device\n");
return(1); return 1;
} }
memset(dev, 0, sizeof(*dev) + size);
/* If this name ends up conflicting with an existing registered
* netdevice, that is OK, register_netdev{,ice}() will notice this
* and fail.
*/
snprintf(dev->name, sizeof(dev->name), "eth%d", n); snprintf(dev->name, sizeof(dev->name), "eth%d", n);
dev->priv = (void *) &dev[1];
device->dev = dev; device->dev = dev;
dev->hard_header = uml_net_hard_header; dev->hard_header = uml_net_hard_header;
...@@ -357,42 +358,35 @@ static int eth_configure(int n, void *init, char *mac, ...@@ -357,42 +358,35 @@ static int eth_configure(int n, void *init, char *mac,
rtnl_lock(); rtnl_lock();
err = register_netdevice(dev); err = register_netdevice(dev);
rtnl_unlock(); rtnl_unlock();
if(err) if (err)
return(1); return 1;
lp = dev->priv; lp = dev->priv;
/* lp.user is the first four bytes of the transport data, which lp->list = INIT_LIST_HEAD(lp->list);
* has already been initialized. This structure assignment will spin_lock_init(&lp->lock);
* overwrite that, so we make sure that .user gets overwritten with lp->dev = dev;
* what it already has. lp->fd = -1;
*/ lp->mac = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0 };
save = lp->user[0]; lp->have_mac = device->have_mac;
*lp = ((struct uml_net_private) lp->protocol = transport->kern->protocol;
{ .list = LIST_HEAD_INIT(lp->list), lp->open = transport->user->open;
.lock = SPIN_LOCK_UNLOCKED, lp->close = transport->user->close;
.dev = dev, lp->remove = transport->user->remove;
.fd = -1, lp->read = transport->kern->read;
.mac = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0}, lp->write = transport->kern->write;
.have_mac = device->have_mac, lp->add_address = transport->user->add_address;
.protocol = transport->kern->protocol, lp->delete_address = transport->user->delete_address;
.open = transport->user->open, lp->set_mtu = transport->user->set_mtu;
.close = transport->user->close,
.remove = transport->user->remove,
.read = transport->kern->read,
.write = transport->kern->write,
.add_address = transport->user->add_address,
.delete_address = transport->user->delete_address,
.set_mtu = transport->user->set_mtu,
.user = { save } });
init_timer(&lp->tl); init_timer(&lp->tl);
lp->tl.function = uml_net_user_timer_expire; lp->tl.function = uml_net_user_timer_expire;
memset(&lp->stats, 0, sizeof(lp->stats)); if (lp->have_mac)
if(lp->have_mac) memcpy(lp->mac, device->mac, sizeof(lp->mac)); memcpy(lp->mac, device->mac, sizeof(lp->mac));
if(transport->user->init) if (transport->user->init)
(*transport->user->init)(&lp->user, dev); (*transport->user->init)(&lp->user, dev);
if(device->have_mac) if (device->have_mac)
set_ether_mac(dev, device->mac); set_ether_mac(dev, device->mac);
return(0); return(0);
} }
...@@ -538,13 +532,15 @@ static int eth_setup(char *str) ...@@ -538,13 +532,15 @@ static int eth_setup(char *str)
if(err) return(1); if(err) return(1);
new = alloc_bootmem(sizeof(new)); new = alloc_bootmem(sizeof(new));
if(new == NULL){ if (new == NULL){
printk("eth_init : alloc_bootmem failed\n"); printk("eth_init : alloc_bootmem failed\n");
return(1); return(1);
} }
*new = ((struct eth_init) { .list = LIST_HEAD_INIT(new->list),
.index = n, new->list = INIT_LIST_HEAD(new->list);
.init = str }); new->index = n;
new->init = str;
list_add_tail(&new->list, &eth_cmd_line); list_add_tail(&new->list, &eth_cmd_line);
return(1); return(1);
} }
......
...@@ -23,16 +23,12 @@ void pcap_init(struct net_device *dev, void *data) ...@@ -23,16 +23,12 @@ void pcap_init(struct net_device *dev, void *data)
struct pcap_data *ppri; struct pcap_data *ppri;
struct pcap_init *init = data; struct pcap_init *init = data;
init_etherdev(dev, 0);
pri = dev->priv; pri = dev->priv;
ppri = (struct pcap_data *) pri->user; ppri = (struct pcap_data *) pri->user;
*ppri = ((struct pcap_data) ppri->host_if = init->host_if;
{ .host_if = init->host_if, ppri->promisc = init->promisc;
.promisc = init->promisc, ppri->optimize = init->optimize;
.optimize = init->optimize, ppri->filter = init->filter;
.filter = init->filter,
.compiled = NULL,
.pcap = NULL });
} }
static int pcap_read(int fd, struct sk_buff **skb, static int pcap_read(int fd, struct sk_buff **skb,
......
...@@ -24,18 +24,16 @@ static void etap_init(struct net_device *dev, void *data) ...@@ -24,18 +24,16 @@ static void etap_init(struct net_device *dev, void *data)
struct ethertap_data *epri; struct ethertap_data *epri;
struct ethertap_init *init = data; struct ethertap_init *init = data;
init_etherdev(dev, 0);
pri = dev->priv; pri = dev->priv;
epri = (struct ethertap_data *) pri->user; epri = (struct ethertap_data *) pri->user;
*epri = ((struct ethertap_data) epri->dev_name = init->dev_name;
{ .dev_name = init->dev_name, epri->gate_addr = init->gate_addr;
.gate_addr = init->gate_addr, epri->data_fd = -1;
.data_fd = -1, epri->control_fd = -1;
.control_fd = -1, epri->dev = dev;
.dev = dev });
printk("ethertap backend - %s", epri->dev_name); printk("ethertap backend - %s", epri->dev_name);
if(epri->gate_addr != NULL) if (epri->gate_addr != NULL)
printk(", IP = %s", epri->gate_addr); printk(", IP = %s", epri->gate_addr);
printk("\n"); printk("\n");
} }
......
...@@ -24,17 +24,16 @@ static void tuntap_init(struct net_device *dev, void *data) ...@@ -24,17 +24,16 @@ static void tuntap_init(struct net_device *dev, void *data)
struct tuntap_data *tpri; struct tuntap_data *tpri;
struct tuntap_init *init = data; struct tuntap_init *init = data;
init_etherdev(dev, 0);
pri = dev->priv; pri = dev->priv;
tpri = (struct tuntap_data *) pri->user; tpri = (struct tuntap_data *) pri->user;
*tpri = ((struct tuntap_data) tpri->dev_name = init->dev_name;
{ .dev_name = init->dev_name, tpri->fixed_config = (init->dev_name != NULL);
.fixed_config = (init->dev_name != NULL), tpri->gate_addr = init->gate_addr;
.gate_addr = init->gate_addr, tpri->fd = -1;
.fd = -1, tpri->dev = dev;
.dev = dev });
printk("TUN/TAP backend - "); printk("TUN/TAP backend - ");
if(tpri->gate_addr != NULL) if (tpri->gate_addr != NULL)
printk("IP = %s", tpri->gate_addr); printk("IP = %s", tpri->gate_addr);
printk("\n"); printk("\n");
} }
......
...@@ -1356,16 +1356,16 @@ mpt_lan_post_receive_buckets(void *dev_id) ...@@ -1356,16 +1356,16 @@ mpt_lan_post_receive_buckets(void *dev_id)
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
struct net_device * static struct net_device *
mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum) mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum)
{ {
struct net_device *dev = NULL; struct net_device *dev = alloc_fcdev(sizeof(struct mpt_lan_priv));
struct mpt_lan_priv *priv = NULL; struct mpt_lan_priv *priv = NULL;
u8 HWaddr[FC_ALEN], *a; u8 HWaddr[FC_ALEN], *a;
dev = init_fcdev(NULL, sizeof(struct mpt_lan_priv));
if (!dev) if (!dev)
return (NULL); return NULL;
dev->mtu = MPT_LAN_MTU; dev->mtu = MPT_LAN_MTU;
priv = (struct mpt_lan_priv *) dev->priv; priv = (struct mpt_lan_priv *) dev->priv;
...@@ -1435,15 +1435,18 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum) ...@@ -1435,15 +1435,18 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum)
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
if (register_netdev(dev) != 0) {
kfree(dev);
dev = NULL;
}
return dev; return dev;
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
int __init static int __init mpt_lan_init (void)
mpt_lan_init (void)
{ {
struct net_device *dev; struct net_device *dev;
MPT_ADAPTER *curadapter; MPT_ADAPTER *p;
int i, j; int i, j;
show_mptmod_ver(LANAME, LANVER); show_mptmod_ver(LANAME, LANVER);
...@@ -1477,51 +1480,49 @@ mpt_lan_init (void) ...@@ -1477,51 +1480,49 @@ mpt_lan_init (void)
mpt_landev[j] = NULL; mpt_landev[j] = NULL;
} }
curadapter = mpt_adapter_find_first(); for (p = mpt_adapter_find_first(); p; p = mpt_adapter_find_next(p)) {
while (curadapter != NULL) { for (i = 0; i < p->facts.NumberOfPorts; i++) {
for (i = 0; i < curadapter->facts.NumberOfPorts; i++) {
printk (KERN_INFO MYNAM ": %s: PortNum=%x, ProtocolFlags=%02Xh (%c%c%c%c)\n", printk (KERN_INFO MYNAM ": %s: PortNum=%x, ProtocolFlags=%02Xh (%c%c%c%c)\n",
curadapter->name, p->name,
curadapter->pfacts[i].PortNumber, p->pfacts[i].PortNumber,
curadapter->pfacts[i].ProtocolFlags, p->pfacts[i].ProtocolFlags,
MPT_PROTOCOL_FLAGS_c_c_c_c(curadapter->pfacts[i].ProtocolFlags)); MPT_PROTOCOL_FLAGS_c_c_c_c(p->pfacts[i].ProtocolFlags));
if (curadapter->pfacts[i].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) { if (!(p->pfacts[i].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN)) {
dev = mpt_register_lan_device (curadapter, i); printk (KERN_INFO MYNAM ": %s: Hmmm... LAN protocol seems to be disabled on this adapter port!\n",
if (dev != NULL) { p->name);
printk (KERN_INFO MYNAM ": %s: Fusion MPT LAN device registered as '%s'\n", continue;
curadapter->name, dev->name); }
printk (KERN_INFO MYNAM ": %s/%s: LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n",
IOC_AND_NETDEV_NAMES_s_s(dev), dev = mpt_register_lan_device (p, i);
dev->dev_addr[0], dev->dev_addr[1], if (!dev) {
dev->dev_addr[2], dev->dev_addr[3], printk (KERN_ERR MYNAM ": %s: Unable to register port%d as a LAN device\n",
dev->dev_addr[4], dev->dev_addr[5]); p->name,
p->pfacts[i].PortNumber);
}
printk (KERN_INFO MYNAM ": %s: Fusion MPT LAN device registered as '%s'\n",
p->name, dev->name);
printk (KERN_INFO MYNAM ": %s/%s: LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n",
IOC_AND_NETDEV_NAMES_s_s(dev),
dev->dev_addr[0], dev->dev_addr[1],
dev->dev_addr[2], dev->dev_addr[3],
dev->dev_addr[4], dev->dev_addr[5]);
// printk (KERN_INFO MYNAM ": %s/%s: Max_TX_outstanding = %d\n", // printk (KERN_INFO MYNAM ": %s/%s: Max_TX_outstanding = %d\n",
// IOC_AND_NETDEV_NAMES_s_s(dev), // IOC_AND_NETDEV_NAMES_s_s(dev),
// NETDEV_TO_LANPRIV_PTR(dev)->tx_max_out); // NETDEV_TO_LANPRIV_PTR(dev)->tx_max_out);
j = curadapter->id; j = p->id;
mpt_landev[j] = dev; mpt_landev[j] = dev;
dlprintk((KERN_INFO MYNAM "/init: dev_addr=%p, mpt_landev[%d]=%p\n", dlprintk((KERN_INFO MYNAM "/init: dev_addr=%p, mpt_landev[%d]=%p\n",
dev, j, mpt_landev[j])); dev, j, mpt_landev[j]));
} else {
printk (KERN_ERR MYNAM ": %s: Unable to register port%d as a LAN device\n",
curadapter->name,
curadapter->pfacts[i].PortNumber);
}
} else {
printk (KERN_INFO MYNAM ": %s: Hmmm... LAN protocol seems to be disabled on this adapter port!\n",
curadapter->name);
}
} }
curadapter = mpt_adapter_find_next(curadapter);
} }
return 0; return 0;
} }
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static void mpt_lan_exit(void) static void __exit mpt_lan_exit(void)
{ {
int i; int i;
...@@ -1532,7 +1533,7 @@ static void mpt_lan_exit(void) ...@@ -1532,7 +1533,7 @@ static void mpt_lan_exit(void)
printk (KERN_INFO ": %s/%s: Fusion MPT LAN device unregistered\n", printk (KERN_INFO ": %s/%s: Fusion MPT LAN device unregistered\n",
IOC_AND_NETDEV_NAMES_s_s(dev)); IOC_AND_NETDEV_NAMES_s_s(dev));
unregister_fcdev(dev); unregister_netdev(dev);
//mpt_landev[i] = (struct net_device *) 0xdeadbeef; /* Debug */ //mpt_landev[i] = (struct net_device *) 0xdeadbeef; /* Debug */
mpt_landev[i] = NULL; mpt_landev[i] = NULL;
} }
......
...@@ -425,11 +425,7 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr) ...@@ -425,11 +425,7 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr)
} }
#endif #endif
/* dev = alloc_fddidev(sizeof(*bp));
* init_fddidev() allocates a device structure with private data, clears the device structure and private data,
* and calls fddi_setup() and register_netdev(). Not much left to do for us here.
*/
dev = init_fddidev(NULL, sizeof(*bp));
if (!dev) { if (!dev) {
printk (KERN_ERR "defxx: unable to allocate fddidev, aborting\n"); printk (KERN_ERR "defxx: unable to allocate fddidev, aborting\n");
return -ENOMEM; return -ENOMEM;
...@@ -483,12 +479,17 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr) ...@@ -483,12 +479,17 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr)
goto err_out_region; goto err_out_region;
} }
err = register_netdev(dev);
if (err)
goto err_out_kfree;
return 0; return 0;
err_out_kfree:
if (bp->kmalloced) kfree(bp->kmalloced);
err_out_region: err_out_region:
release_region(ioaddr, pdev ? PFI_K_CSR_IO_LEN : PI_ESIC_K_CSR_IO_LEN); release_region(ioaddr, pdev ? PFI_K_CSR_IO_LEN : PI_ESIC_K_CSR_IO_LEN);
err_out: err_out:
unregister_netdev(dev);
kfree(dev); kfree(dev);
return err; return err;
} }
......
...@@ -234,7 +234,7 @@ int __init iph5526_probe(struct net_device *dev) ...@@ -234,7 +234,7 @@ int __init iph5526_probe(struct net_device *dev)
{ {
if (pci_present() && (iph5526_probe_pci(dev) == 0)) if (pci_present() && (iph5526_probe_pci(dev) == 0))
return 0; return 0;
return -ENODEV; return -ENODEV;
} }
static int __init iph5526_probe_pci(struct net_device *dev) static int __init iph5526_probe_pci(struct net_device *dev)
...@@ -242,37 +242,30 @@ static int __init iph5526_probe_pci(struct net_device *dev) ...@@ -242,37 +242,30 @@ static int __init iph5526_probe_pci(struct net_device *dev)
#ifdef MODULE #ifdef MODULE
struct fc_info *fi = (struct fc_info *)dev->priv; struct fc_info *fi = (struct fc_info *)dev->priv;
#else #else
struct fc_info *fi; struct fc_info *fi = fc[count];
static int count; static int count;
int err;
if(fc[count] != NULL) { if (!fi)
if (dev == NULL) {
dev = init_fcdev(NULL, 0);
if (dev == NULL)
return -ENOMEM;
}
fi = fc[count];
#endif
fi->dev = dev;
dev->base_addr = fi->base_addr;
dev->irq = fi->irq;
if (dev->priv == NULL)
dev->priv = fi;
fcdev_init(dev);
/* Assign ur MAC address.
*/
dev->dev_addr[0] = (fi->g.my_port_name_high & 0x0000FF00) >> 8;
dev->dev_addr[1] = fi->g.my_port_name_high;
dev->dev_addr[2] = (fi->g.my_port_name_low & 0xFF000000) >> 24;
dev->dev_addr[3] = (fi->g.my_port_name_low & 0x00FF0000) >> 16;
dev->dev_addr[4] = (fi->g.my_port_name_low & 0x0000FF00) >> 8;
dev->dev_addr[5] = fi->g.my_port_name_low;
#ifndef MODULE
count++;
}
else
return -ENODEV; return -ENODEV;
fc_setup(dev);
count++;
#endif #endif
fi->dev = dev;
dev->base_addr = fi->base_addr;
dev->irq = fi->irq;
if (dev->priv == NULL)
dev->priv = fi;
fcdev_init(dev);
/* Assign ur MAC address.
*/
dev->dev_addr[0] = (fi->g.my_port_name_high & 0x0000FF00) >> 8;
dev->dev_addr[1] = fi->g.my_port_name_high;
dev->dev_addr[2] = (fi->g.my_port_name_low & 0xFF000000) >> 24;
dev->dev_addr[3] = (fi->g.my_port_name_low & 0x00FF0000) >> 16;
dev->dev_addr[4] = (fi->g.my_port_name_low & 0x0000FF00) >> 8;
dev->dev_addr[5] = fi->g.my_port_name_low;
display_cache(fi); display_cache(fi);
return 0; return 0;
} }
...@@ -287,9 +280,6 @@ static int __init fcdev_init(struct net_device *dev) ...@@ -287,9 +280,6 @@ static int __init fcdev_init(struct net_device *dev)
dev->change_mtu = iph5526_change_mtu; dev->change_mtu = iph5526_change_mtu;
dev->tx_timeout = iph5526_timeout; dev->tx_timeout = iph5526_timeout;
dev->watchdog_timeo = 5*HZ; dev->watchdog_timeo = 5*HZ;
#ifndef MODULE
fc_setup(dev);
#endif
return 0; return 0;
} }
...@@ -4507,7 +4497,7 @@ static int scsi_registered; ...@@ -4507,7 +4497,7 @@ static int scsi_registered;
int init_module(void) int init_module(void)
{ {
int i = 0; int i = 0;
driver_template.module = THIS_MODULE; driver_template.module = THIS_MODULE;
scsi_register_host(&driver_template); scsi_register_host(&driver_template);
...@@ -4520,43 +4510,37 @@ int i = 0; ...@@ -4520,43 +4510,37 @@ int i = 0;
} }
while(fc[i] != NULL) { while(fc[i] != NULL) {
dev_fc[i] = NULL; struct net_device *dev = alloc_fcdev(0);
dev_fc[i] = init_fcdev(dev_fc[i], 0); if (!dev) {
if (dev_fc[i] == NULL) {
printk("iph5526.c: init_fcdev failed for card #%d\n", i+1); printk("iph5526.c: init_fcdev failed for card #%d\n", i+1);
break; break;
} }
dev_fc[i]->irq = irq; dev->priv = fc[i];
dev_fc[i]->mem_end = bad; iph5526_probe_pci(dev);
dev_fc[i]->base_addr = io; err = register_netdev(dev);
dev_fc[i]->init = iph5526_probe; if (err < 0) {
dev_fc[i]->priv = fc[i]; kfree(dev);
fc[i]->dev = dev_fc[i]; printk("iph5526.c: init_fcdev failed for card #%d\n", i+1);
if (register_fcdev(dev_fc[i]) != 0) { break;
kfree(dev_fc[i]);
dev_fc[i] = NULL;
if (i == 0) {
printk("iph5526.c: IP registeration failed!!!\n");
return -ENODEV;
}
} }
dev_fc[i] = dev;
i++; i++;
} }
if (i == 0) if (i == 0)
return -ENODEV; return -ENODEV;
return 0; return 0;
} }
void cleanup_module(void) void cleanup_module(void)
{ {
int i = 0; int i = 0;
while(fc[i] != NULL) { while(fc[i] != NULL) {
struct net_device *dev = fc[i]->dev; struct net_device *dev = fc[i]->dev;
void *priv = dev->priv; void *priv = dev->priv;
fc[i]->g.dont_init = TRUE; fc[i]->g.dont_init = TRUE;
take_tachyon_offline(fc[i]); take_tachyon_offline(fc[i]);
unregister_fcdev(dev); unregister_netdev(dev);
clean_up_memory(fc[i]); clean_up_memory(fc[i]);
if (dev->priv) if (dev->priv)
kfree(priv); kfree(priv);
......
...@@ -178,17 +178,6 @@ static struct net_device *init_netdev(struct net_device *dev, int sizeof_priv, ...@@ -178,17 +178,6 @@ static struct net_device *init_netdev(struct net_device *dev, int sizeof_priv,
return dev; return dev;
} }
#if defined(CONFIG_HIPPI) || defined(CONFIG_TR) || defined(CONFIG_NET_FC)
static int __register_netdev(struct net_device *dev)
{
if (dev->init && dev->init(dev) != 0) {
unregister_netdev(dev);
return -EIO;
}
return 0;
}
#endif
/** /**
* init_etherdev - Register ethernet device * init_etherdev - Register ethernet device
* @dev: An ethernet device structure to be filled in, or %NULL if a new * @dev: An ethernet device structure to be filled in, or %NULL if a new
...@@ -251,28 +240,6 @@ static int eth_change_mtu(struct net_device *dev, int new_mtu) ...@@ -251,28 +240,6 @@ static int eth_change_mtu(struct net_device *dev, int new_mtu)
#ifdef CONFIG_FDDI #ifdef CONFIG_FDDI
/**
* init_fddidev - Register FDDI device
* @dev: A FDDI device structure to be filled in, or %NULL if a new
* struct should be allocated.
* @sizeof_priv: Size of additional driver-private structure to be allocated
* for this ethernet device
*
* Fill in the fields of the device structure with FDDI-generic values.
*
* If no device structure is passed, a new one is constructed, complete with
* a private data area of size @sizeof_priv. A 32-byte (not bit)
* alignment is enforced for this private data area.
*
* If an empty string area is passed as dev->name, or a new structure is made,
* a new name string is constructed.
*/
struct net_device *init_fddidev(struct net_device *dev, int sizeof_priv)
{
return init_netdev(dev, sizeof_priv, "fddi%d", fddi_setup);
}
/** /**
* alloc_fddidev - Register FDDI device * alloc_fddidev - Register FDDI device
* @sizeof_priv: Size of additional driver-private structure to be allocated * @sizeof_priv: Size of additional driver-private structure to be allocated
...@@ -290,7 +257,6 @@ struct net_device *alloc_fddidev(int sizeof_priv) ...@@ -290,7 +257,6 @@ struct net_device *alloc_fddidev(int sizeof_priv)
return alloc_netdev(sizeof_priv, "fddi%d", fddi_setup); return alloc_netdev(sizeof_priv, "fddi%d", fddi_setup);
} }
EXPORT_SYMBOL(init_fddidev);
EXPORT_SYMBOL(alloc_fddidev); EXPORT_SYMBOL(alloc_fddidev);
static int fddi_change_mtu(struct net_device *dev, int new_mtu) static int fddi_change_mtu(struct net_device *dev, int new_mtu)
...@@ -330,27 +296,50 @@ static int hippi_mac_addr(struct net_device *dev, void *p) ...@@ -330,27 +296,50 @@ static int hippi_mac_addr(struct net_device *dev, void *p)
return 0; return 0;
} }
static int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p)
{
/* Never send broadcast/multicast ARP messages */
p->mcast_probes = 0;
/* In IPv6 unicast probes are valid even on NBMA,
* because they are encapsulated in normal IPv6 protocol.
* Should be a generic flag.
*/
if (p->tbl->family != AF_INET6)
p->ucast_probes = 0;
return 0;
}
/** static void hippi_setup(struct net_device *dev)
* init_hippi_dev - Register HIPPI device
* @dev: A HIPPI device structure to be filled in, or %NULL if a new
* struct should be allocated.
* @sizeof_priv: Size of additional driver-private structure to be allocated
* for this ethernet device
*
* Fill in the fields of the device structure with HIPPI-generic values.
*
* If no device structure is passed, a new one is constructed, complete with
* a private data area of size @sizeof_priv. A 32-byte (not bit)
* alignment is enforced for this private data area.
*
* If an empty string area is passed as dev->name, or a new structure is made,
* a new name string is constructed.
*/
struct net_device *init_hippi_dev(struct net_device *dev, int sizeof_priv)
{ {
return init_netdev(dev, sizeof_priv, "hip%d", hippi_setup); dev->set_multicast_list = NULL;
dev->change_mtu = hippi_change_mtu;
dev->hard_header = hippi_header;
dev->rebuild_header = hippi_rebuild_header;
dev->set_mac_address = hippi_mac_addr;
dev->hard_header_parse = NULL;
dev->hard_header_cache = NULL;
dev->header_cache_update = NULL;
dev->neigh_setup = hippi_neigh_setup_dev;
/*
* We don't support HIPPI `ARP' for the time being, and probably
* never will unless someone else implements it. However we
* still need a fake ARPHRD to make ifconfig and friends play ball.
*/
dev->type = ARPHRD_HIPPI;
dev->hard_header_len = HIPPI_HLEN;
dev->mtu = 65280;
dev->addr_len = HIPPI_ALEN;
dev->tx_queue_len = 25 /* 5 */;
memset(dev->broadcast, 0xFF, HIPPI_ALEN);
/*
* HIPPI doesn't support broadcast+multicast and we only use
* static ARP tables. ARP is disabled by hippi_neigh_setup_dev.
*/
dev->flags = 0;
} }
/** /**
...@@ -370,34 +359,7 @@ struct net_device *alloc_hippi_dev(int sizeof_priv) ...@@ -370,34 +359,7 @@ struct net_device *alloc_hippi_dev(int sizeof_priv)
return alloc_netdev(sizeof_priv, "hip%d", hippi_setup); return alloc_netdev(sizeof_priv, "hip%d", hippi_setup);
} }
int register_hipdev(struct net_device *dev)
{
return __register_netdev(dev);
}
void unregister_hipdev(struct net_device *dev)
{
unregister_netdev(dev);
}
EXPORT_SYMBOL(init_hippi_dev);
EXPORT_SYMBOL(alloc_hippi_dev); EXPORT_SYMBOL(alloc_hippi_dev);
EXPORT_SYMBOL(register_hipdev);
EXPORT_SYMBOL(unregister_hipdev);
static int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p)
{
/* Never send broadcast/multicast ARP messages */
p->mcast_probes = 0;
/* In IPv6 unicast probes are valid even on NBMA,
* because they are encapsulated in normal IPv6 protocol.
* Should be a generic flag.
*/
if (p->tbl->family != AF_INET6)
p->ucast_probes = 0;
return 0;
}
#endif /* CONFIG_HIPPI */ #endif /* CONFIG_HIPPI */
...@@ -455,41 +417,6 @@ EXPORT_SYMBOL(fddi_setup); ...@@ -455,41 +417,6 @@ EXPORT_SYMBOL(fddi_setup);
#endif /* CONFIG_FDDI */ #endif /* CONFIG_FDDI */
#ifdef CONFIG_HIPPI
void hippi_setup(struct net_device *dev)
{
dev->set_multicast_list = NULL;
dev->change_mtu = hippi_change_mtu;
dev->hard_header = hippi_header;
dev->rebuild_header = hippi_rebuild_header;
dev->set_mac_address = hippi_mac_addr;
dev->hard_header_parse = NULL;
dev->hard_header_cache = NULL;
dev->header_cache_update = NULL;
dev->neigh_setup = hippi_neigh_setup_dev;
/*
* We don't support HIPPI `ARP' for the time being, and probably
* never will unless someone else implements it. However we
* still need a fake ARPHRD to make ifconfig and friends play ball.
*/
dev->type = ARPHRD_HIPPI;
dev->hard_header_len = HIPPI_HLEN;
dev->mtu = 65280;
dev->addr_len = HIPPI_ALEN;
dev->tx_queue_len = 25 /* 5 */;
memset(dev->broadcast, 0xFF, HIPPI_ALEN);
/*
* HIPPI doesn't support broadcast+multicast and we only use
* static ARP tables. ARP is disabled by hippi_neigh_setup_dev.
*/
dev->flags = 0;
}
EXPORT_SYMBOL(hippi_setup);
#endif /* CONFIG_HIPPI */
#if defined(CONFIG_ATALK) || defined(CONFIG_ATALK_MODULE) #if defined(CONFIG_ATALK) || defined(CONFIG_ATALK_MODULE)
static int ltalk_change_mtu(struct net_device *dev, int mtu) static int ltalk_change_mtu(struct net_device *dev, int mtu)
...@@ -597,28 +524,6 @@ void tr_setup(struct net_device *dev) ...@@ -597,28 +524,6 @@ void tr_setup(struct net_device *dev)
dev->flags = IFF_BROADCAST | IFF_MULTICAST ; dev->flags = IFF_BROADCAST | IFF_MULTICAST ;
} }
/**
* init_trdev - Register token ring device
* @dev: A token ring device structure to be filled in, or %NULL if a new
* struct should be allocated.
* @sizeof_priv: Size of additional driver-private structure to be allocated
* for this ethernet device
*
* Fill in the fields of the device structure with token ring-generic values.
*
* If no device structure is passed, a new one is constructed, complete with
* a private data area of size @sizeof_priv. A 32-byte (not bit)
* alignment is enforced for this private data area.
*
* If an empty string area is passed as dev->name, or a new structure is made,
* a new name string is constructed.
*/
struct net_device *init_trdev(struct net_device *dev, int sizeof_priv)
{
return init_netdev(dev, sizeof_priv, "tr%d", tr_setup);
}
/** /**
* alloc_trdev - Register token ring device * alloc_trdev - Register token ring device
* @sizeof_priv: Size of additional driver-private structure to be allocated * @sizeof_priv: Size of additional driver-private structure to be allocated
...@@ -636,25 +541,11 @@ struct net_device *alloc_trdev(int sizeof_priv) ...@@ -636,25 +541,11 @@ struct net_device *alloc_trdev(int sizeof_priv)
return alloc_netdev(sizeof_priv, "tr%d", tr_setup); return alloc_netdev(sizeof_priv, "tr%d", tr_setup);
} }
int register_trdev(struct net_device *dev)
{
return __register_netdev(dev);
}
void unregister_trdev(struct net_device *dev)
{
unregister_netdev(dev);
}
EXPORT_SYMBOL(tr_setup); EXPORT_SYMBOL(tr_setup);
EXPORT_SYMBOL(init_trdev);
EXPORT_SYMBOL(alloc_trdev); EXPORT_SYMBOL(alloc_trdev);
EXPORT_SYMBOL(register_trdev);
EXPORT_SYMBOL(unregister_trdev);
#endif /* CONFIG_TR */ #endif /* CONFIG_TR */
#ifdef CONFIG_NET_FC #ifdef CONFIG_NET_FC
void fc_setup(struct net_device *dev) void fc_setup(struct net_device *dev)
...@@ -674,28 +565,6 @@ void fc_setup(struct net_device *dev) ...@@ -674,28 +565,6 @@ void fc_setup(struct net_device *dev)
dev->flags = IFF_BROADCAST; dev->flags = IFF_BROADCAST;
} }
/**
* init_fcdev - Register fibre channel device
* @dev: A fibre channel device structure to be filled in, or %NULL if a new
* struct should be allocated.
* @sizeof_priv: Size of additional driver-private structure to be allocated
* for this ethernet device
*
* Fill in the fields of the device structure with fibre channel-generic values.
*
* If no device structure is passed, a new one is constructed, complete with
* a private data area of size @sizeof_priv. A 32-byte (not bit)
* alignment is enforced for this private data area.
*
* If an empty string area is passed as dev->name, or a new structure is made,
* a new name string is constructed.
*/
struct net_device *init_fcdev(struct net_device *dev, int sizeof_priv)
{
return init_netdev(dev, sizeof_priv, "fc%d", fc_setup);
}
/** /**
* alloc_fcdev - Register fibre channel device * alloc_fcdev - Register fibre channel device
* @sizeof_priv: Size of additional driver-private structure to be allocated * @sizeof_priv: Size of additional driver-private structure to be allocated
...@@ -713,21 +582,8 @@ struct net_device *alloc_fcdev(int sizeof_priv) ...@@ -713,21 +582,8 @@ struct net_device *alloc_fcdev(int sizeof_priv)
return alloc_netdev(sizeof_priv, "fc%d", fc_setup); return alloc_netdev(sizeof_priv, "fc%d", fc_setup);
} }
int register_fcdev(struct net_device *dev)
{
return __register_netdev(dev);
}
void unregister_fcdev(struct net_device *dev)
{
unregister_netdev(dev);
}
EXPORT_SYMBOL(fc_setup); EXPORT_SYMBOL(fc_setup);
EXPORT_SYMBOL(init_fcdev);
EXPORT_SYMBOL(alloc_fcdev); EXPORT_SYMBOL(alloc_fcdev);
EXPORT_SYMBOL(register_fcdev);
EXPORT_SYMBOL(unregister_fcdev);
#endif /* CONFIG_NET_FC */ #endif /* CONFIG_NET_FC */
...@@ -208,10 +208,13 @@ static dev_link_t *ibmtr_attach(void) ...@@ -208,10 +208,13 @@ static dev_link_t *ibmtr_attach(void)
flush_stale_links(); flush_stale_links();
/* Create new token-ring device */ /* Create new token-ring device */
info = kmalloc(sizeof(*info), GFP_KERNEL); dev = alloc_trdev(sizeof(*info));
if (!info) return NULL; if (!dev)
memset(info, 0, sizeof(*info)); return NULL;
link = &info->link; link->priv = info; info = dev->priv;
link = &info->link;
link->priv = info;
init_timer(&link->release); init_timer(&link->release);
link->release.function = &ibmtr_release; link->release.function = &ibmtr_release;
...@@ -232,12 +235,6 @@ static dev_link_t *ibmtr_attach(void) ...@@ -232,12 +235,6 @@ static dev_link_t *ibmtr_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO; link->conf.IntType = INT_MEMORY_AND_IO;
link->conf.Present = PRESENT_OPTION; link->conf.Present = PRESENT_OPTION;
dev = init_trdev(NULL,0);
if (dev == NULL) {
ibmtr_detach(link);
return NULL;
}
dev->priv = &info->ti;
link->irq.Instance = info->dev = dev; link->irq.Instance = info->dev = dev;
dev->init = &ibmtr_probe; dev->init = &ibmtr_probe;
...@@ -258,11 +255,16 @@ static dev_link_t *ibmtr_attach(void) ...@@ -258,11 +255,16 @@ static dev_link_t *ibmtr_attach(void)
ret = CardServices(RegisterClient, &link->handle, &client_reg); ret = CardServices(RegisterClient, &link->handle, &client_reg);
if (ret != 0) { if (ret != 0) {
cs_error(link->handle, RegisterClient, ret); cs_error(link->handle, RegisterClient, ret);
ibmtr_detach(link); goto out_detach;
return NULL;
} }
out:
return link; return link;
out_detach:
ibmtr_detach(link);
link = NULL;
goto out;
} /* ibmtr_attach */ } /* ibmtr_attach */
/*====================================================================== /*======================================================================
...@@ -307,12 +309,8 @@ static void ibmtr_detach(dev_link_t *link) ...@@ -307,12 +309,8 @@ static void ibmtr_detach(dev_link_t *link)
/* Unlink device structure, free bits */ /* Unlink device structure, free bits */
*linkp = link->next; *linkp = link->next;
if (info->dev) { unregister_netdev(dev);
unregister_trdev(info->dev); kfree(dev);
kfree(info->dev);
}
kfree(info);
} /* ibmtr_detach */ } /* ibmtr_detach */
/*====================================================================== /*======================================================================
...@@ -413,10 +411,10 @@ static void ibmtr_config(dev_link_t *link) ...@@ -413,10 +411,10 @@ static void ibmtr_config(dev_link_t *link)
Adapters Technical Reference" SC30-3585 for this info. */ Adapters Technical Reference" SC30-3585 for this info. */
ibmtr_hw_setup(dev, mmiobase); ibmtr_hw_setup(dev, mmiobase);
i = register_trdev(dev); i = register_netdev(dev);
if (i != 0) { if (i != 0) {
printk(KERN_NOTICE "ibmtr_cs: register_trdev() failed\n"); printk(KERN_NOTICE "ibmtr_cs: register_netdev() failed\n");
goto failed; goto failed;
} }
......
/* $Id: ptifddi.c,v 1.14 2001/04/14 01:12:04 davem Exp $
* ptifddi.c: Network driver for Performance Technologies single-attach
* and dual-attach FDDI sbus cards.
*
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
*/
static char *version =
"ptifddi.c:v1.0 10/Dec/96 David S. Miller (davem@caipfs.rutgers.edu)\n";
#include <linux/string.h>
#include <linux/init.h>
#include "ptifddi.h"
#include "ptifddi_asm.h"
#ifdef MODULE
static struct ptifddi *root_pti_dev;
#endif
static inline void pti_reset(struct ptifddi *pp)
{
pp->reset = 1;
}
static inline void pti_unreset(struct ptifddi *pp)
{
pp->unreset = 1;
}
static inline void pti_load_code_base(struct dfddi_ram *rp, unsigned short addr)
{
rp->loader_addr = ((addr << 8) & 0xff00) | ((addr >> 8) & 0x00ff);
}
static inline void pti_clear_dpram(struct ptifddi *pp)
{
memset(pp->dpram, 0, DPRAM_SIZE);
}
#define CARD_TEST_TIMEOUT 100000
static inline int pti_card_test(struct ptifddi *pp)
{
struct dfddi_ram *rp = pp->dpram;
unsigned char *code = &rp->loader;
unsigned char *status = (unsigned char *) rp;
int clicks = CARD_TEST_TIMEOUT;
/* Clear it out. */
pti_clear_dpram(pp);
/* Load test data. */
for(i = 0; i < test_firmware_size; i++)
code[i] = test_firmware[i];
/* Tell card where to execute the code. */
pti_load_code_base(pp, test_firmware_dev_addr);
/* Clear test run status in dpram. */
*status = 0;
/* Reset single attach state machine before the test. */
rp->reset = 1;
/* Unreset, to get the test code running. */
pti_unreset(pp);
/* Wait for dpram status to become 5, else fail if we time out. */
while(--clicks) {
if(*status == 5) {
pti_reset(pp);
return 0;
}
udelay(20);
}
return 1;
}
static inline void pti_init_firmware_loader(struct ptifddi *pp)
{
struct dfddi_ram *rp = pp->dpram;
int i;
for(i = 0; i < firmware_loader_size; i++)
rp->loader.loader_firmware[i] = firmware_loader[i];
}
static inline void pti_load_main_firmware(struct ptifddi *pp)
{
struct dfddi_ram *rp = pp->dpram;
struct dpram_loader *lp = &rp.loader;
int i;
}
static void pti_init_rings(struct ptifddi *pp, int from_irq)
{
}
static int pti_init(struct ptifddi *pp, int from_irq)
{
}
static void pti_is_not_so_happy(struct ptifddi *pp)
{
}
static inline void pti_tx(struct ptifddi *pp, struct net_device *dev)
{
}
static inline void myri_rx(struct ptifddi *pp, struct net_device *dev)
{
}
static void pti_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device *) dev_id;
struct ptifddi *pp = (struct ptifddi *) dev->priv;
}
static int pti_open(struct net_device *dev)
{
struct ptifddi *pp = (struct ptifddi *) dev->priv;
return pti_init(pp, in_interrupt());
}
static int pti_close(struct net_device *dev)
{
struct ptifddi *pp = (struct ptifddi *) dev->priv;
return 0;
}
static int pti_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct ptifddi *pp = (struct ptifddi *) dev->priv;
}
static struct net_device_stats *pti_get_stats(struct net_device *dev)
{ return &(((struct ptifddi *)dev->priv)->enet_stats); }
static void pti_set_multicast(struct net_device *dev)
{
}
static inline int pti_fddi_init(struct net_device *dev, struct sbus_dev *sdev, int num)
{
static unsigned version_printed;
struct ptifddi *pp;
int i;
dev = init_fddidev(0, sizeof(struct ptifddi));
if(version_printed++ == 0)
printk(version);
/* Register 0 mapping contains DPRAM. */
pp->dpram = (struct dfddi_ram *) sbus_ioremap(
&sdep->resource[0], 0, sizeof(sturct dfddi_ram), "PTI FDDI DPRAM");
if(!pp->dpram) {
printk("ptiFDDI: Cannot map DPRAM I/O area.\n");
return -ENODEV;
}
/* Next, register 1 contains reset byte. */
pp->reset = (unsigned char *) sbus_ioremap(
&sdep->resource[1], 0, 1, "PTI FDDI RESET Byte");
if(!pp->reset) {
printk("ptiFDDI: Cannot map RESET byte.\n");
return -ENODEV;
}
/* Register 2 contains unreset byte. */
pp->unreset = (unsigned char *) sbus_ioremap(
&sdep->resource[2], 0, 1, "PTI FDDI UNRESET Byte");
if(!pp->unreset) {
printk("ptiFDDI: Cannot map UNRESET byte.\n");
return -ENODEV;
}
/* Reset the card. */
pti_reset(pp);
/* Run boot-up card tests. */
i = pti_card_test(pp);
if(i) {
printk("ptiFDDI: Bootup card test fails.\n");
return -ENODEV;
}
/* Clear DPRAM, start afresh. */
pti_clear_dpram(pp);
/* Init the firmware loader. */
pti_init_firmware_loader(pp);
/* Now load main card FDDI firmware, using the loader. */
pti_load_main_firmware(pp);
}
int __init ptifddi_sbus_probe(struct net_device *dev)
{
struct sbus_bus *bus;
struct sbus_dev *sdev = 0;
static int called;
int cards = 0, v;
if(called)
return -ENODEV;
called++;
for_each_sbus(bus) {
for_each_sbusdev(sdev, bus) {
if(cards) dev = NULL;
if(!strcmp(sdev->prom_name, "PTI,sbs600") ||
!strcmp(sdev->prom_name, "DPV,fddid")) {
cards++;
DET(("Found PTI FDDI as %s\n", sdev->prom_name));
if((v = pti_fddi_init(dev, sdev, (cards - 1))))
return v;
}
}
}
if(!cards)
return -ENODEV;
return 0;
}
#ifdef MODULE
int
init_module(void)
{
root_pti_dev = NULL;
return ptifddi_sbus_probe(NULL);
}
void
cleanup_module(void)
{
struct ptifddi *pp;
while (root_pti_dev) {
pp = root_pti_dev->next_module;
unregister_netdev(root_pti_dev->dev);
kfree(root_pti_dev->dev);
root_pti_dev = mp;
}
}
#endif /* MODULE */
/* $Id: ptifddi.h,v 1.3 1999/08/20 00:31:08 davem Exp $
* ptifddi.c: Defines for Performance Technologies FDDI sbus cards.
*
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
*/
#ifndef _PTIFDDI_H
#define _PTIFDDI_H
struct dpram_loader {
volatile unsigned char dpram_stat;
volatile unsigned char _unused;
volatile unsigned char addr_low;
volatile unsigned char addr_hi;
volatile unsigned char num_bytes;
volatile unsigned char data[0x3b];
volatile unsigned char loader_firmware[0xc0];
};
struct dfddi_ram {
/*0x000*/ unsigned char _unused0[0x100];
/*0x100*/ struct dpram_loader loader;
/*0x200*/ unsigned char instructions[0x400];
/*0x600*/ unsigned char msg_in[0x20];
/*0x620*/ unsigned char msg_out[0x20];
/*0x640*/ unsigned char _unused2[0x50];
/*0x690*/ unsigned char smsg_in[0x20];
/*0x6b0*/ unsigned char _unused3[0x30];
/*0x6e0*/ unsigned char beacom_frame[0x20];
/*0x700*/ unsigned char re_sync;
/*0x701*/ unsigned char _unused4;
/*0x702*/ unsigned short tswitch;
/*0x704*/ unsigned char evq_lost;
/*0x705*/ unsigned char _unused6;
/*0x706*/ unsigned char signal_lost;
/*0x707*/ unsigned char _unused7;
/*0x708*/ unsigned char lerror;
/*0x709*/ unsigned char _unused8;
/*0x70a*/ unsigned char rstate;
/*0x70b*/ unsigned char _unused9[0x13];
/*0x716*/ unsigned short dswitch;
/*0x718*/ unsigned char _unused10[0x48];
/*0x750*/ unsigned char cbusy;
/*0x751*/ unsigned char hbusy;
/*0x752*/ unsigned short istat;
/*0x754*/ unsigned char _unused11[];
/*0x756*/ unsigned char disable;
/*0x757*/ unsigned char _unused12[];
/*0x78e*/ unsigned char ucvalid;
/*0x78f*/ unsigned char _unused13;
/*0x790*/ unsigned int u0addr;
/*0x794*/ unsigned char _unused14[];
/*0x7a8*/ unsigned int P_player;
/*0x7ac*/ unsigned int Q_player;
/*0x7b0*/ unsigned int macsi;
/*0x7b4*/ unsigned char _unused15[];
/*0x7be*/ unsigned short reset;
/*0x7c0*/ unsigned char _unused16[];
/*0x7fc*/ unsigned short iack;
/*0x7fe*/ unsigned short loader_addr;
};
#define DPRAM_SIZE 0x800
#define DPRAM_STAT_VALID 0x80
#define DPRAM_STAT_EMPTY 0x00
struct ptifddi {
struct dfddi_ram *dpram;
unsigned char *reset;
unsigned char *unreset;
struct net_device *dev;
struct ptifddi *next_module;
};
#endif /* !(_PTIFDDI_H) */
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -97,13 +97,11 @@ static int __devinit rr_init_one(struct pci_dev *pdev, ...@@ -97,13 +97,11 @@ static int __devinit rr_init_one(struct pci_dev *pdev,
struct rr_private *rrpriv; struct rr_private *rrpriv;
void *tmpptr; void *tmpptr;
dma_addr_t ring_dma; dma_addr_t ring_dma;
int ret; int ret = -ENOMEM;
dev = init_hippi_dev(NULL, sizeof(struct rr_private)); dev = alloc_hippi_dev(sizeof(struct rr_private));
if (!dev) { if (!dev)
ret = -ENOMEM; goto out3;
goto out2;
}
ret = pci_enable_device(pdev); ret = pci_enable_device(pdev);
if (ret) { if (ret) {
...@@ -210,6 +208,10 @@ static int __devinit rr_init_one(struct pci_dev *pdev, ...@@ -210,6 +208,10 @@ static int __devinit rr_init_one(struct pci_dev *pdev,
rr_init(dev); rr_init(dev);
dev->base_addr = 0; dev->base_addr = 0;
ret = register_netdev(dev);
if (ret)
goto out;
return 0; return 0;
out: out:
...@@ -225,12 +227,9 @@ static int __devinit rr_init_one(struct pci_dev *pdev, ...@@ -225,12 +227,9 @@ static int __devinit rr_init_one(struct pci_dev *pdev,
pci_release_regions(pdev); pci_release_regions(pdev);
pci_set_drvdata(pdev, NULL); pci_set_drvdata(pdev, NULL);
} }
out2: out2:
if (dev) { kfree(dev);
unregister_hipdev(dev); out3:
kfree(dev);
}
return ret; return ret;
} }
...@@ -252,7 +251,7 @@ static void __devexit rr_remove_one (struct pci_dev *pdev) ...@@ -252,7 +251,7 @@ static void __devexit rr_remove_one (struct pci_dev *pdev)
rr->rx_ring_dma); rr->rx_ring_dma);
pci_free_consistent(pdev, TX_TOTAL_SIZE, rr->tx_ring, pci_free_consistent(pdev, TX_TOTAL_SIZE, rr->tx_ring,
rr->tx_ring_dma); rr->tx_ring_dma);
unregister_hipdev(dev); unregister_netdev(dev);
iounmap(rr->regs); iounmap(rr->regs);
kfree(dev); kfree(dev);
pci_release_regions(pdev); pci_release_regions(pdev);
......
...@@ -1129,7 +1129,7 @@ static irqreturn_t xl_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1129,7 +1129,7 @@ static irqreturn_t xl_interrupt(int irq, void *dev_id, struct pt_regs *regs)
netif_stop_queue(dev) ; netif_stop_queue(dev) ;
xl_freemem(dev) ; xl_freemem(dev) ;
free_irq(dev->irq,dev); free_irq(dev->irq,dev);
unregister_trdev(dev) ; unregister_netdev(dev) ;
kfree(dev) ; kfree(dev) ;
xl_reset(dev) ; xl_reset(dev) ;
writel(ACK_INTERRUPT | LATCH_ACK, xl_mmio + MMIO_COMMAND) ; writel(ACK_INTERRUPT | LATCH_ACK, xl_mmio + MMIO_COMMAND) ;
...@@ -1783,7 +1783,7 @@ static void __devexit xl_remove_one (struct pci_dev *pdev) ...@@ -1783,7 +1783,7 @@ static void __devexit xl_remove_one (struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct xl_private *xl_priv=(struct xl_private *)dev->priv; struct xl_private *xl_priv=(struct xl_private *)dev->priv;
unregister_trdev(dev); unregister_netdev(dev);
iounmap(xl_priv->xl_mmio) ; iounmap(xl_priv->xl_mmio) ;
pci_release_regions(pdev) ; pci_release_regions(pdev) ;
pci_set_drvdata(pdev,NULL) ; pci_set_drvdata(pdev,NULL) ;
......
...@@ -112,9 +112,10 @@ static int __init abyss_attach(struct pci_dev *pdev, const struct pci_device_id ...@@ -112,9 +112,10 @@ static int __init abyss_attach(struct pci_dev *pdev, const struct pci_device_id
/* At this point we have found a valid card. */ /* At this point we have found a valid card. */
dev = init_trdev(NULL, 0); dev = alloc_trdev(0);
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
if (!request_region(pci_ioaddr, ABYSS_IO_EXTENT, dev->name)) { if (!request_region(pci_ioaddr, ABYSS_IO_EXTENT, dev->name)) {
...@@ -165,21 +166,21 @@ static int __init abyss_attach(struct pci_dev *pdev, const struct pci_device_id ...@@ -165,21 +166,21 @@ static int __init abyss_attach(struct pci_dev *pdev, const struct pci_device_id
dev->open = abyss_open; dev->open = abyss_open;
dev->stop = abyss_close; dev->stop = abyss_close;
ret = register_trdev(dev); pci_set_drvdata(pdev, dev);
ret = register_netdev(dev);
if (ret) if (ret)
goto err_out_tmsdev; goto err_out_tmsdev;
pci_set_drvdata(pdev, dev);
return 0; return 0;
err_out_tmsdev: err_out_tmsdev:
pci_set_drvdata(pdev, NULL);
tmsdev_term(dev); tmsdev_term(dev);
err_out_irq: err_out_irq:
free_irq(pdev->irq, dev); free_irq(pdev->irq, dev);
err_out_region: err_out_region:
release_region(pci_ioaddr, ABYSS_IO_EXTENT); release_region(pci_ioaddr, ABYSS_IO_EXTENT);
err_out_trdev: err_out_trdev:
unregister_netdev(dev);
kfree(dev); kfree(dev);
return ret; return ret;
} }
......
...@@ -110,7 +110,6 @@ in the event that chatty debug messages are desired - jjs 12/30/98 */ ...@@ -110,7 +110,6 @@ in the event that chatty debug messages are desired - jjs 12/30/98 */
#include <linux/module.h> #include <linux/module.h>
#ifdef PCMCIA #ifdef PCMCIA
#undef MODULE
#undef ENABLE_PAGING #undef ENABLE_PAGING
#else #else
#define ENABLE_PAGING 1 #define ENABLE_PAGING 1
...@@ -352,7 +351,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) ...@@ -352,7 +351,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
unsigned char segment, intr=0, irq=0, i, j, cardpresent=NOTOK, temp=0; unsigned char segment, intr=0, irq=0, i, j, cardpresent=NOTOK, temp=0;
void * t_mmio = 0; void * t_mmio = 0;
struct tok_info *ti = 0; struct tok_info *ti = dev->priv;
void *cd_chanid; void *cd_chanid;
unsigned char *tchanid, ctemp; unsigned char *tchanid, ctemp;
#ifndef PCMCIA #ifndef PCMCIA
...@@ -361,14 +360,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) ...@@ -361,14 +360,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
static int version_printed; static int version_printed;
#endif #endif
#ifndef MODULE
#ifndef PCMCIA
dev = init_trdev(dev, 0);
if (!dev)
return -ENOMEM;
#endif
#endif
/* Query the adapter PIO base port which will return /* Query the adapter PIO base port which will return
* indication of where MMIO was placed. We also have a * indication of where MMIO was placed. We also have a
* coded interrupt number. * coded interrupt number.
...@@ -404,7 +395,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) ...@@ -404,7 +395,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
*/ */
#ifdef PCMCIA #ifdef PCMCIA
iounmap(t_mmio); iounmap(t_mmio);
ti = dev->priv; /*BMS moved up here */
t_mmio = (void *)ti->mmio; /*BMS to get virtual address */ t_mmio = (void *)ti->mmio; /*BMS to get virtual address */
irq = ti->irq; /*BMS to display the irq! */ irq = ti->irq; /*BMS to display the irq! */
#endif #endif
...@@ -454,30 +444,20 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) ...@@ -454,30 +444,20 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
DPRINTK("Expected for MCA: "); DPRINTK("Expected for MCA: ");
PrtChanID(mcchannelid, 1); PrtChanID(mcchannelid, 1);
} }
/* Now, allocate some of the pl0 buffers for this driver.. */ /* Now, setup some of the pl0 buffers for this driver.. */
/* If called from PCMCIA, it is already set up, so no need to /* If called from PCMCIA, it is already set up, so no need to
waste the memory, just use the existing structure */ waste the memory, just use the existing structure */
#ifndef PCMCIA #ifndef PCMCIA
ti = (struct tok_info *) kmalloc(sizeof(struct tok_info), GFP_KERNEL);
if (ti == NULL) {
iounmap(t_mmio);
return -ENOMEM;
}
memset(ti, 0, sizeof(struct tok_info));
ti->mmio = t_mmio; ti->mmio = t_mmio;
dev->priv = ti; /* this seems like the logical use of the for (i = 0; i < IBMTR_MAX_ADAPTERS; i++) {
field ... let's try some empirical tests if (turbo_io[i] != PIOaddr)
using the token-info structure -- that continue;
should fit with out future hope of multiple
adapter support as well /dwm */
for(i=0; i<IBMTR_MAX_ADAPTERS; i++) {
if (turbo_io[i] != PIOaddr) continue;
#if IBMTR_DEBUG_MESSAGES #if IBMTR_DEBUG_MESSAGES
printk("ibmtr::tr_probe1, setting PIOaddr %x to Turbo\n" , printk("ibmtr::tr_probe1, setting PIOaddr %x to Turbo\n",
PIOaddr); PIOaddr);
#endif #endif
ti->turbo=1; ti->turbo = 1;
t_irq=turbo_irq[i]; t_irq = turbo_irq[i];
} }
#endif /* !PCMCIA */ #endif /* !PCMCIA */
ti->readlog_pending = 0; ti->readlog_pending = 0;
...@@ -826,11 +806,6 @@ static int __devinit trdev_init(struct net_device *dev) ...@@ -826,11 +806,6 @@ static int __devinit trdev_init(struct net_device *dev)
dev->set_multicast_list = tok_set_multicast_list; dev->set_multicast_list = tok_set_multicast_list;
dev->change_mtu = ibmtr_change_mtu; dev->change_mtu = ibmtr_change_mtu;
#ifndef MODULE
#ifndef PCMCIA
tr_setup(dev);
#endif
#endif
return 0; return 0;
} }
...@@ -1948,21 +1923,21 @@ int init_module(void) ...@@ -1948,21 +1923,21 @@ int init_module(void)
int count=0; int count=0;
find_turbo_adapters(io); find_turbo_adapters(io);
for (i = 0; io[i] && (i < IBMTR_MAX_ADAPTERS); i++) { for (i = 0; io[i] && (i < IBMTR_MAX_ADAPTERS); i++) {
irq[i] = 0; irq[i] = 0;
mem[i] = 0; mem[i] = 0;
dev_ibmtr[i] = NULL; dev_ibmtr[i] = alloc_trdev(sizeof(struct tok_info));
dev_ibmtr[i] = init_trdev(dev_ibmtr[i], 0);
if (dev_ibmtr[i] == NULL) { if (dev_ibmtr[i] == NULL) {
if (i==0) if (i == 0)
return -ENOMEM; return -ENOMEM;
break ; break;
} }
dev_ibmtr[i]->base_addr = io[i]; dev_ibmtr[i]->base_addr = io[i];
dev_ibmtr[i]->irq = irq[i]; dev_ibmtr[i]->irq = irq[i];
dev_ibmtr[i]->mem_start = mem[i]; dev_ibmtr[i]->mem_start = mem[i];
dev_ibmtr[i]->init = &ibmtr_probe; dev_ibmtr[i]->init = &ibmtr_probe;
if (register_trdev(dev_ibmtr[i]) != 0) { if (register_netdev(dev_ibmtr[i]) != 0) {
kfree(dev_ibmtr[i]); kfree(dev_ibmtr[i]);
dev_ibmtr[i] = NULL; dev_ibmtr[i] = NULL;
continue; continue;
...@@ -1970,7 +1945,7 @@ int init_module(void) ...@@ -1970,7 +1945,7 @@ int init_module(void)
count++; count++;
} }
if (count) return 0; if (count) return 0;
printk("ibmtr: register_trdev() returned non-zero.\n"); printk("ibmtr: register_netdev() returned non-zero.\n");
return -EIO; return -EIO;
} /*init_module */ } /*init_module */
...@@ -1979,24 +1954,25 @@ void cleanup_module(void) ...@@ -1979,24 +1954,25 @@ void cleanup_module(void)
int i,j; int i,j;
for (i = 0; i < IBMTR_MAX_ADAPTERS; i++){ for (i = 0; i < IBMTR_MAX_ADAPTERS; i++){
if(!dev_ibmtr[i]) continue; if (!dev_ibmtr[i])
continue;
if (dev_ibmtr[i]->base_addr) { if (dev_ibmtr[i]->base_addr) {
outb(0,dev_ibmtr[i]->base_addr+ADAPTRESET); outb(0,dev_ibmtr[i]->base_addr+ADAPTRESET);
for(j=jiffies+TR_RST_TIME; for(j=jiffies+TR_RST_TIME;
time_before_eq(jiffies,j);) ; time_before_eq(jiffies,j);) ;
outb(0,dev_ibmtr[i]->base_addr+ADAPTRESETREL); outb(0,dev_ibmtr[i]->base_addr+ADAPTRESETREL);
} }
unregister_trdev(dev_ibmtr[i]); unregister_netdev(dev_ibmtr[i]);
free_irq(dev_ibmtr[i]->irq, dev_ibmtr[i]); free_irq(dev_ibmtr[i]->irq, dev_ibmtr[i]);
release_region(dev_ibmtr[i]->base_addr, IBMTR_IO_EXTENT); release_region(dev_ibmtr[i]->base_addr, IBMTR_IO_EXTENT);
#ifndef PCMCIA #ifndef PCMCIA
{ {
struct tok_info *ti = (struct tok_info *)dev_ibmtr[i]->priv ; struct tok_info *ti = (struct tok_info *)
iounmap((u32 *)ti->mmio) ; dev_ibmtr[i]->priv;
iounmap((u32 *)ti->sram_virt) ; iounmap((u32 *)ti->mmio);
iounmap((u32 *)ti->sram_virt);
} }
#endif #endif
kfree(dev_ibmtr[i]->priv);
kfree(dev_ibmtr[i]); kfree(dev_ibmtr[i]);
dev_ibmtr[i] = NULL; dev_ibmtr[i] = NULL;
} }
......
This diff is collapsed.
...@@ -177,12 +177,14 @@ static int __init madgemc_probe(void) ...@@ -177,12 +177,14 @@ static int __init madgemc_probe(void)
if (versionprinted++ == 0) if (versionprinted++ == 0)
printk("%s", version); printk("%s", version);
if ((dev = init_trdev(NULL, 0))==NULL) { dev = alloc_trdev(0);
if (dev == NULL) {
printk("madgemc: unable to allocate dev space\n"); printk("madgemc: unable to allocate dev space\n");
if (madgemc_card_list) if (madgemc_card_list)
return 0; return 0;
return -1; return -1;
} }
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
dev->dma = 0; dev->dma = 0;
...@@ -195,7 +197,7 @@ static int __init madgemc_probe(void) ...@@ -195,7 +197,7 @@ static int __init madgemc_probe(void)
card = kmalloc(sizeof(struct madgemc_card), GFP_KERNEL); card = kmalloc(sizeof(struct madgemc_card), GFP_KERNEL);
if (card==NULL) { if (card==NULL) {
printk("madgemc: unable to allocate card struct\n"); printk("madgemc: unable to allocate card struct\n");
kfree(dev); /* release_trdev? */ kfree(dev);
if (madgemc_card_list) if (madgemc_card_list)
return 0; return 0;
return -1; return -1;
...@@ -331,7 +333,7 @@ static int __init madgemc_probe(void) ...@@ -331,7 +333,7 @@ static int __init madgemc_probe(void)
*/ */
outb(0, dev->base_addr + MC_CONTROL_REG0); /* sanity */ outb(0, dev->base_addr + MC_CONTROL_REG0); /* sanity */
madgemc_setsifsel(dev, 1); madgemc_setsifsel(dev, 1);
if(request_irq(dev->irq, madgemc_interrupt, SA_SHIRQ, if (request_irq(dev->irq, madgemc_interrupt, SA_SHIRQ,
"madgemc", dev)) "madgemc", dev))
goto getout; goto getout;
...@@ -382,33 +384,22 @@ static int __init madgemc_probe(void) ...@@ -382,33 +384,22 @@ static int __init madgemc_probe(void)
dev->open = madgemc_open; dev->open = madgemc_open;
dev->stop = madgemc_close; dev->stop = madgemc_close;
if (register_trdev(dev) == 0) { if (register_netdev(dev) == 0) {
/* Enlist in the card list */ /* Enlist in the card list */
card->next = madgemc_card_list; card->next = madgemc_card_list;
madgemc_card_list = card; madgemc_card_list = card;
} else { slot++;
printk("madgemc: register_trdev() returned non-zero.\n"); continue; /* successful, try to find another */
release_region(dev->base_addr-MADGEMC_SIF_OFFSET,
MADGEMC_IO_EXTENT);
kfree(card);
tmsdev_term(dev);
kfree(dev);
if (madgemc_card_list)
return 0;
return -1;
} }
slot++;
continue; /* successful, try to find another */
free_irq(dev->irq, dev);
getout: getout:
release_region(dev->base_addr-MADGEMC_SIF_OFFSET, release_region(dev->base_addr-MADGEMC_SIF_OFFSET,
MADGEMC_IO_EXTENT); MADGEMC_IO_EXTENT);
getout1: getout1:
kfree(card); kfree(card);
kfree(dev); /* release_trdev? */ kfree(dev);
slot++; slot++;
} }
...@@ -779,7 +770,7 @@ static void __exit madgemc_exit(void) ...@@ -779,7 +770,7 @@ static void __exit madgemc_exit(void)
while (madgemc_card_list) { while (madgemc_card_list) {
dev = madgemc_card_list->dev; dev = madgemc_card_list->dev;
unregister_trdev(dev); unregister_netdev(dev);
release_region(dev->base_addr-MADGEMC_SIF_OFFSET, MADGEMC_IO_EXTENT); release_region(dev->base_addr-MADGEMC_SIF_OFFSET, MADGEMC_IO_EXTENT);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
tmsdev_term(dev); tmsdev_term(dev);
......
...@@ -1773,7 +1773,7 @@ static void __devexit olympic_remove_one(struct pci_dev *pdev) ...@@ -1773,7 +1773,7 @@ static void __devexit olympic_remove_one(struct pci_dev *pdev)
strcat(proc_name,dev->name) ; strcat(proc_name,dev->name) ;
remove_proc_entry(proc_name,NULL); remove_proc_entry(proc_name,NULL);
} }
unregister_trdev(dev) ; unregister_netdev(dev) ;
iounmap(olympic_priv->olympic_mmio) ; iounmap(olympic_priv->olympic_mmio) ;
iounmap(olympic_priv->olympic_lap) ; iounmap(olympic_priv->olympic_lap) ;
pci_release_regions(pdev) ; pci_release_regions(pdev) ;
......
...@@ -121,6 +121,11 @@ int __init proteon_probe(struct net_device *dev) ...@@ -121,6 +121,11 @@ int __init proteon_probe(struct net_device *dev)
int i,j; int i,j;
struct proteon_card *card; struct proteon_card *card;
#ifndef MODULE
netdev_boot_setup_check(dev);
tr_setup(dev);
#endif
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
if (!dev->base_addr) if (!dev->base_addr)
{ {
...@@ -158,20 +163,8 @@ int __init proteon_probe(struct net_device *dev) ...@@ -158,20 +163,8 @@ int __init proteon_probe(struct net_device *dev)
if (versionprinted++ == 0) if (versionprinted++ == 0)
printk(KERN_DEBUG "%s", version); printk(KERN_DEBUG "%s", version);
#ifndef MODULE
dev = init_trdev(dev, 0);
if (!dev)
{
release_region(dev->base_addr, PROTEON_IO_EXTENT);
return -1;
}
#endif
if (tmsdev_init(dev, ISA_MAX_ADDRESS, NULL)) if (tmsdev_init(dev, ISA_MAX_ADDRESS, NULL))
{ goto out4;
release_region(dev->base_addr, PROTEON_IO_EXTENT);
return -1;
}
dev->base_addr &= ~3; dev->base_addr &= ~3;
...@@ -211,9 +204,7 @@ int __init proteon_probe(struct net_device *dev) ...@@ -211,9 +204,7 @@ int __init proteon_probe(struct net_device *dev)
if(irqlist[j] == 0) if(irqlist[j] == 0)
{ {
printk(KERN_INFO "%s: AutoSelect no IRQ available\n", dev->name); printk(KERN_INFO "%s: AutoSelect no IRQ available\n", dev->name);
release_region(dev->base_addr, PROTEON_IO_EXTENT); goto out3;
tmsdev_term(dev);
return -1;
} }
} }
else else
...@@ -225,18 +216,14 @@ int __init proteon_probe(struct net_device *dev) ...@@ -225,18 +216,14 @@ int __init proteon_probe(struct net_device *dev)
{ {
printk(KERN_INFO "%s: Illegal IRQ %d specified\n", printk(KERN_INFO "%s: Illegal IRQ %d specified\n",
dev->name, dev->irq); dev->name, dev->irq);
release_region(dev->base_addr, PROTEON_IO_EXTENT); goto out3;
tmsdev_term(dev);
return -1;
} }
if (request_irq(dev->irq, tms380tr_interrupt, 0, if (request_irq(dev->irq, tms380tr_interrupt, 0,
cardname, dev)) cardname, dev))
{ {
printk(KERN_INFO "%s: Selected IRQ %d not available\n", printk(KERN_INFO "%s: Selected IRQ %d not available\n",
dev->name, dev->irq); dev->name, dev->irq);
release_region(dev->base_addr, PROTEON_IO_EXTENT); goto out3;
tmsdev_term(dev);
return -1;
} }
} }
...@@ -252,10 +239,7 @@ int __init proteon_probe(struct net_device *dev) ...@@ -252,10 +239,7 @@ int __init proteon_probe(struct net_device *dev)
if(dmalist[j] == 0) if(dmalist[j] == 0)
{ {
printk(KERN_INFO "%s: AutoSelect no DMA available\n", dev->name); printk(KERN_INFO "%s: AutoSelect no DMA available\n", dev->name);
release_region(dev->base_addr, PROTEON_IO_EXTENT); goto out2;
free_irq(dev->irq, dev);
tmsdev_term(dev);
return -1;
} }
} }
else else
...@@ -267,52 +251,36 @@ int __init proteon_probe(struct net_device *dev) ...@@ -267,52 +251,36 @@ int __init proteon_probe(struct net_device *dev)
{ {
printk(KERN_INFO "%s: Illegal DMA %d specified\n", printk(KERN_INFO "%s: Illegal DMA %d specified\n",
dev->name, dev->dma); dev->name, dev->dma);
release_region(dev->base_addr, PROTEON_IO_EXTENT); goto out2;
free_irq(dev->irq, dev);
tmsdev_term(dev);
return -1;
} }
if (request_dma(dev->dma, cardname)) if (request_dma(dev->dma, cardname))
{ {
printk(KERN_INFO "%s: Selected DMA %d not available\n", printk(KERN_INFO "%s: Selected DMA %d not available\n",
dev->name, dev->dma); dev->name, dev->dma);
release_region(dev->base_addr, PROTEON_IO_EXTENT); goto out2;
free_irq(dev->irq, dev);
tmsdev_term(dev);
return -1;
} }
} }
printk(KERN_DEBUG "%s: IO: %#4lx IRQ: %d DMA: %d\n", printk(KERN_DEBUG "%s: IO: %#4lx IRQ: %d DMA: %d\n",
dev->name, dev->base_addr, dev->irq, dev->dma); dev->name, dev->base_addr, dev->irq, dev->dma);
if (register_trdev(dev) == 0) /* Enlist in the card list */
{ card = kmalloc(sizeof(struct proteon_card), GFP_KERNEL);
/* Enlist in the card list */ if (!card)
card = kmalloc(sizeof(struct proteon_card), GFP_KERNEL); goto out;
if (!card) { card->next = proteon_card_list;
unregister_trdev(dev); proteon_card_list = card;
release_region(dev->base_addr, PROTEON_IO_EXTENT); card->dev = dev;
free_irq(dev->irq, dev);
free_dma(dev->dma);
tmsdev_term(dev);
return -1;
}
card->next = proteon_card_list;
proteon_card_list = card;
card->dev = dev;
}
else
{
printk("KERN_INFO %s: register_trdev() returned non-zero.\n", dev->name);
release_region(dev->base_addr, PROTEON_IO_EXTENT);
free_irq(dev->irq, dev);
free_dma(dev->dma);
tmsdev_term(dev);
return -1;
}
return 0; return 0;
out:
free_dma(dev->dma);
out2:
free_irq(dev->irq, dev);
out3:
tmsdev_term(dev);
out4:
release_region(dev->base_addr, PROTEON_IO_EXTENT);
return -1;
} }
/* /*
...@@ -402,64 +370,51 @@ MODULE_PARM(io, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i"); ...@@ -402,64 +370,51 @@ MODULE_PARM(io, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
MODULE_PARM(dma, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i"); MODULE_PARM(dma, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
static int __init setup_card(unsigned long io, unsigned irq, unsigned char dma)
{
int res = -ENOMEM;
struct proteon_card *this_card;
struct net_device *dev = alloc_trdev(0);
if (dev) {
dev->base_addr = io;
dev->irq = irq;
dev->dma = dma;
res = -ENODEV;
if (proteon_probe(dev) == 0) {
res = register_netdev(dev);
if (!res)
return 0;
release_region(dev->base_addr, PROTEON_IO_EXTENT);
free_irq(dev->irq, dev);
free_dma(dev->dma);
tmsdev_term(dev);
this_card = proteon_card_list;
proteon_card_list = this_card->next;
kfree(this_card);
}
kfree(dev);
}
return res;
}
int init_module(void) int init_module(void)
{ {
int i, num; int i, num;
struct net_device *dev; struct net_device *dev;
num = 0; num = 0;
if (io[0]) if (io[0]) { /* Only probe addresses from command line */
{ /* Only probe addresses from command line */ for (i = 0; i < ISATR_MAX_ADAPTERS ; i++) {
dev = init_trdev(NULL, 0); if (io[i] && setup_card(io[i], irq[i], dma[i]) == 0)
if (!dev)
return (-ENOMEM);
for (i = 0; i < ISATR_MAX_ADAPTERS; i++)
{
if (io[i] == 0)
continue;
dev->base_addr = io[i];
dev->irq = irq[i];
dev->dma = dma[i];
if (!proteon_probe(dev))
{
num++; num++;
dev = init_trdev(NULL, 0);
if (!dev)
goto partial;
}
} }
unregister_netdev(dev); } else {
kfree(dev); for(i = 0; num < ISATR_MAX_ADAPTERS && portlist[i]; i++) {
} if (setup_card(portlist[i], irq[i], dma[i]))
else
{
dev = init_trdev(NULL, 0);
if (!dev)
return (-ENOMEM);
for(i = 0; portlist[i]; i++)
{
if (num >= ISATR_MAX_ADAPTERS)
continue;
dev->base_addr = portlist[i];
dev->irq = irq[num];
dev->dma = dma[num];
if (!proteon_probe(dev))
{
num++; num++;
dev = init_trdev(NULL, 0);
if (!dev)
goto partial;
}
} }
unregister_netdev(dev);
kfree(dev);
} }
partial:
printk(KERN_NOTICE "proteon.c: %d cards found.\n", num); printk(KERN_NOTICE "proteon.c: %d cards found.\n", num);
/* Probe for cards. */ /* Probe for cards. */
if (num == 0) { if (num == 0) {
......
...@@ -141,6 +141,11 @@ int __init sk_isa_probe(struct net_device *dev) ...@@ -141,6 +141,11 @@ int __init sk_isa_probe(struct net_device *dev)
int i,j; int i,j;
struct sk_isa_card *card; struct sk_isa_card *card;
#ifndef MODULE
netdev_boot_setup_check(dev);
tr_setup(dev);
#endif
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
if (!dev->base_addr) if (!dev->base_addr)
{ {
...@@ -178,20 +183,8 @@ int __init sk_isa_probe(struct net_device *dev) ...@@ -178,20 +183,8 @@ int __init sk_isa_probe(struct net_device *dev)
if (versionprinted++ == 0) if (versionprinted++ == 0)
printk(KERN_DEBUG "%s", version); printk(KERN_DEBUG "%s", version);
#ifndef MODULE
dev = init_trdev(dev, 0);
if (!dev)
{
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
return -1;
}
#endif
if (tmsdev_init(dev, ISA_MAX_ADDRESS, NULL)) if (tmsdev_init(dev, ISA_MAX_ADDRESS, NULL))
{ goto out4;
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
return -1;
}
dev->base_addr &= ~3; dev->base_addr &= ~3;
...@@ -231,9 +224,7 @@ int __init sk_isa_probe(struct net_device *dev) ...@@ -231,9 +224,7 @@ int __init sk_isa_probe(struct net_device *dev)
if(irqlist[j] == 0) if(irqlist[j] == 0)
{ {
printk(KERN_INFO "%s: AutoSelect no IRQ available\n", dev->name); printk(KERN_INFO "%s: AutoSelect no IRQ available\n", dev->name);
release_region(dev->base_addr, SK_ISA_IO_EXTENT); goto out3;
tmsdev_term(dev);
return -1;
} }
} }
else else
...@@ -245,18 +236,14 @@ int __init sk_isa_probe(struct net_device *dev) ...@@ -245,18 +236,14 @@ int __init sk_isa_probe(struct net_device *dev)
{ {
printk(KERN_INFO "%s: Illegal IRQ %d specified\n", printk(KERN_INFO "%s: Illegal IRQ %d specified\n",
dev->name, dev->irq); dev->name, dev->irq);
release_region(dev->base_addr, SK_ISA_IO_EXTENT); goto out3;
tmsdev_term(dev);
return -1;
} }
if (request_irq(dev->irq, tms380tr_interrupt, 0, if (request_irq(dev->irq, tms380tr_interrupt, 0,
isa_cardname, dev)) isa_cardname, dev))
{ {
printk(KERN_INFO "%s: Selected IRQ %d not available\n", printk(KERN_INFO "%s: Selected IRQ %d not available\n",
dev->name, dev->irq); dev->name, dev->irq);
release_region(dev->base_addr, SK_ISA_IO_EXTENT); goto out3;
tmsdev_term(dev);
return -1;
} }
} }
...@@ -272,10 +259,7 @@ int __init sk_isa_probe(struct net_device *dev) ...@@ -272,10 +259,7 @@ int __init sk_isa_probe(struct net_device *dev)
if(dmalist[j] == 0) if(dmalist[j] == 0)
{ {
printk(KERN_INFO "%s: AutoSelect no DMA available\n", dev->name); printk(KERN_INFO "%s: AutoSelect no DMA available\n", dev->name);
release_region(dev->base_addr, SK_ISA_IO_EXTENT); goto out2;
free_irq(dev->irq, dev);
tmsdev_term(dev);
return -1;
} }
} }
else else
...@@ -287,52 +271,36 @@ int __init sk_isa_probe(struct net_device *dev) ...@@ -287,52 +271,36 @@ int __init sk_isa_probe(struct net_device *dev)
{ {
printk(KERN_INFO "%s: Illegal DMA %d specified\n", printk(KERN_INFO "%s: Illegal DMA %d specified\n",
dev->name, dev->dma); dev->name, dev->dma);
release_region(dev->base_addr, SK_ISA_IO_EXTENT); goto out2;
free_irq(dev->irq, dev);
tmsdev_term(dev);
return -1;
} }
if (request_dma(dev->dma, isa_cardname)) if (request_dma(dev->dma, isa_cardname))
{ {
printk(KERN_INFO "%s: Selected DMA %d not available\n", printk(KERN_INFO "%s: Selected DMA %d not available\n",
dev->name, dev->dma); dev->name, dev->dma);
release_region(dev->base_addr, SK_ISA_IO_EXTENT); goto out2;
free_irq(dev->irq, dev);
tmsdev_term(dev);
return -1;
} }
} }
printk(KERN_DEBUG "%s: IO: %#4lx IRQ: %d DMA: %d\n", printk(KERN_DEBUG "%s: IO: %#4lx IRQ: %d DMA: %d\n",
dev->name, dev->base_addr, dev->irq, dev->dma); dev->name, dev->base_addr, dev->irq, dev->dma);
if (register_trdev(dev) == 0) /* Enlist in the card list */
{ card = kmalloc(sizeof(struct sk_isa_card), GFP_KERNEL);
/* Enlist in the card list */ if (!card)
card = kmalloc(sizeof(struct sk_isa_card), GFP_KERNEL); goto out;
if (!card) { card->next = sk_isa_card_list;
unregister_trdev(dev); sk_isa_card_list = card;
release_region(dev->base_addr, SK_ISA_IO_EXTENT); card->dev = dev;
free_irq(dev->irq, dev);
free_dma(dev->dma);
tmsdev_term(dev);
return -1;
}
card->next = sk_isa_card_list;
sk_isa_card_list = card;
card->dev = dev;
}
else
{
printk("KERN_INFO %s: register_trdev() returned non-zero.\n", dev->name);
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
free_irq(dev->irq, dev);
free_dma(dev->dma);
tmsdev_term(dev);
return -1;
}
return 0; return 0;
out:
free_dma(dev->dma);
out2:
free_irq(dev->irq, dev);
out3:
tmsdev_term(dev);
out4:
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
return -1;
} }
/* /*
...@@ -415,64 +383,51 @@ MODULE_PARM(io, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i"); ...@@ -415,64 +383,51 @@ MODULE_PARM(io, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i"); MODULE_PARM(irq, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
MODULE_PARM(dma, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i"); MODULE_PARM(dma, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
static int __init setup_card(unsigned long io, unsigned irq, unsigned char dma)
{
int res = -ENOMEM;
struct sk_isa_card *this_card;
struct net_device *dev = alloc_trdev(0);
if (dev) {
dev->base_addr = io;
dev->irq = irq;
dev->dma = dma;
res = -ENODEV;
if (sk_isa_probe(dev) == 0) {
res = register_netdev(dev);
if (!res)
return 0;
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
free_irq(dev->irq, dev);
free_dma(dev->dma);
tmsdev_term(dev);
this_card = sk_isa_card_list;
sk_isa_card_list = this_card->next;
kfree(this_card);
}
kfree(dev);
}
return res;
}
int init_module(void) int init_module(void)
{ {
int i, num; int i, num;
struct net_device *dev; struct net_device *dev;
num = 0; num = 0;
if (io[0]) if (io[0]) { /* Only probe addresses from command line */
{ /* Only probe addresses from command line */ for (i = 0; i < ISATR_MAX_ADAPTERS ; i++) {
dev = init_trdev(NULL, 0); if (io[i] && setup_card(io[i], irq[i], dma[i]) == 0)
if (!dev)
return (-ENOMEM);
for (i = 0; i < ISATR_MAX_ADAPTERS; i++)
{
if (io[i] == 0)
continue;
dev->base_addr = io[i];
dev->irq = irq[i];
dev->dma = dma[i];
if (!sk_isa_probe(dev))
{
num++; num++;
dev = init_trdev(NULL, 0);
if (!dev)
goto partial;
}
} }
unregister_netdev(dev); } else {
kfree(dev); for(i = 0; num < ISATR_MAX_ADAPTERS && portlist[i]; i++) {
} if (setup_card(portlist[i], irq[i], dma[i]))
else
{
dev = init_trdev(NULL, 0);
if (!dev)
return (-ENOMEM);
for(i = 0; portlist[i]; i++)
{
if (num >= ISATR_MAX_ADAPTERS)
continue;
dev->base_addr = portlist[i];
dev->irq = irq[num];
dev->dma = dma[num];
if (!sk_isa_probe(dev))
{
num++; num++;
dev = init_trdev(NULL, 0);
if (!dev)
goto partial;
}
} }
unregister_netdev(dev);
kfree(dev);
} }
partial:
printk(KERN_NOTICE "skisa.c: %d cards found.\n", num); printk(KERN_NOTICE "skisa.c: %d cards found.\n", num);
/* Probe for cards. */ /* Probe for cards. */
if (num == 0) { if (num == 0) {
......
This diff is collapsed.
...@@ -112,11 +112,11 @@ static int __init tms_pci_attach(struct pci_dev *pdev, const struct pci_device_i ...@@ -112,11 +112,11 @@ static int __init tms_pci_attach(struct pci_dev *pdev, const struct pci_device_i
pci_ioaddr = pci_resource_start (pdev, 0); pci_ioaddr = pci_resource_start (pdev, 0);
/* At this point we have found a valid card. */ /* At this point we have found a valid card. */
dev = init_trdev(NULL, 0); dev = alloc_trdev(0);
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
if (!request_region(pci_ioaddr, TMS_PCI_IO_EXTENT, dev->name)) { if (!request_region(pci_ioaddr, TMS_PCI_IO_EXTENT, dev->name)) {
ret = -EBUSY; ret = -EBUSY;
goto err_out_trdev; goto err_out_trdev;
...@@ -163,22 +163,22 @@ static int __init tms_pci_attach(struct pci_dev *pdev, const struct pci_device_i ...@@ -163,22 +163,22 @@ static int __init tms_pci_attach(struct pci_dev *pdev, const struct pci_device_i
dev->open = tms380tr_open; dev->open = tms380tr_open;
dev->stop = tms380tr_close; dev->stop = tms380tr_close;
pci_set_drvdata(pdev, dev);
ret = register_trdev(dev); ret = register_netdev(dev);
if (ret) if (ret)
goto err_out_tmsdev; goto err_out_tmsdev;
pci_set_drvdata(pdev, dev);
return 0; return 0;
err_out_tmsdev: err_out_tmsdev:
pci_set_drvdata(pdev, NULL);
tmsdev_term(dev); tmsdev_term(dev);
err_out_irq: err_out_irq:
free_irq(pdev->irq, dev); free_irq(pdev->irq, dev);
err_out_region: err_out_region:
release_region(pci_ioaddr, TMS_PCI_IO_EXTENT); release_region(pci_ioaddr, TMS_PCI_IO_EXTENT);
err_out_trdev: err_out_trdev:
unregister_netdev(dev);
kfree(dev); kfree(dev);
return ret; return ret;
} }
......
...@@ -1751,30 +1751,29 @@ lcs_new_device(struct ccwgroup_device *ccwgdev) ...@@ -1751,30 +1751,29 @@ lcs_new_device(struct ccwgroup_device *ccwgdev)
#ifdef CONFIG_NET_ETHERNET #ifdef CONFIG_NET_ETHERNET
case LCS_FRAME_TYPE_ENET: case LCS_FRAME_TYPE_ENET:
card->lan_type_trans = eth_type_trans; card->lan_type_trans = eth_type_trans;
dev = init_etherdev(NULL,0); dev = alloc_etherdev(0);
break; break;
#endif #endif
#ifdef CONFIG_TR #ifdef CONFIG_TR
case LCS_FRAME_TYPE_TR: case LCS_FRAME_TYPE_TR:
card->lan_type_trans = tr_type_trans; card->lan_type_trans = tr_type_trans;
dev = init_trdev(NULL,0); dev = alloc_trdev(0);
break; break;
#endif #endif
#ifdef CONFIG_FDDI #ifdef CONFIG_FDDI
case LCS_FRAME_TYPE_FDDI: case LCS_FRAME_TYPE_FDDI:
card->lan_type_trans = fddi_type_trans; card->lan_type_trans = fddi_type_trans;
dev = init_fddidev(NULL,0); dev = alloc_fddidev(0);
break; break;
#endif #endif
default: default:
LCS_DBF_TEXT(3, setup, "errinit"); LCS_DBF_TEXT(3, setup, "errinit");
PRINT_ERR("LCS: Initialization failed\n"); PRINT_ERR("LCS: Initialization failed\n");
PRINT_ERR("LCS: No device found!\n"); PRINT_ERR("LCS: No device found!\n");
lcs_cleanup_channel(&card->read); goto out;
lcs_cleanup_channel(&card->write);
lcs_free_card(card);
return -ENODEV;
} }
if (!dev)
goto out;
memcpy(dev->dev_addr, card->mac, LCS_MAC_LENGTH); memcpy(dev->dev_addr, card->mac, LCS_MAC_LENGTH);
card->dev = dev; card->dev = dev;
dev->priv = card; dev->priv = card;
...@@ -1787,9 +1786,16 @@ lcs_new_device(struct ccwgroup_device *ccwgdev) ...@@ -1787,9 +1786,16 @@ lcs_new_device(struct ccwgroup_device *ccwgdev)
#endif #endif
dev->get_stats = lcs_getstats; dev->get_stats = lcs_getstats;
SET_MODULE_OWNER(&tun->dev); SET_MODULE_OWNER(&tun->dev);
if (register_netdev(dev) != 0)
goto out;
netif_stop_queue(dev); netif_stop_queue(dev);
lcs_stopcard(card); lcs_stopcard(card);
return 0; return 0;
out:
lcs_cleanup_channel(&card->read);
lcs_cleanup_channel(&card->write);
lcs_free_card(card);
return -ENODEV;
} }
/** /**
......
...@@ -33,11 +33,7 @@ extern int fc_header(struct sk_buff *skb, struct net_device *dev, ...@@ -33,11 +33,7 @@ extern int fc_header(struct sk_buff *skb, struct net_device *dev,
extern int fc_rebuild_header(struct sk_buff *skb); extern int fc_rebuild_header(struct sk_buff *skb);
extern unsigned short fc_type_trans(struct sk_buff *skb, struct net_device *dev); extern unsigned short fc_type_trans(struct sk_buff *skb, struct net_device *dev);
extern struct net_device *init_fcdev(struct net_device *dev, int sizeof_priv);
extern struct net_device *alloc_fcdev(int sizeof_priv); extern struct net_device *alloc_fcdev(int sizeof_priv);
extern int register_fcdev(struct net_device *dev);
extern void unregister_fcdev(struct net_device *dev);
#endif #endif
#endif /* _LINUX_FCDEVICE_H */ #endif /* _LINUX_FCDEVICE_H */
...@@ -34,7 +34,6 @@ extern int fddi_header(struct sk_buff *skb, ...@@ -34,7 +34,6 @@ extern int fddi_header(struct sk_buff *skb,
extern int fddi_rebuild_header(struct sk_buff *skb); extern int fddi_rebuild_header(struct sk_buff *skb);
extern unsigned short fddi_type_trans(struct sk_buff *skb, extern unsigned short fddi_type_trans(struct sk_buff *skb,
struct net_device *dev); struct net_device *dev);
extern struct net_device *init_fddidev(struct net_device *dev, int sizeof_priv);
extern struct net_device *alloc_fddidev(int sizeof_priv); extern struct net_device *alloc_fddidev(int sizeof_priv);
#endif #endif
......
...@@ -49,12 +49,8 @@ extern void hippi_header_cache_update(struct hh_cache *hh, ...@@ -49,12 +49,8 @@ extern void hippi_header_cache_update(struct hh_cache *hh,
extern int hippi_header_parse(struct sk_buff *skb, unsigned char *haddr); extern int hippi_header_parse(struct sk_buff *skb, unsigned char *haddr);
extern void hippi_net_init(void); extern void hippi_net_init(void);
void hippi_setup(struct net_device *dev);
extern struct net_device *init_hippi_dev(struct net_device *dev, int sizeof_priv);
extern struct net_device *alloc_hippi_dev(int sizeof_priv); extern struct net_device *alloc_hippi_dev(int sizeof_priv);
extern int register_hipdev(struct net_device *dev);
extern void unregister_hipdev(struct net_device *dev);
#endif #endif
#endif /* _LINUX_HIPPIDEVICE_H */ #endif /* _LINUX_HIPPIDEVICE_H */
...@@ -34,10 +34,7 @@ extern int tr_header(struct sk_buff *skb, struct net_device *dev, ...@@ -34,10 +34,7 @@ extern int tr_header(struct sk_buff *skb, struct net_device *dev,
extern int tr_rebuild_header(struct sk_buff *skb); extern int tr_rebuild_header(struct sk_buff *skb);
extern unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev); extern unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev);
extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev); extern void tr_source_route(struct sk_buff *skb, struct trh_hdr *trh, struct net_device *dev);
extern struct net_device *init_trdev(struct net_device *dev, int sizeof_priv);
extern struct net_device *alloc_trdev(int sizeof_priv); extern struct net_device *alloc_trdev(int sizeof_priv);
extern int register_trdev(struct net_device *dev);
extern void unregister_trdev(struct net_device *dev);
#endif #endif
......
...@@ -861,12 +861,7 @@ static void __exit lane_module_cleanup(void) ...@@ -861,12 +861,7 @@ static void __exit lane_module_cleanup(void)
for (i = 0; i < MAX_LEC_ITF; i++) { for (i = 0; i < MAX_LEC_ITF; i++) {
if (dev_lec[i] != NULL) { if (dev_lec[i] != NULL) {
priv = (struct lec_priv *)dev_lec[i]->priv; priv = (struct lec_priv *)dev_lec[i]->priv;
#if defined(CONFIG_TR) unregister_netdev(dev_lec[i]);
if (priv->is_trdev)
unregister_trdev(dev_lec[i]);
else
#endif
unregister_netdev(dev_lec[i]);
kfree(dev_lec[i]); kfree(dev_lec[i]);
dev_lec[i] = NULL; dev_lec[i] = NULL;
} }
......
...@@ -347,6 +347,11 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) ...@@ -347,6 +347,11 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
return NULL; return NULL;
} }
/* One reference from device. We must do this before
* we invoke __ipv6_regen_rndid().
*/
in6_dev_hold(ndev);
#ifdef CONFIG_IPV6_PRIVACY #ifdef CONFIG_IPV6_PRIVACY
get_random_bytes(ndev->rndid, sizeof(ndev->rndid)); get_random_bytes(ndev->rndid, sizeof(ndev->rndid));
get_random_bytes(ndev->entropy, sizeof(ndev->entropy)); get_random_bytes(ndev->entropy, sizeof(ndev->entropy));
...@@ -367,8 +372,6 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) ...@@ -367,8 +372,6 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
write_lock_bh(&addrconf_lock); write_lock_bh(&addrconf_lock);
dev->ip6_ptr = ndev; dev->ip6_ptr = ndev;
/* One reference from device */
in6_dev_hold(ndev);
write_unlock_bh(&addrconf_lock); write_unlock_bh(&addrconf_lock);
ipv6_mc_init_dev(ndev); ipv6_mc_init_dev(ndev);
......
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