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)
struct daemon_data *dpri;
struct daemon_init *init = data;
init_etherdev(dev, 0);
pri = dev->priv;
dpri = (struct daemon_data *) pri->user;
*dpri = ((struct daemon_data)
{ .sock_type = init->sock_type,
.ctl_sock = init->ctl_sock,
.ctl_addr = NULL,
.data_addr = NULL,
.local_addr = NULL,
.fd = -1,
.control = -1,
.dev = dev });
dpri->sock_type = init->sock_type;
dpri->ctl_sock = init->ctl_sock;
dpri->fd = -1;
dpri->control = -1;
dpri->dev = dev;
printk("daemon backend (uml_switch version %d) - %s:%s",
SWITCH_VERSION, dpri->sock_type, dpri->ctl_sock);
......
......@@ -32,15 +32,13 @@ void mcast_init(struct net_device *dev, void *data)
struct mcast_data *dpri;
struct mcast_init *init = data;
init_etherdev(dev, 0);
pri = dev->priv;
dpri = (struct mcast_data *) pri->user;
*dpri = ((struct mcast_data)
{ .addr = init->addr,
.port = init->port,
.ttl = init->ttl,
.mcast_addr = NULL,
.dev = dev });
dpri->addr = init->addr;
dpri->port = init->port;
dpri->ttl = init->ttl;
dpri->dev = dev;
printk("mcast backend ");
printk("multicast adddress: %s:%u, TTL:%u ",
dpri->addr, dpri->port, dpri->ttl);
......
......@@ -292,45 +292,46 @@ static int eth_configure(int n, void *init, char *mac,
struct uml_net *device;
struct net_device *dev;
struct uml_net_private *lp;
int save, err, size;
int err, size;
size = transport->private_size + sizeof(struct uml_net_private) +
sizeof(((struct uml_net_private *) 0)->user);
device = kmalloc(sizeof(*device), GFP_KERNEL);
if(device == NULL){
if (device == NULL) {
printk(KERN_ERR "eth_configure failed to allocate uml_net\n");
return(1);
}
*device = ((struct uml_net) { .list = LIST_HEAD_INIT(device->list),
.dev = NULL,
.index = n,
.mac = { [ 0 ... 5 ] = 0 },
.have_mac = 0 });
memset(device, 0, sizeof(*device));
device->list = INIT_LIST_HEAD(device->list);
device->index = n;
spin_lock(&devices_lock);
list_add(&device->list, &devices);
spin_unlock(&devices_lock);
if(setup_etheraddr(mac, device->mac))
if (setup_etheraddr(mac, device->mac))
device->have_mac = 1;
printk(KERN_INFO "Netdevice %d ", n);
if(device->have_mac) printk("(%02x:%02x:%02x:%02x:%02x:%02x) ",
device->mac[0], device->mac[1],
device->mac[2], device->mac[3],
device->mac[4], device->mac[5]);
if (device->have_mac)
printk("(%02x:%02x:%02x:%02x:%02x:%02x) ",
device->mac[0], device->mac[1],
device->mac[2], device->mac[3],
device->mac[4], device->mac[5]);
printk(": ");
dev = kmalloc(sizeof(*dev) + size, GFP_KERNEL);
if(dev == NULL){
dev = alloc_etherdev(size);
if (dev == NULL) {
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);
dev->priv = (void *) &dev[1];
device->dev = dev;
dev->hard_header = uml_net_hard_header;
......@@ -357,42 +358,35 @@ static int eth_configure(int n, void *init, char *mac,
rtnl_lock();
err = register_netdevice(dev);
rtnl_unlock();
if(err)
return(1);
if (err)
return 1;
lp = dev->priv;
/* lp.user is the first four bytes of the transport data, which
* has already been initialized. This structure assignment will
* overwrite that, so we make sure that .user gets overwritten with
* what it already has.
*/
save = lp->user[0];
*lp = ((struct uml_net_private)
{ .list = LIST_HEAD_INIT(lp->list),
.lock = SPIN_LOCK_UNLOCKED,
.dev = dev,
.fd = -1,
.mac = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0},
.have_mac = device->have_mac,
.protocol = transport->kern->protocol,
.open = transport->user->open,
.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 } });
lp->list = INIT_LIST_HEAD(lp->list);
spin_lock_init(&lp->lock);
lp->dev = dev;
lp->fd = -1;
lp->mac = { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0 };
lp->have_mac = device->have_mac;
lp->protocol = transport->kern->protocol;
lp->open = transport->user->open;
lp->close = transport->user->close;
lp->remove = transport->user->remove;
lp->read = transport->kern->read;
lp->write = transport->kern->write;
lp->add_address = transport->user->add_address;
lp->delete_address = transport->user->delete_address;
lp->set_mtu = transport->user->set_mtu;
init_timer(&lp->tl);
lp->tl.function = uml_net_user_timer_expire;
memset(&lp->stats, 0, sizeof(lp->stats));
if(lp->have_mac) memcpy(lp->mac, device->mac, sizeof(lp->mac));
if (lp->have_mac)
memcpy(lp->mac, device->mac, sizeof(lp->mac));
if(transport->user->init)
if (transport->user->init)
(*transport->user->init)(&lp->user, dev);
if(device->have_mac)
if (device->have_mac)
set_ether_mac(dev, device->mac);
return(0);
}
......@@ -538,13 +532,15 @@ static int eth_setup(char *str)
if(err) return(1);
new = alloc_bootmem(sizeof(new));
if(new == NULL){
if (new == NULL){
printk("eth_init : alloc_bootmem failed\n");
return(1);
}
*new = ((struct eth_init) { .list = LIST_HEAD_INIT(new->list),
.index = n,
.init = str });
new->list = INIT_LIST_HEAD(new->list);
new->index = n;
new->init = str;
list_add_tail(&new->list, &eth_cmd_line);
return(1);
}
......
......@@ -23,16 +23,12 @@ void pcap_init(struct net_device *dev, void *data)
struct pcap_data *ppri;
struct pcap_init *init = data;
init_etherdev(dev, 0);
pri = dev->priv;
ppri = (struct pcap_data *) pri->user;
*ppri = ((struct pcap_data)
{ .host_if = init->host_if,
.promisc = init->promisc,
.optimize = init->optimize,
.filter = init->filter,
.compiled = NULL,
.pcap = NULL });
ppri->host_if = init->host_if;
ppri->promisc = init->promisc;
ppri->optimize = init->optimize;
ppri->filter = init->filter;
}
static int pcap_read(int fd, struct sk_buff **skb,
......
......@@ -24,18 +24,16 @@ static void etap_init(struct net_device *dev, void *data)
struct ethertap_data *epri;
struct ethertap_init *init = data;
init_etherdev(dev, 0);
pri = dev->priv;
epri = (struct ethertap_data *) pri->user;
*epri = ((struct ethertap_data)
{ .dev_name = init->dev_name,
.gate_addr = init->gate_addr,
.data_fd = -1,
.control_fd = -1,
.dev = dev });
epri->dev_name = init->dev_name;
epri->gate_addr = init->gate_addr;
epri->data_fd = -1;
epri->control_fd = -1;
epri->dev = dev;
printk("ethertap backend - %s", epri->dev_name);
if(epri->gate_addr != NULL)
if (epri->gate_addr != NULL)
printk(", IP = %s", epri->gate_addr);
printk("\n");
}
......
......@@ -24,17 +24,16 @@ static void tuntap_init(struct net_device *dev, void *data)
struct tuntap_data *tpri;
struct tuntap_init *init = data;
init_etherdev(dev, 0);
pri = dev->priv;
tpri = (struct tuntap_data *) pri->user;
*tpri = ((struct tuntap_data)
{ .dev_name = init->dev_name,
.fixed_config = (init->dev_name != NULL),
.gate_addr = init->gate_addr,
.fd = -1,
.dev = dev });
tpri->dev_name = init->dev_name;
tpri->fixed_config = (init->dev_name != NULL);
tpri->gate_addr = init->gate_addr;
tpri->fd = -1;
tpri->dev = dev;
printk("TUN/TAP backend - ");
if(tpri->gate_addr != NULL)
if (tpri->gate_addr != NULL)
printk("IP = %s", tpri->gate_addr);
printk("\n");
}
......
......@@ -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)
{
struct net_device *dev = NULL;
struct net_device *dev = alloc_fcdev(sizeof(struct mpt_lan_priv));
struct mpt_lan_priv *priv = NULL;
u8 HWaddr[FC_ALEN], *a;
dev = init_fcdev(NULL, sizeof(struct mpt_lan_priv));
if (!dev)
return (NULL);
return NULL;
dev->mtu = MPT_LAN_MTU;
priv = (struct mpt_lan_priv *) dev->priv;
......@@ -1435,15 +1435,18 @@ mpt_register_lan_device (MPT_ADAPTER *mpt_dev, int pnum)
SET_MODULE_OWNER(dev);
if (register_netdev(dev) != 0) {
kfree(dev);
dev = NULL;
}
return dev;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
int __init
mpt_lan_init (void)
static int __init mpt_lan_init (void)
{
struct net_device *dev;
MPT_ADAPTER *curadapter;
MPT_ADAPTER *p;
int i, j;
show_mptmod_ver(LANAME, LANVER);
......@@ -1477,51 +1480,49 @@ mpt_lan_init (void)
mpt_landev[j] = NULL;
}
curadapter = mpt_adapter_find_first();
while (curadapter != NULL) {
for (i = 0; i < curadapter->facts.NumberOfPorts; i++) {
for (p = mpt_adapter_find_first(); p; p = mpt_adapter_find_next(p)) {
for (i = 0; i < p->facts.NumberOfPorts; i++) {
printk (KERN_INFO MYNAM ": %s: PortNum=%x, ProtocolFlags=%02Xh (%c%c%c%c)\n",
curadapter->name,
curadapter->pfacts[i].PortNumber,
curadapter->pfacts[i].ProtocolFlags,
MPT_PROTOCOL_FLAGS_c_c_c_c(curadapter->pfacts[i].ProtocolFlags));
if (curadapter->pfacts[i].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) {
dev = mpt_register_lan_device (curadapter, i);
if (dev != NULL) {
printk (KERN_INFO MYNAM ": %s: Fusion MPT LAN device registered as '%s'\n",
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->dev_addr[0], dev->dev_addr[1],
dev->dev_addr[2], dev->dev_addr[3],
dev->dev_addr[4], dev->dev_addr[5]);
p->name,
p->pfacts[i].PortNumber,
p->pfacts[i].ProtocolFlags,
MPT_PROTOCOL_FLAGS_c_c_c_c(p->pfacts[i].ProtocolFlags));
if (!(p->pfacts[i].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN)) {
printk (KERN_INFO MYNAM ": %s: Hmmm... LAN protocol seems to be disabled on this adapter port!\n",
p->name);
continue;
}
dev = mpt_register_lan_device (p, i);
if (!dev) {
printk (KERN_ERR MYNAM ": %s: Unable to register port%d as a LAN device\n",
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",
// IOC_AND_NETDEV_NAMES_s_s(dev),
// NETDEV_TO_LANPRIV_PTR(dev)->tx_max_out);
j = curadapter->id;
mpt_landev[j] = dev;
dlprintk((KERN_INFO MYNAM "/init: dev_addr=%p, mpt_landev[%d]=%p\n",
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);
}
j = p->id;
mpt_landev[j] = dev;
dlprintk((KERN_INFO MYNAM "/init: dev_addr=%p, mpt_landev[%d]=%p\n",
dev, j, mpt_landev[j]));
}
curadapter = mpt_adapter_find_next(curadapter);
}
return 0;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
static void mpt_lan_exit(void)
static void __exit mpt_lan_exit(void)
{
int i;
......@@ -1532,7 +1533,7 @@ static void mpt_lan_exit(void)
printk (KERN_INFO ": %s/%s: Fusion MPT LAN device unregistered\n",
IOC_AND_NETDEV_NAMES_s_s(dev));
unregister_fcdev(dev);
unregister_netdev(dev);
//mpt_landev[i] = (struct net_device *) 0xdeadbeef; /* Debug */
mpt_landev[i] = NULL;
}
......
......@@ -425,11 +425,7 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr)
}
#endif
/*
* 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));
dev = alloc_fddidev(sizeof(*bp));
if (!dev) {
printk (KERN_ERR "defxx: unable to allocate fddidev, aborting\n");
return -ENOMEM;
......@@ -483,12 +479,17 @@ static int __devinit dfx_init_one_pci_or_eisa(struct pci_dev *pdev, long ioaddr)
goto err_out_region;
}
err = register_netdev(dev);
if (err)
goto err_out_kfree;
return 0;
err_out_kfree:
if (bp->kmalloced) kfree(bp->kmalloced);
err_out_region:
release_region(ioaddr, pdev ? PFI_K_CSR_IO_LEN : PI_ESIC_K_CSR_IO_LEN);
err_out:
unregister_netdev(dev);
kfree(dev);
return err;
}
......
......@@ -234,7 +234,7 @@ int __init iph5526_probe(struct net_device *dev)
{
if (pci_present() && (iph5526_probe_pci(dev) == 0))
return 0;
return -ENODEV;
return -ENODEV;
}
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
struct fc_info *fi = (struct fc_info *)dev->priv;
#else
struct fc_info *fi;
struct fc_info *fi = fc[count];
static int count;
int err;
if(fc[count] != NULL) {
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
if (!fi)
return -ENODEV;
fc_setup(dev);
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;
display_cache(fi);
return 0;
}
......@@ -287,9 +280,6 @@ static int __init fcdev_init(struct net_device *dev)
dev->change_mtu = iph5526_change_mtu;
dev->tx_timeout = iph5526_timeout;
dev->watchdog_timeo = 5*HZ;
#ifndef MODULE
fc_setup(dev);
#endif
return 0;
}
......@@ -4507,7 +4497,7 @@ static int scsi_registered;
int init_module(void)
{
int i = 0;
int i = 0;
driver_template.module = THIS_MODULE;
scsi_register_host(&driver_template);
......@@ -4520,43 +4510,37 @@ int i = 0;
}
while(fc[i] != NULL) {
dev_fc[i] = NULL;
dev_fc[i] = init_fcdev(dev_fc[i], 0);
if (dev_fc[i] == NULL) {
struct net_device *dev = alloc_fcdev(0);
if (!dev) {
printk("iph5526.c: init_fcdev failed for card #%d\n", i+1);
break;
}
dev_fc[i]->irq = irq;
dev_fc[i]->mem_end = bad;
dev_fc[i]->base_addr = io;
dev_fc[i]->init = iph5526_probe;
dev_fc[i]->priv = fc[i];
fc[i]->dev = dev_fc[i];
if (register_fcdev(dev_fc[i]) != 0) {
kfree(dev_fc[i]);
dev_fc[i] = NULL;
if (i == 0) {
printk("iph5526.c: IP registeration failed!!!\n");
return -ENODEV;
}
dev->priv = fc[i];
iph5526_probe_pci(dev);
err = register_netdev(dev);
if (err < 0) {
kfree(dev);
printk("iph5526.c: init_fcdev failed for card #%d\n", i+1);
break;
}
dev_fc[i] = dev;
i++;
}
if (i == 0)
return -ENODEV;
return 0;
}
void cleanup_module(void)
{
int i = 0;
int i = 0;
while(fc[i] != NULL) {
struct net_device *dev = fc[i]->dev;
void *priv = dev->priv;
struct net_device *dev = fc[i]->dev;
void *priv = dev->priv;
fc[i]->g.dont_init = TRUE;
take_tachyon_offline(fc[i]);
unregister_fcdev(dev);
unregister_netdev(dev);
clean_up_memory(fc[i]);
if (dev->priv)
kfree(priv);
......
......@@ -178,17 +178,6 @@ static struct net_device *init_netdev(struct net_device *dev, int sizeof_priv,
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
* @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)
#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
* @sizeof_priv: Size of additional driver-private structure to be allocated
......@@ -290,7 +257,6 @@ struct net_device *alloc_fddidev(int sizeof_priv)
return alloc_netdev(sizeof_priv, "fddi%d", fddi_setup);
}
EXPORT_SYMBOL(init_fddidev);
EXPORT_SYMBOL(alloc_fddidev);
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)
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;
}
/**
* 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)
static void hippi_setup(struct net_device *dev)
{
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)
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(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 */
......@@ -455,41 +417,6 @@ EXPORT_SYMBOL(fddi_setup);
#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)
static int ltalk_change_mtu(struct net_device *dev, int mtu)
......@@ -597,28 +524,6 @@ void tr_setup(struct net_device *dev)
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
* @sizeof_priv: Size of additional driver-private structure to be allocated
......@@ -636,25 +541,11 @@ struct net_device *alloc_trdev(int sizeof_priv)
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(init_trdev);
EXPORT_SYMBOL(alloc_trdev);
EXPORT_SYMBOL(register_trdev);
EXPORT_SYMBOL(unregister_trdev);
#endif /* CONFIG_TR */
#ifdef CONFIG_NET_FC
void fc_setup(struct net_device *dev)
......@@ -674,28 +565,6 @@ void fc_setup(struct net_device *dev)
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
* @sizeof_priv: Size of additional driver-private structure to be allocated
......@@ -713,21 +582,8 @@ struct net_device *alloc_fcdev(int sizeof_priv)
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(init_fcdev);
EXPORT_SYMBOL(alloc_fcdev);
EXPORT_SYMBOL(register_fcdev);
EXPORT_SYMBOL(unregister_fcdev);
#endif /* CONFIG_NET_FC */
......@@ -208,10 +208,13 @@ static dev_link_t *ibmtr_attach(void)
flush_stale_links();
/* Create new token-ring device */
info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info) return NULL;
memset(info, 0, sizeof(*info));
link = &info->link; link->priv = info;
dev = alloc_trdev(sizeof(*info));
if (!dev)
return NULL;
info = dev->priv;
link = &info->link;
link->priv = info;
init_timer(&link->release);
link->release.function = &ibmtr_release;
......@@ -232,12 +235,6 @@ static dev_link_t *ibmtr_attach(void)
link->conf.IntType = INT_MEMORY_AND_IO;
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;
dev->init = &ibmtr_probe;
......@@ -258,11 +255,16 @@ static dev_link_t *ibmtr_attach(void)
ret = CardServices(RegisterClient, &link->handle, &client_reg);
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
ibmtr_detach(link);
return NULL;
goto out_detach;
}
out:
return link;
out_detach:
ibmtr_detach(link);
link = NULL;
goto out;
} /* ibmtr_attach */
/*======================================================================
......@@ -307,12 +309,8 @@ static void ibmtr_detach(dev_link_t *link)
/* Unlink device structure, free bits */
*linkp = link->next;
if (info->dev) {
unregister_trdev(info->dev);
kfree(info->dev);
}
kfree(info);
unregister_netdev(dev);
kfree(dev);
} /* ibmtr_detach */
/*======================================================================
......@@ -413,10 +411,10 @@ static void ibmtr_config(dev_link_t *link)
Adapters Technical Reference" SC30-3585 for this info. */
ibmtr_hw_setup(dev, mmiobase);
i = register_trdev(dev);
i = register_netdev(dev);
if (i != 0) {
printk(KERN_NOTICE "ibmtr_cs: register_trdev() failed\n");
printk(KERN_NOTICE "ibmtr_cs: register_netdev() failed\n");
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,
struct rr_private *rrpriv;
void *tmpptr;
dma_addr_t ring_dma;
int ret;
int ret = -ENOMEM;
dev = init_hippi_dev(NULL, sizeof(struct rr_private));
if (!dev) {
ret = -ENOMEM;
goto out2;
}
dev = alloc_hippi_dev(sizeof(struct rr_private));
if (!dev)
goto out3;
ret = pci_enable_device(pdev);
if (ret) {
......@@ -210,6 +208,10 @@ static int __devinit rr_init_one(struct pci_dev *pdev,
rr_init(dev);
dev->base_addr = 0;
ret = register_netdev(dev);
if (ret)
goto out;
return 0;
out:
......@@ -225,12 +227,9 @@ static int __devinit rr_init_one(struct pci_dev *pdev,
pci_release_regions(pdev);
pci_set_drvdata(pdev, NULL);
}
out2:
if (dev) {
unregister_hipdev(dev);
kfree(dev);
}
kfree(dev);
out3:
return ret;
}
......@@ -252,7 +251,7 @@ static void __devexit rr_remove_one (struct pci_dev *pdev)
rr->rx_ring_dma);
pci_free_consistent(pdev, TX_TOTAL_SIZE, rr->tx_ring,
rr->tx_ring_dma);
unregister_hipdev(dev);
unregister_netdev(dev);
iounmap(rr->regs);
kfree(dev);
pci_release_regions(pdev);
......
......@@ -1129,7 +1129,7 @@ static irqreturn_t xl_interrupt(int irq, void *dev_id, struct pt_regs *regs)
netif_stop_queue(dev) ;
xl_freemem(dev) ;
free_irq(dev->irq,dev);
unregister_trdev(dev) ;
unregister_netdev(dev) ;
kfree(dev) ;
xl_reset(dev) ;
writel(ACK_INTERRUPT | LATCH_ACK, xl_mmio + MMIO_COMMAND) ;
......@@ -1783,7 +1783,7 @@ static void __devexit xl_remove_one (struct pci_dev *pdev)
struct net_device *dev = pci_get_drvdata(pdev);
struct xl_private *xl_priv=(struct xl_private *)dev->priv;
unregister_trdev(dev);
unregister_netdev(dev);
iounmap(xl_priv->xl_mmio) ;
pci_release_regions(pdev) ;
pci_set_drvdata(pdev,NULL) ;
......
......@@ -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. */
dev = init_trdev(NULL, 0);
dev = alloc_trdev(0);
if (!dev)
return -ENOMEM;
SET_MODULE_OWNER(dev);
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
dev->open = abyss_open;
dev->stop = abyss_close;
ret = register_trdev(dev);
pci_set_drvdata(pdev, dev);
ret = register_netdev(dev);
if (ret)
goto err_out_tmsdev;
pci_set_drvdata(pdev, dev);
return 0;
err_out_tmsdev:
pci_set_drvdata(pdev, NULL);
tmsdev_term(dev);
err_out_irq:
free_irq(pdev->irq, dev);
err_out_region:
release_region(pci_ioaddr, ABYSS_IO_EXTENT);
err_out_trdev:
unregister_netdev(dev);
kfree(dev);
return ret;
}
......
......@@ -110,7 +110,6 @@ in the event that chatty debug messages are desired - jjs 12/30/98 */
#include <linux/module.h>
#ifdef PCMCIA
#undef MODULE
#undef ENABLE_PAGING
#else
#define ENABLE_PAGING 1
......@@ -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;
void * t_mmio = 0;
struct tok_info *ti = 0;
struct tok_info *ti = dev->priv;
void *cd_chanid;
unsigned char *tchanid, ctemp;
#ifndef PCMCIA
......@@ -361,14 +360,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
static int version_printed;
#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
* indication of where MMIO was placed. We also have a
* coded interrupt number.
......@@ -404,7 +395,6 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
*/
#ifdef PCMCIA
iounmap(t_mmio);
ti = dev->priv; /*BMS moved up here */
t_mmio = (void *)ti->mmio; /*BMS to get virtual address */
irq = ti->irq; /*BMS to display the irq! */
#endif
......@@ -454,30 +444,20 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
DPRINTK("Expected for MCA: ");
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
waste the memory, just use the existing structure */
#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;
dev->priv = ti; /* this seems like the logical use of the
field ... let's try some empirical tests
using the token-info structure -- that
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;
for (i = 0; i < IBMTR_MAX_ADAPTERS; i++) {
if (turbo_io[i] != PIOaddr)
continue;
#if IBMTR_DEBUG_MESSAGES
printk("ibmtr::tr_probe1, setting PIOaddr %x to Turbo\n" ,
PIOaddr);
printk("ibmtr::tr_probe1, setting PIOaddr %x to Turbo\n",
PIOaddr);
#endif
ti->turbo=1;
t_irq=turbo_irq[i];
ti->turbo = 1;
t_irq = turbo_irq[i];
}
#endif /* !PCMCIA */
ti->readlog_pending = 0;
......@@ -826,11 +806,6 @@ static int __devinit trdev_init(struct net_device *dev)
dev->set_multicast_list = tok_set_multicast_list;
dev->change_mtu = ibmtr_change_mtu;
#ifndef MODULE
#ifndef PCMCIA
tr_setup(dev);
#endif
#endif
return 0;
}
......@@ -1948,21 +1923,21 @@ int init_module(void)
int count=0;
find_turbo_adapters(io);
for (i = 0; io[i] && (i < IBMTR_MAX_ADAPTERS); i++) {
irq[i] = 0;
mem[i] = 0;
dev_ibmtr[i] = NULL;
dev_ibmtr[i] = init_trdev(dev_ibmtr[i], 0);
dev_ibmtr[i] = alloc_trdev(sizeof(struct tok_info));
if (dev_ibmtr[i] == NULL) {
if (i==0)
if (i == 0)
return -ENOMEM;
break ;
break;
}
dev_ibmtr[i]->base_addr = io[i];
dev_ibmtr[i]->irq = irq[i];
dev_ibmtr[i]->mem_start = mem[i];
dev_ibmtr[i]->init = &ibmtr_probe;
if (register_trdev(dev_ibmtr[i]) != 0) {
if (register_netdev(dev_ibmtr[i]) != 0) {
kfree(dev_ibmtr[i]);
dev_ibmtr[i] = NULL;
continue;
......@@ -1970,7 +1945,7 @@ int init_module(void)
count++;
}
if (count) return 0;
printk("ibmtr: register_trdev() returned non-zero.\n");
printk("ibmtr: register_netdev() returned non-zero.\n");
return -EIO;
} /*init_module */
......@@ -1979,24 +1954,25 @@ void cleanup_module(void)
int i,j;
for (i = 0; i < IBMTR_MAX_ADAPTERS; i++){
if(!dev_ibmtr[i]) continue;
if (!dev_ibmtr[i])
continue;
if (dev_ibmtr[i]->base_addr) {
outb(0,dev_ibmtr[i]->base_addr+ADAPTRESET);
for(j=jiffies+TR_RST_TIME;
time_before_eq(jiffies,j);) ;
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]);
release_region(dev_ibmtr[i]->base_addr, IBMTR_IO_EXTENT);
#ifndef PCMCIA
{
struct tok_info *ti = (struct tok_info *)dev_ibmtr[i]->priv ;
iounmap((u32 *)ti->mmio) ;
iounmap((u32 *)ti->sram_virt) ;
struct tok_info *ti = (struct tok_info *)
dev_ibmtr[i]->priv;
iounmap((u32 *)ti->mmio);
iounmap((u32 *)ti->sram_virt);
}
#endif
kfree(dev_ibmtr[i]->priv);
kfree(dev_ibmtr[i]);
dev_ibmtr[i] = NULL;
}
......
This diff is collapsed.
......@@ -177,12 +177,14 @@ static int __init madgemc_probe(void)
if (versionprinted++ == 0)
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");
if (madgemc_card_list)
return 0;
return -1;
}
SET_MODULE_OWNER(dev);
dev->dma = 0;
......@@ -195,7 +197,7 @@ static int __init madgemc_probe(void)
card = kmalloc(sizeof(struct madgemc_card), GFP_KERNEL);
if (card==NULL) {
printk("madgemc: unable to allocate card struct\n");
kfree(dev); /* release_trdev? */
kfree(dev);
if (madgemc_card_list)
return 0;
return -1;
......@@ -331,7 +333,7 @@ static int __init madgemc_probe(void)
*/
outb(0, dev->base_addr + MC_CONTROL_REG0); /* sanity */
madgemc_setsifsel(dev, 1);
if(request_irq(dev->irq, madgemc_interrupt, SA_SHIRQ,
if (request_irq(dev->irq, madgemc_interrupt, SA_SHIRQ,
"madgemc", dev))
goto getout;
......@@ -382,33 +384,22 @@ static int __init madgemc_probe(void)
dev->open = madgemc_open;
dev->stop = madgemc_close;
if (register_trdev(dev) == 0) {
if (register_netdev(dev) == 0) {
/* Enlist in the card list */
card->next = madgemc_card_list;
madgemc_card_list = card;
} else {
printk("madgemc: register_trdev() returned non-zero.\n");
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 */
}
slot++;
continue; /* successful, try to find another */
free_irq(dev->irq, dev);
getout:
release_region(dev->base_addr-MADGEMC_SIF_OFFSET,
MADGEMC_IO_EXTENT);
getout1:
kfree(card);
kfree(dev); /* release_trdev? */
kfree(dev);
slot++;
}
......@@ -779,7 +770,7 @@ static void __exit madgemc_exit(void)
while (madgemc_card_list) {
dev = madgemc_card_list->dev;
unregister_trdev(dev);
unregister_netdev(dev);
release_region(dev->base_addr-MADGEMC_SIF_OFFSET, MADGEMC_IO_EXTENT);
free_irq(dev->irq, dev);
tmsdev_term(dev);
......
......@@ -1773,7 +1773,7 @@ static void __devexit olympic_remove_one(struct pci_dev *pdev)
strcat(proc_name,dev->name) ;
remove_proc_entry(proc_name,NULL);
}
unregister_trdev(dev) ;
unregister_netdev(dev) ;
iounmap(olympic_priv->olympic_mmio) ;
iounmap(olympic_priv->olympic_lap) ;
pci_release_regions(pdev) ;
......
......@@ -121,6 +121,11 @@ int __init proteon_probe(struct net_device *dev)
int i,j;
struct proteon_card *card;
#ifndef MODULE
netdev_boot_setup_check(dev);
tr_setup(dev);
#endif
SET_MODULE_OWNER(dev);
if (!dev->base_addr)
{
......@@ -158,20 +163,8 @@ int __init proteon_probe(struct net_device *dev)
if (versionprinted++ == 0)
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))
{
release_region(dev->base_addr, PROTEON_IO_EXTENT);
return -1;
}
goto out4;
dev->base_addr &= ~3;
......@@ -211,9 +204,7 @@ int __init proteon_probe(struct net_device *dev)
if(irqlist[j] == 0)
{
printk(KERN_INFO "%s: AutoSelect no IRQ available\n", dev->name);
release_region(dev->base_addr, PROTEON_IO_EXTENT);
tmsdev_term(dev);
return -1;
goto out3;
}
}
else
......@@ -225,18 +216,14 @@ int __init proteon_probe(struct net_device *dev)
{
printk(KERN_INFO "%s: Illegal IRQ %d specified\n",
dev->name, dev->irq);
release_region(dev->base_addr, PROTEON_IO_EXTENT);
tmsdev_term(dev);
return -1;
goto out3;
}
if (request_irq(dev->irq, tms380tr_interrupt, 0,
cardname, dev))
{
printk(KERN_INFO "%s: Selected IRQ %d not available\n",
dev->name, dev->irq);
release_region(dev->base_addr, PROTEON_IO_EXTENT);
tmsdev_term(dev);
return -1;
goto out3;
}
}
......@@ -252,10 +239,7 @@ int __init proteon_probe(struct net_device *dev)
if(dmalist[j] == 0)
{
printk(KERN_INFO "%s: AutoSelect no DMA available\n", dev->name);
release_region(dev->base_addr, PROTEON_IO_EXTENT);
free_irq(dev->irq, dev);
tmsdev_term(dev);
return -1;
goto out2;
}
}
else
......@@ -267,52 +251,36 @@ int __init proteon_probe(struct net_device *dev)
{
printk(KERN_INFO "%s: Illegal DMA %d specified\n",
dev->name, dev->dma);
release_region(dev->base_addr, PROTEON_IO_EXTENT);
free_irq(dev->irq, dev);
tmsdev_term(dev);
return -1;
goto out2;
}
if (request_dma(dev->dma, cardname))
{
printk(KERN_INFO "%s: Selected DMA %d not available\n",
dev->name, dev->dma);
release_region(dev->base_addr, PROTEON_IO_EXTENT);
free_irq(dev->irq, dev);
tmsdev_term(dev);
return -1;
goto out2;
}
}
printk(KERN_DEBUG "%s: IO: %#4lx IRQ: %d DMA: %d\n",
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);
if (!card) {
unregister_trdev(dev);
release_region(dev->base_addr, PROTEON_IO_EXTENT);
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;
}
/* Enlist in the card list */
card = kmalloc(sizeof(struct proteon_card), GFP_KERNEL);
if (!card)
goto out;
card->next = proteon_card_list;
proteon_card_list = card;
card->dev = dev;
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");
MODULE_PARM(irq, "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 i, num;
struct net_device *dev;
num = 0;
if (io[0])
{ /* Only probe addresses from command line */
dev = init_trdev(NULL, 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))
{
if (io[0]) { /* Only probe addresses from command line */
for (i = 0; i < ISATR_MAX_ADAPTERS ; i++) {
if (io[i] && setup_card(io[i], irq[i], dma[i]) == 0)
num++;
dev = init_trdev(NULL, 0);
if (!dev)
goto partial;
}
}
unregister_netdev(dev);
kfree(dev);
}
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))
{
} else {
for(i = 0; num < ISATR_MAX_ADAPTERS && portlist[i]; i++) {
if (setup_card(portlist[i], irq[i], dma[i]))
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);
/* Probe for cards. */
if (num == 0) {
......
......@@ -141,6 +141,11 @@ int __init sk_isa_probe(struct net_device *dev)
int i,j;
struct sk_isa_card *card;
#ifndef MODULE
netdev_boot_setup_check(dev);
tr_setup(dev);
#endif
SET_MODULE_OWNER(dev);
if (!dev->base_addr)
{
......@@ -178,20 +183,8 @@ int __init sk_isa_probe(struct net_device *dev)
if (versionprinted++ == 0)
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))
{
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
return -1;
}
goto out4;
dev->base_addr &= ~3;
......@@ -231,9 +224,7 @@ int __init sk_isa_probe(struct net_device *dev)
if(irqlist[j] == 0)
{
printk(KERN_INFO "%s: AutoSelect no IRQ available\n", dev->name);
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
tmsdev_term(dev);
return -1;
goto out3;
}
}
else
......@@ -245,18 +236,14 @@ int __init sk_isa_probe(struct net_device *dev)
{
printk(KERN_INFO "%s: Illegal IRQ %d specified\n",
dev->name, dev->irq);
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
tmsdev_term(dev);
return -1;
goto out3;
}
if (request_irq(dev->irq, tms380tr_interrupt, 0,
isa_cardname, dev))
{
printk(KERN_INFO "%s: Selected IRQ %d not available\n",
dev->name, dev->irq);
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
tmsdev_term(dev);
return -1;
goto out3;
}
}
......@@ -272,10 +259,7 @@ int __init sk_isa_probe(struct net_device *dev)
if(dmalist[j] == 0)
{
printk(KERN_INFO "%s: AutoSelect no DMA available\n", dev->name);
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
free_irq(dev->irq, dev);
tmsdev_term(dev);
return -1;
goto out2;
}
}
else
......@@ -287,52 +271,36 @@ int __init sk_isa_probe(struct net_device *dev)
{
printk(KERN_INFO "%s: Illegal DMA %d specified\n",
dev->name, dev->dma);
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
free_irq(dev->irq, dev);
tmsdev_term(dev);
return -1;
goto out2;
}
if (request_dma(dev->dma, isa_cardname))
{
printk(KERN_INFO "%s: Selected DMA %d not available\n",
dev->name, dev->dma);
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
free_irq(dev->irq, dev);
tmsdev_term(dev);
return -1;
goto out2;
}
}
printk(KERN_DEBUG "%s: IO: %#4lx IRQ: %d DMA: %d\n",
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);
if (!card) {
unregister_trdev(dev);
release_region(dev->base_addr, SK_ISA_IO_EXTENT);
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;
}
/* Enlist in the card list */
card = kmalloc(sizeof(struct sk_isa_card), GFP_KERNEL);
if (!card)
goto out;
card->next = sk_isa_card_list;
sk_isa_card_list = card;
card->dev = dev;
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");
MODULE_PARM(irq, "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 i, num;
struct net_device *dev;
num = 0;
if (io[0])
{ /* Only probe addresses from command line */
dev = init_trdev(NULL, 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))
{
if (io[0]) { /* Only probe addresses from command line */
for (i = 0; i < ISATR_MAX_ADAPTERS ; i++) {
if (io[i] && setup_card(io[i], irq[i], dma[i]) == 0)
num++;
dev = init_trdev(NULL, 0);
if (!dev)
goto partial;
}
}
unregister_netdev(dev);
kfree(dev);
}
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))
{
} else {
for(i = 0; num < ISATR_MAX_ADAPTERS && portlist[i]; i++) {
if (setup_card(portlist[i], irq[i], dma[i]))
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);
/* Probe for cards. */
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
pci_ioaddr = pci_resource_start (pdev, 0);
/* At this point we have found a valid card. */
dev = init_trdev(NULL, 0);
dev = alloc_trdev(0);
if (!dev)
return -ENOMEM;
SET_MODULE_OWNER(dev);
if (!request_region(pci_ioaddr, TMS_PCI_IO_EXTENT, dev->name)) {
ret = -EBUSY;
goto err_out_trdev;
......@@ -163,22 +163,22 @@ static int __init tms_pci_attach(struct pci_dev *pdev, const struct pci_device_i
dev->open = tms380tr_open;
dev->stop = tms380tr_close;
pci_set_drvdata(pdev, dev);
ret = register_trdev(dev);
ret = register_netdev(dev);
if (ret)
goto err_out_tmsdev;
pci_set_drvdata(pdev, dev);
return 0;
err_out_tmsdev:
pci_set_drvdata(pdev, NULL);
tmsdev_term(dev);
err_out_irq:
free_irq(pdev->irq, dev);
err_out_region:
release_region(pci_ioaddr, TMS_PCI_IO_EXTENT);
err_out_trdev:
unregister_netdev(dev);
kfree(dev);
return ret;
}
......
......@@ -1751,30 +1751,29 @@ lcs_new_device(struct ccwgroup_device *ccwgdev)
#ifdef CONFIG_NET_ETHERNET
case LCS_FRAME_TYPE_ENET:
card->lan_type_trans = eth_type_trans;
dev = init_etherdev(NULL,0);
dev = alloc_etherdev(0);
break;
#endif
#ifdef CONFIG_TR
case LCS_FRAME_TYPE_TR:
card->lan_type_trans = tr_type_trans;
dev = init_trdev(NULL,0);
dev = alloc_trdev(0);
break;
#endif
#ifdef CONFIG_FDDI
case LCS_FRAME_TYPE_FDDI:
card->lan_type_trans = fddi_type_trans;
dev = init_fddidev(NULL,0);
dev = alloc_fddidev(0);
break;
#endif
default:
LCS_DBF_TEXT(3, setup, "errinit");
PRINT_ERR("LCS: Initialization failed\n");
PRINT_ERR("LCS: No device found!\n");
lcs_cleanup_channel(&card->read);
lcs_cleanup_channel(&card->write);
lcs_free_card(card);
return -ENODEV;
goto out;
}
if (!dev)
goto out;
memcpy(dev->dev_addr, card->mac, LCS_MAC_LENGTH);
card->dev = dev;
dev->priv = card;
......@@ -1787,9 +1786,16 @@ lcs_new_device(struct ccwgroup_device *ccwgdev)
#endif
dev->get_stats = lcs_getstats;
SET_MODULE_OWNER(&tun->dev);
if (register_netdev(dev) != 0)
goto out;
netif_stop_queue(dev);
lcs_stopcard(card);
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,
extern int fc_rebuild_header(struct sk_buff *skb);
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 int register_fcdev(struct net_device *dev);
extern void unregister_fcdev(struct net_device *dev);
#endif
#endif /* _LINUX_FCDEVICE_H */
......@@ -34,7 +34,6 @@ extern int fddi_header(struct sk_buff *skb,
extern int fddi_rebuild_header(struct sk_buff *skb);
extern unsigned short fddi_type_trans(struct sk_buff *skb,
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);
#endif
......
......@@ -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 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 int register_hipdev(struct net_device *dev);
extern void unregister_hipdev(struct net_device *dev);
#endif
#endif /* _LINUX_HIPPIDEVICE_H */
......@@ -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 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 struct net_device *init_trdev(struct net_device *dev, 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
......
......@@ -861,12 +861,7 @@ static void __exit lane_module_cleanup(void)
for (i = 0; i < MAX_LEC_ITF; i++) {
if (dev_lec[i] != NULL) {
priv = (struct lec_priv *)dev_lec[i]->priv;
#if defined(CONFIG_TR)
if (priv->is_trdev)
unregister_trdev(dev_lec[i]);
else
#endif
unregister_netdev(dev_lec[i]);
unregister_netdev(dev_lec[i]);
kfree(dev_lec[i]);
dev_lec[i] = NULL;
}
......
......@@ -347,6 +347,11 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
return NULL;
}
/* One reference from device. We must do this before
* we invoke __ipv6_regen_rndid().
*/
in6_dev_hold(ndev);
#ifdef CONFIG_IPV6_PRIVACY
get_random_bytes(ndev->rndid, sizeof(ndev->rndid));
get_random_bytes(ndev->entropy, sizeof(ndev->entropy));
......@@ -367,8 +372,6 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
write_lock_bh(&addrconf_lock);
dev->ip6_ptr = ndev;
/* One reference from device */
in6_dev_hold(ndev);
write_unlock_bh(&addrconf_lock);
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