Commit 155f364c authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/davem/net-2.5

into home.osdl.org:/home/torvalds/v2.5/linux
parents f7d85523 a587017c
......@@ -15,7 +15,6 @@
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <asm/scatterlist.h>
......
This diff is collapsed.
......@@ -604,7 +604,7 @@ static int __init el3_probe(int card_idx)
pnp_device_detach(idev);
#endif
out:
kfree(dev);
free_netdev(dev);
return err;
}
......
......@@ -1468,7 +1468,7 @@ static int __devinit vortex_probe1(struct device *gendev,
free_region:
if (vp->must_free_region)
release_region(ioaddr, vci->io_size);
kfree (dev);
free_netdev(dev);
printk(KERN_ERR PFX "vortex_probe1 fails. Returns %d\n", retval);
out:
return retval;
......
......@@ -1768,7 +1768,7 @@ static int cp_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_disable:
pci_disable_device(pdev);
err_out_free:
kfree(dev);
free_netdev(dev);
return rc;
}
......
......@@ -32,14 +32,13 @@
*/
#include <linux/config.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/trdevice.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/netlink.h>
#include <linux/divert.h>
#define NEXT_DEV NULL
/* A unified ethernet device probe. This is the easiest way to have every
ethernet adaptor have the name "eth[0123...]".
*/
......@@ -98,6 +97,15 @@ extern int macsonic_probe(struct net_device *dev);
extern int mac8390_probe(struct net_device *dev);
extern int mac89x0_probe(struct net_device *dev);
extern int mc32_probe(struct net_device *dev);
#ifdef CONFIG_SDLA
extern struct net_device *sdla_init(void);
#endif
#ifdef CONFIG_COPS
extern struct net_device *cops_probe(int unit);
#endif
#ifdef CONFIG_LTPC
extern struct net_device *ltpc_probe(void);
#endif
/* Detachable devices ("pocket adaptors") */
extern int de620_probe(struct net_device *);
......@@ -106,7 +114,7 @@ extern int de620_probe(struct net_device *);
extern int iph5526_probe(struct net_device *dev);
/* SBNI adapters */
extern int sbni_probe(struct net_device *);
extern int sbni_probe(void);
struct devprobe
{
......@@ -352,124 +360,43 @@ static struct devprobe mips_probes[] __initdata = {
* per bus interface. This drives the legacy devices only for now.
*/
static int __init ethif_probe(struct net_device *dev)
static int __init ethif_probe(void)
{
unsigned long base_addr = dev->base_addr;
struct net_device *dev;
int err = -ENODEV;
dev = alloc_etherdev(0);
if (!dev)
return -ENOMEM;
netdev_boot_setup_check(dev);
/*
* Backwards compatibility - historically an I/O base of 1 was
* used to indicate not to probe for this ethN interface
*/
if (base_addr == 1)
return 1; /* ENXIO */
if (dev->base_addr == 1) {
free_netdev(dev);
return -ENXIO;
}
/*
* The arch specific probes are 1st so that any on-board ethernet
* will be probed before other ISA/EISA/MCA/PCI bus cards.
*/
if (probe_list(dev, m68k_probes) == 0)
return 0;
if (probe_list(dev, mips_probes) == 0)
return 0;
if (probe_list(dev, eisa_probes) == 0)
return 0;
if (probe_list(dev, mca_probes) == 0)
return 0;
if (probe_list(dev, isa_probes) == 0)
return 0;
if (probe_list(dev, parport_probes) == 0)
return 0;
return -ENODEV;
}
#ifdef CONFIG_SDLA
extern int sdla_init(struct net_device *);
static struct net_device sdla0_dev = {
.name = "sdla0",
.next = NEXT_DEV,
.init = sdla_init,
};
#undef NEXT_DEV
#define NEXT_DEV (&sdla0_dev)
#endif
#if defined(CONFIG_LTPC)
extern int ltpc_probe(struct net_device *);
static struct net_device dev_ltpc = {
.name = "lt0",
.next = NEXT_DEV,
.init = ltpc_probe
};
#undef NEXT_DEV
#define NEXT_DEV (&dev_ltpc)
#endif /* LTPC */
#if defined(CONFIG_COPS)
extern int cops_probe(struct net_device *);
static struct net_device cops2_dev = {
.name = "lt2",
.next = NEXT_DEV,
.init = cops_probe,
};
static struct net_device cops1_dev = {
.name = "lt1",
.next = &cops2_dev,
.init = cops_probe,
};
static struct net_device cops0_dev = {
.name = "lt0",
.next = &cops1_dev,
.init = cops_probe,
};
#undef NEXT_DEV
#define NEXT_DEV (&cops0_dev)
#endif /* COPS */
static struct net_device eth7_dev = {
.name = "eth%d",
.next = NEXT_DEV,
.init = ethif_probe,
};
static struct net_device eth6_dev = {
.name = "eth%d",
.next = &eth7_dev,
.init = ethif_probe,
};
static struct net_device eth5_dev = {
.name = "eth%d",
.next = &eth6_dev,
.init = ethif_probe,
};
static struct net_device eth4_dev = {
.name = "eth%d",
.next = &eth5_dev,
.init = ethif_probe,
};
static struct net_device eth3_dev = {
.name = "eth%d",
.next = &eth4_dev,
.init = ethif_probe,
};
static struct net_device eth2_dev = {
.name = "eth%d",
.next = &eth3_dev,
.init = ethif_probe,
};
static struct net_device eth1_dev = {
.name = "eth%d",
.next = &eth2_dev,
.init = ethif_probe,
};
static struct net_device eth0_dev = {
.name = "eth%d",
.next = &eth1_dev,
.init = ethif_probe,
};
#undef NEXT_DEV
#define NEXT_DEV (&eth0_dev)
if (probe_list(dev, m68k_probes) == 0 ||
probe_list(dev, mips_probes) == 0 ||
probe_list(dev, eisa_probes) == 0 ||
probe_list(dev, mca_probes) == 0 ||
probe_list(dev, isa_probes) == 0 ||
probe_list(dev, parport_probes) == 0)
err = register_netdev(dev);
if (err)
free_netdev(dev);
return err;
}
#ifdef CONFIG_TR
/* Token-ring device probe */
......@@ -478,129 +405,82 @@ extern int sk_isa_probe(struct net_device *);
extern int proteon_probe(struct net_device *);
extern int smctr_probe(struct net_device *);
static int
trif_probe(struct net_device *dev)
static __init int trif_probe(void)
{
if (1
struct net_device *dev;
int err = -ENODEV;
dev = alloc_trdev(0);
if (!dev)
return -ENOMEM;
netdev_boot_setup_check(dev);
if (
#ifdef CONFIG_IBMTR
&& ibmtr_probe(dev)
ibmtr_probe(dev) == 0 ||
#endif
#ifdef CONFIG_SKISA
&& sk_isa_probe(dev)
sk_isa_probe(dev) == 0 ||
#endif
#ifdef CONFIG_PROTEON
&& proteon_probe(dev)
proteon_probe(dev) == 0 ||
#endif
#ifdef CONFIG_SMCTR
&& smctr_probe(dev)
smctr_probe(dev) == 0 ||
#endif
&& 1 ) {
return 1; /* -ENODEV or -EAGAIN would be more accurate. */
}
return 0;
}
static struct net_device tr7_dev = {
.name = "tr%d",
.next = NEXT_DEV,
.init = trif_probe,
};
static struct net_device tr6_dev = {
.name = "tr%d",
.next = &tr7_dev,
.init = trif_probe,
};
static struct net_device tr5_dev = {
.name = "tr%d",
.next = &tr6_dev,
.init = trif_probe,
};
static struct net_device tr4_dev = {
.name = "tr%d",
.next = &tr5_dev,
.init = trif_probe,
};
static struct net_device tr3_dev = {
.name = "tr%d",
.next = &tr4_dev,
.init = trif_probe,
};
static struct net_device tr2_dev = {
.name = "tr%d",
.next = &tr3_dev,
.init = trif_probe,
};
static struct net_device tr1_dev = {
.name = "tr%d",
.next = &tr2_dev,
.init = trif_probe,
};
static struct net_device tr0_dev = {
.name = "tr%d",
.next = &tr1_dev,
.init = trif_probe,
};
#undef NEXT_DEV
#define NEXT_DEV (&tr0_dev)
0 )
err = register_netdev(dev);
if (err)
free_netdev(dev);
return err;
#endif
#ifdef CONFIG_SBNI
static struct net_device sbni7_dev = {
.name = "sbni7",
.next = NEXT_DEV,
.init = sbni_probe,
};
static struct net_device sbni6_dev = {
.name = "sbni6",
.next = &sbni7_dev,
.init = sbni_probe,
};
static struct net_device sbni5_dev = {
.name = "sbni5",
.next = &sbni6_dev,
.init = sbni_probe,
};
static struct net_device sbni4_dev = {
.name = "sbni4",
.next = &sbni5_dev,
.init = sbni_probe,
};
static struct net_device sbni3_dev = {
.name = "sbni3",
.next = &sbni4_dev,
.init = sbni_probe,
};
static struct net_device sbni2_dev = {
.name = "sbni2",
.next = &sbni3_dev,
.init = sbni_probe,
};
static struct net_device sbni1_dev = {
.name = "sbni1",
.next = &sbni2_dev,
.init = sbni_probe,
};
static struct net_device sbni0_dev = {
.name = "sbni0",
.next = &sbni1_dev,
.init = sbni_probe,
};
}
#endif
#undef NEXT_DEV
#define NEXT_DEV (&sbni0_dev)
#endif
/*
* The loopback device is global so it can be directly referenced
* by the network code. Also, it must be first on device list.
*/
extern int loopback_init(void);
extern int loopback_init(struct net_device *dev);
struct net_device loopback_dev = {
.name = "lo",
.next = NEXT_DEV,
.init = loopback_init
};
/* Statically configured drivers -- order matters here. */
void __init probe_old_netdevs(void)
{
int num;
if (loopback_init()) {
printk(KERN_ERR "Network loopback device setup failed\n");
}
#ifdef CONFIG_SBNI
for (num = 0; num < 8; ++num)
if (sbni_probe())
break;
#endif
#ifdef CONFIG_TR
for (num = 0; num < 8; ++num)
if (trif_probe())
break;
#endif
for (num = 0; num < 8; ++num)
if (ethif_probe())
break;
#ifdef CONFIG_COPS
cops_probe(0);
cops_probe(1);
cops_probe(2);
#endif
#ifdef CONFIG_LTPC
ltpc_probe();
#endif
#ifdef CONFIG_SDLA
sdla_init();
#endif
}
/*
* The @dev_base list is protected by @dev_base_lock and the rtln
......@@ -621,6 +501,6 @@ struct net_device loopback_dev = {
* unregister_netdevice(), which must be called with the rtnl
* semaphore held.
*/
struct net_device *dev_base = &loopback_dev;
struct net_device *dev_base;
rwlock_t dev_base_lock = RW_LOCK_UNLOCKED;
......@@ -685,7 +685,7 @@ int __devinit acenic_probe (ACE_PROBE_ARG)
}
if (pci_enable_device(pdev)) {
kfree(dev);
free_netdev(dev);
continue;
}
......@@ -733,7 +733,7 @@ int __devinit acenic_probe (ACE_PROBE_ARG)
if (register_netdev(dev)) {
printk(KERN_ERR "acenic: device registration failed\n");
kfree(dev);
free_netdev(dev);
continue;
}
......@@ -793,7 +793,7 @@ int __devinit acenic_probe (ACE_PROBE_ARG)
printk(KERN_ERR "%s: Driver compiled without Tigon I"
" support - NIC disabled\n", dev->name);
ace_init_cleanup(dev);
kfree(dev);
free_netdev(dev);
continue;
}
#endif
......@@ -803,7 +803,7 @@ int __devinit acenic_probe (ACE_PROBE_ARG)
* ace_allocate_descriptors() calls
* ace_init_cleanup() on error.
*/
kfree(dev);
free_netdev(dev);
continue;
}
......@@ -820,7 +820,7 @@ int __devinit acenic_probe (ACE_PROBE_ARG)
/*
* ace_init() calls ace_init_cleanup() on error.
*/
kfree(dev);
free_netdev(dev);
continue;
}
......
......@@ -1927,7 +1927,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
iounmap((void *) lp->mmio);
err_free_dev:
kfree(dev);
free_netdev(dev);
err_free_reg:
pci_release_regions(pdev);
......
......@@ -92,12 +92,8 @@ static int board_type = DAYNA; /* Module exported */
static int board_type = TANGENT;
#endif
#ifdef MODULE
static int io = 0x240; /* Default IO for Dayna */
static int irq = 5; /* Default IRQ */
#else
static int io; /* Default IO for Dayna */
#endif
/*
* COPS Autoprobe information.
......@@ -146,7 +142,7 @@ static int io; /* Default IO for Dayna */
* Zero terminated list of IO ports to probe.
*/
static unsigned int cops_portlist[] = {
static unsigned int ports[] = {
0x240, 0x340, 0x200, 0x210, 0x220, 0x230, 0x260,
0x2A0, 0x300, 0x310, 0x320, 0x330, 0x350, 0x360,
0
......@@ -184,7 +180,6 @@ struct cops_local
};
/* Index to functions, as function prototypes. */
extern int cops_probe (struct net_device *dev);
static int cops_probe1 (struct net_device *dev, int ioaddr);
static int cops_irq (int ioaddr, int board);
......@@ -208,6 +203,12 @@ static int cops_ioctl (struct net_device *dev, struct ifreq *rq, int cmd);
static int cops_close (struct net_device *dev);
static struct net_device_stats *cops_get_stats (struct net_device *dev);
static void cleanup_card(struct net_device *dev)
{
if (dev->irq)
free_irq(dev->irq, dev);
release_region(dev->base_addr, COPS_IO_EXTENT);
}
/*
* Check for a network adaptor of this type, and return '0' iff one exists.
......@@ -215,31 +216,54 @@ static struct net_device_stats *cops_get_stats (struct net_device *dev);
* If dev->base_addr in [1..0x1ff], always return failure.
* otherwise go with what we pass in.
*/
int __init cops_probe(struct net_device *dev)
struct net_device * __init cops_probe(int unit)
{
int i;
int base_addr = dev->base_addr;
struct net_device *dev;
unsigned *port;
int base_addr;
int err = 0;
dev = alloc_netdev(sizeof(struct cops_local), "lt%d", ltalk_setup);
if (!dev)
return ERR_PTR(-ENOMEM);
if (unit >= 0) {
sprintf(dev->name, "lt%d", unit);
netdev_boot_setup_check(dev);
irq = dev->irq;
base_addr = dev->base_addr;
} else {
base_addr = dev->base_addr = io;
}
SET_MODULE_OWNER(dev);
if(base_addr == 0 && io)
base_addr=io;
if(base_addr > 0x1ff) /* Check a single specified location. */
return cops_probe1(dev, base_addr);
else if(base_addr != 0) /* Don't probe at all. */
return -ENXIO;
/* FIXME Does this really work for cards which generate irq?
* It's definitely N.G. for polled Tangent. sh
* Dayna cards don't autoprobe well at all, but if your card is
* at IRQ 5 & IO 0x240 we find it every time. ;) JS
*/
for(i=0; cops_portlist[i]; i++)
if(cops_probe1(dev, cops_portlist[i]) == 0)
return 0;
return -ENODEV;
if (base_addr > 0x1ff) { /* Check a single specified location. */
err = cops_probe1(dev, base_addr);
} else if (base_addr != 0) { /* Don't probe at all. */
err = -ENXIO;
} else {
/* FIXME Does this really work for cards which generate irq?
* It's definitely N.G. for polled Tangent. sh
* Dayna cards don't autoprobe well at all, but if your card is
* at IRQ 5 & IO 0x240 we find it every time. ;) JS
*/
for (port = ports; *port && cops_probe1(dev, *port) < 0; port++)
;
if (!*port)
err = -ENODEV;
}
if (err)
goto out;
err = register_netdev(dev);
if (err)
goto out1;
return dev;
out1:
cleanup_card(dev);
out:
kfree(dev);
return ERR_PTR(err);
}
/*
......@@ -268,16 +292,15 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
* interrupts are typically not reported by the boards, and we must
* used AutoIRQ to find them.
*/
dev->irq = irq;
switch (dev->irq)
{
case 0:
/* COPS AutoIRQ routine */
dev->irq = cops_irq(ioaddr, board);
if(!dev->irq) {
retval = -EINVAL; /* No IRQ found on this port */
goto err_out;
}
if (dev->irq)
break;
/* No IRQ found on this port, fallthrough */
case 1:
retval = -EINVAL;
goto err_out;
......@@ -302,22 +325,13 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
}
/* Reserve any actual interrupt. */
if(dev->irq) {
if (dev->irq) {
retval = request_irq(dev->irq, &cops_interrupt, 0, dev->name, dev);
if (retval)
goto err_out;
}
dev->base_addr = ioaddr;
/* Initialize the private device structure. */
dev->priv = kmalloc(sizeof(struct cops_local), GFP_KERNEL);
if(dev->priv == NULL) {
if (dev->irq)
free_irq(dev->irq, dev);
retval = -ENOMEM;
goto err_out;
}
dev->base_addr = ioaddr;
lp = (struct cops_local *)dev->priv;
memset(lp, 0, sizeof(struct cops_local));
......@@ -326,9 +340,6 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
/* Copy local board variable to lp struct. */
lp->board = board;
/* Fill in the fields of the device structure with LocalTalk values. */
ltalk_setup(dev);
dev->hard_start_xmit = cops_send_packet;
dev->tx_timeout = cops_timeout;
dev->watchdog_timeo = HZ * 2;
......@@ -1013,7 +1024,7 @@ static struct net_device_stats *cops_get_stats(struct net_device *dev)
}
#ifdef MODULE
static struct net_device cops0_dev = { .init = cops_probe };
static struct net_device *cops_dev;
MODULE_LICENSE("GPL");
MODULE_PARM(io, "i");
......@@ -1022,33 +1033,20 @@ MODULE_PARM(board_type, "i");
int init_module(void)
{
int result, err;
if(io == 0)
if (io == 0)
printk(KERN_WARNING "%s: You shouldn't autoprobe with insmod\n",
cardname);
/* Copy the parameters from insmod into the device structure. */
cops0_dev.base_addr = io;
cops0_dev.irq = irq;
err=dev_alloc_name(&cops0_dev, "lt%d");
if(err < 0)
return err;
if((result = register_netdev(&cops0_dev)) != 0)
return result;
cops_dev = cops_probe(-1);
if (IS_ERR(cops_dev))
return PTR_ERR(cops_dev);
return 0;
}
void cleanup_module(void)
{
unregister_netdev(&cops0_dev);
kfree(cops0_dev.priv);
if(cops0_dev.irq)
free_irq(cops0_dev.irq, &cops0_dev);
release_region(cops0_dev.base_addr, COPS_IO_EXTENT);
unregister_netdev(cops_dev);
cleanup_card(cops_dev);
free_netdev(cops_dev);
}
#endif /* MODULE */
......
......@@ -879,34 +879,6 @@ static int ltpc_hard_header (struct sk_buff *skb, struct net_device *dev,
return 0;
}
static int ltpc_init(struct net_device *dev)
{
/* Initialize the device structure. */
/* Fill in the fields of the device structure with ethernet-generic values. */
ltalk_setup(dev);
dev->hard_start_xmit = ltpc_xmit;
dev->hard_header = ltpc_hard_header;
dev->priv = kmalloc(sizeof(struct ltpc_private), GFP_KERNEL);
if(!dev->priv)
{
printk(KERN_INFO "%s: could not allocate statistics buffer\n", dev->name);
return -ENOMEM;
}
memset(dev->priv, 0, sizeof(struct ltpc_private));
dev->get_stats = ltpc_get_stats;
/* add the ltpc-specific things */
dev->do_ioctl = &ltpc_ioctl;
dev->set_multicast_list = &set_multicast_list;
dev->mc_list = NULL;
return 0;
}
static int ltpc_poll_counter;
static void ltpc_poll(unsigned long l)
......@@ -983,35 +955,40 @@ static struct net_device_stats *ltpc_get_stats(struct net_device *dev)
/* initialization stuff */
static int __init ltpc_probe_dma(int base)
static int __init ltpc_probe_dma(int base, int dma)
{
int dma = 0;
int want = (dma == 3) ? 2 : (dma == 1) ? 1 : 3;
unsigned long timeout;
unsigned long f;
if (!request_dma(1,"ltpc")) {
f=claim_dma_lock();
disable_dma(1);
clear_dma_ff(1);
set_dma_mode(1,DMA_MODE_WRITE);
set_dma_addr(1,virt_to_bus(ltdmabuf));
set_dma_count(1,sizeof(struct lt_mem));
enable_dma(1);
release_dma_lock(f);
dma|=1;
if (want & 1) {
if (request_dma(1,"ltpc")) {
want &= ~1;
} else {
f=claim_dma_lock();
disable_dma(1);
clear_dma_ff(1);
set_dma_mode(1,DMA_MODE_WRITE);
set_dma_addr(1,virt_to_bus(ltdmabuf));
set_dma_count(1,sizeof(struct lt_mem));
enable_dma(1);
release_dma_lock(f);
}
}
if (!request_dma(3,"ltpc")) {
f=claim_dma_lock();
disable_dma(3);
clear_dma_ff(3);
set_dma_mode(3,DMA_MODE_WRITE);
set_dma_addr(3,virt_to_bus(ltdmabuf));
set_dma_count(3,sizeof(struct lt_mem));
enable_dma(3);
release_dma_lock(f);
dma|=2;
if (want & 2) {
if (request_dma(3,"ltpc")) {
want &= ~2;
} else {
f=claim_dma_lock();
disable_dma(3);
clear_dma_ff(3);
set_dma_mode(3,DMA_MODE_WRITE);
set_dma_addr(3,virt_to_bus(ltdmabuf));
set_dma_count(3,sizeof(struct lt_mem));
enable_dma(3);
release_dma_lock(f);
}
}
/* set up request */
/* FIXME -- do timings better! */
......@@ -1037,65 +1014,62 @@ static int __init ltpc_probe_dma(int base)
/* release the other dma channel (if we opened both of them) */
if ( (dma&0x2) && (get_dma_residue(3)==sizeof(struct lt_mem)) ){
dma&=1;
if ((want & 2) && (get_dma_residue(3)==sizeof(struct lt_mem))) {
want &= ~2;
free_dma(3);
}
if ( (dma&0x1) && (get_dma_residue(1)==sizeof(struct lt_mem)) ){
dma&=0x2;
if ((want & 1) && (get_dma_residue(1)==sizeof(struct lt_mem))) {
want &= ~1;
free_dma(1);
}
/* fix up dma number */
dma|=1;
if (!want)
return 0;
return dma;
return (want & 2) ? 3 : 1;
}
int __init ltpc_probe(struct net_device *dev)
struct net_device * __init ltpc_probe(void)
{
int err;
struct net_device *dev;
int err = -ENOMEM;
int x=0,y=0;
int autoirq;
unsigned long f;
int portfound=0;
unsigned long timeout;
dev = alloc_netdev(sizeof(struct ltpc_private), "lt%d", ltalk_setup);
if (!dev)
goto out;
SET_MODULE_OWNER(dev);
/* probe for the I/O port address */
if (io != 0x240 && request_region(0x220,8,"ltpc")) {
x = inb_p(0x220+6);
if ( (x!=0xff) && (x>=0xf0) ) {
io = 0x220;
portfound=1;
}
else {
release_region(0x220,8);
goto got_port;
}
release_region(0x220,8);
}
if (io != 0x220 && request_region(0x240,8,"ltpc")) {
y = inb_p(0x240+6);
if ( (y!=0xff) && (y>=0xf0) ){
io = 0x240;
portfound=1;
}
else {
release_region(0x240,8);
goto got_port;
}
release_region(0x240,8);
}
if(io && !portfound && request_region(io,8,"ltpc")){
portfound = 1;
}
if(!portfound) {
/* give up in despair */
printk(KERN_ERR "LocalTalk card not found; 220 = %02x, 240 = %02x.\n", x,y);
return -1;
}
/* give up in despair */
printk(KERN_ERR "LocalTalk card not found; 220 = %02x, 240 = %02x.\n", x,y);
err = -ENODEV;
goto out1;
got_port:
/* probe for the IRQ line */
if (irq < 2) {
unsigned long irq_mask;
......@@ -1111,22 +1085,21 @@ int __init ltpc_probe(struct net_device *dev)
if (autoirq == 0) {
printk(KERN_ERR "ltpc: probe at %#x failed to detect IRQ line.\n", io);
}
else {
} else {
irq = autoirq;
}
}
/* allocate a DMA buffer */
ltdmabuf = (unsigned char *) dma_mem_alloc(1000);
if (ltdmabuf) ltdmacbuf = &ltdmabuf[800];
if (!ltdmabuf) {
printk(KERN_ERR "ltpc: mem alloc failed\n");
return -1;
err = -ENOMEM;
goto out2;
}
ltdmacbuf = &ltdmabuf[800];
if(debug & DEBUG_VERBOSE) {
printk("ltdmabuf pointer %08lx\n",(unsigned long) ltdmabuf);
}
......@@ -1154,25 +1127,29 @@ int __init ltpc_probe(struct net_device *dev)
already been specified */
/* well, 0 is a legal DMA channel, but the LTPC card doesn't
use it... */
if (dma == 0) {
dma = ltpc_probe_dma(io);
if (!dma) { /* no dma channel */
printk(KERN_ERR "No DMA channel found on ltpc card.\n");
return -1;
}
dma = ltpc_probe_dma(io, dma);
if (!dma) { /* no dma channel */
printk(KERN_ERR "No DMA channel found on ltpc card.\n");
err = -ENODEV;
goto out3;
}
/* print out friendly message */
if(irq)
printk(KERN_INFO "Apple/Farallon LocalTalk-PC card at %03x, IR%d, DMA%d.\n",io,irq,dma);
else
printk(KERN_INFO "Apple/Farallon LocalTalk-PC card at %03x, DMA%d. Using polled mode.\n",io,dma);
/* seems more logical to do this *after* probing the card... */
err = ltpc_init(dev);
if (err) return err;
/* Fill in the fields of the device structure with ethernet-generic values. */
dev->hard_start_xmit = ltpc_xmit;
dev->hard_header = ltpc_hard_header;
dev->get_stats = ltpc_get_stats;
/* add the ltpc-specific things */
dev->do_ioctl = &ltpc_ioctl;
dev->set_multicast_list = &set_multicast_list;
dev->mc_list = NULL;
dev->base_addr = io;
dev->irq = irq;
dev->dma = dma;
......@@ -1212,6 +1189,7 @@ int __init ltpc_probe(struct net_device *dev)
} else {
if( irq )
printk(KERN_ERR "ltpc: IRQ already in use, using polled mode.\n");
dev->irq = 0;
/* polled mode -- 20 times per second */
/* this is really, really slow... should it poll more often? */
init_timer(&ltpc_timer);
......@@ -1221,8 +1199,23 @@ int __init ltpc_probe(struct net_device *dev)
ltpc_timer.expires = jiffies + HZ/20;
add_timer(&ltpc_timer);
}
err = register_netdev(dev);
if (err)
goto out4;
return 0;
out4:
del_timer_sync(&ltpc_timer);
if (dev->irq)
free_irq(dev->irq, dev);
out3:
free_pages((unsigned long)ltdmabuf, get_order(1000));
out2:
release_region(io, 8);
out1:
kfree(dev);
out:
return ERR_PTR(err);
}
#ifndef MODULE
......@@ -1259,7 +1252,7 @@ static int __init ltpc_setup(char *str)
__setup("ltpc=", ltpc_setup);
#endif /* MODULE */
static struct net_device dev_ltpc;
static struct net_device *dev_ltpc;
#ifdef MODULE
......@@ -1272,79 +1265,47 @@ MODULE_PARM(dma, "i");
int __init init_module(void)
{
int err, result;
if(io == 0)
printk(KERN_NOTICE
"ltpc: Autoprobing is not recommended for modules\n");
/* Find a name for this unit */
dev_ltpc.init = ltpc_probe;
err=dev_alloc_name(&dev_ltpc,"lt%d");
if(err<0)
return err;
if ((result = register_netdev(&dev_ltpc)) != 0) {
printk(KERN_DEBUG "could not register Localtalk-PC device\n");
return result;
} else {
if(debug & DEBUG_VERBOSE) printk("0 from register_netdev\n");
return 0;
}
dev_ltpc = ltpc_probe();
if (IS_ERR(dev_ltpc))
return PTR_ERR(dev_ltpc);
return 0;
}
#endif
static void __exit ltpc_cleanup(void)
{
unsigned long timeout;
if(debug & DEBUG_VERBOSE) printk("unregister_netdev\n");
unregister_netdev(dev_ltpc);
ltpc_timer.data = 0; /* signal the poll routine that we're done */
del_timer_sync(&ltpc_timer);
if(debug & DEBUG_VERBOSE) printk("freeing irq\n");
if(dev_ltpc.irq) {
free_irq(dev_ltpc.irq,&dev_ltpc);
dev_ltpc.irq = 0;
}
if(del_timer(&ltpc_timer))
{
/* either the poll was never started, or a poll is in process */
if(debug & DEBUG_VERBOSE) printk("waiting\n");
/* if it's in process, wait a bit for it to finish */
timeout = jiffies+HZ;
add_timer(&ltpc_timer);
while(del_timer(&ltpc_timer) && time_after(timeout, jiffies))
{
add_timer(&ltpc_timer);
schedule();
}
}
if (dev_ltpc->irq)
free_irq(dev_ltpc->irq, dev_ltpc);
if(debug & DEBUG_VERBOSE) printk("freeing dma\n");
if(dev_ltpc.dma) {
free_dma(dev_ltpc.dma);
dev_ltpc.dma = 0;
}
if (dev_ltpc->dma)
free_dma(dev_ltpc->dma);
if(debug & DEBUG_VERBOSE) printk("freeing ioaddr\n");
if(dev_ltpc.base_addr) {
release_region(dev_ltpc.base_addr,8);
dev_ltpc.base_addr = 0;
}
if (dev_ltpc->base_addr)
release_region(dev_ltpc->base_addr,8);
free_netdev(dev_ltpc);
if(debug & DEBUG_VERBOSE) printk("free_pages\n");
free_pages( (unsigned long) ltdmabuf, get_order(1000));
ltdmabuf=NULL;
ltdmacbuf=NULL;
if(debug & DEBUG_VERBOSE) printk("unregister_netdev\n");
unregister_netdev(&dev_ltpc);
if(debug & DEBUG_VERBOSE) printk("returning from cleanup_module\n");
}
......
......@@ -1834,7 +1834,7 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
iounmap((void *) bp->regs);
err_out_free_dev:
kfree(dev);
free_netdev(dev);
err_out_free_res:
pci_release_regions(pdev);
......
......@@ -1462,7 +1462,7 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus)
release_OF_resource(bp->node, 0);
out1:
pmac_call_feature(PMAC_FTR_BMAC_ENABLE, bp->node, 0, 0);
kfree(dev);
free_netdev(dev);
}
static int bmac_open(struct net_device *dev)
......
......@@ -1275,7 +1275,7 @@ dgrs_found_device(
SET_MODULE_OWNER(dev);
if (register_netdev(dev) != 0) {
kfree(dev);
free_netdev(dev);
return -EIO;
}
......@@ -1322,7 +1322,7 @@ dgrs_found_device(
ret = -EIO;
if (register_netdev(devN)) {
kfree(devN);
free_netdev(devN);
goto fail;
}
privN->chan = i+1;
......
......@@ -319,7 +319,7 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_dev:
#endif
kfree (dev);
free_netdev (dev);
err_out_res:
pci_release_regions (pdev);
......
......@@ -894,7 +894,7 @@ static int __devinit speedo_found1(struct pci_dev *pdev,
err_free_unlock:
rtnl_unlock();
kfree(dev);
free_netdev(dev);
return -1;
}
......
......@@ -565,7 +565,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev,
#endif
pci_release_regions(pdev);
err_out_free_netdev:
kfree(dev);
free_netdev(dev);
return -ENODEV;
}
......
......@@ -689,7 +689,7 @@ static int __devinit fealnx_init_one(struct pci_dev *pdev,
err_out_free_rx:
pci_free_consistent(pdev, RX_TOTAL_SIZE, np->rx_ring, np->rx_ring_dma);
err_out_free_dev:
kfree(dev);
free_netdev(dev);
err_out_unmap:
#ifndef USE_IO_OPS
iounmap((void *)ioaddr);
......
......@@ -785,7 +785,7 @@ static int __init hamachi_init_one (struct pci_dev *pdev,
pci_free_consistent(pdev, TX_TOTAL_SIZE, hmp->tx_ring,
hmp->tx_ring_dma);
err_out_cleardev:
kfree (dev);
free_netdev (dev);
err_out_iounmap:
iounmap((char *)ioaddr);
err_out_release:
......
......@@ -1512,7 +1512,7 @@ static int __devinit ioc3_probe(struct pci_dev *pdev,
out_res:
pci_release_regions(pdev);
out_free:
kfree(dev);
free_netdev(dev);
return err;
}
......
......@@ -1543,7 +1543,7 @@ lan_init_chip(struct parisc_device *dev)
retval = register_netdev(netdevice);
if (retval) {
printk(KERN_WARNING __FILE__ ": register_netdevice ret'd %d\n", retval);
kfree(netdevice);
free_netdev(netdevice);
return -ENODEV;
};
if (dev->id.sversion == 0x72) {
......
......@@ -55,6 +55,7 @@
#include <linux/ip.h>
#include <linux/tcp.h>
#define LOOPBACK_OVERHEAD (128 + MAX_HEADER + 16 + 16)
/* KISS: just allocate small chunks and copy bits.
......@@ -152,10 +153,12 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
}
dev->last_rx = jiffies;
stats->rx_bytes+=skb->len;
stats->tx_bytes+=skb->len;
stats->rx_packets++;
stats->tx_packets++;
if (likely(stats)) {
stats->rx_bytes+=skb->len;
stats->tx_bytes+=skb->len;
stats->rx_packets++;
stats->tx_packets++;
}
netif_rx(skb);
......@@ -167,36 +170,35 @@ static struct net_device_stats *get_stats(struct net_device *dev)
return (struct net_device_stats *)dev->priv;
}
/* Initialize the rest of the LOOPBACK device. */
int __init loopback_init(struct net_device *dev)
{
dev->mtu = (16 * 1024) + 20 + 20 + 12;
dev->hard_start_xmit = loopback_xmit;
dev->hard_header = eth_header;
dev->hard_header_cache = eth_header_cache;
dev->header_cache_update= eth_header_cache_update;
dev->hard_header_len = ETH_HLEN; /* 14 */
dev->addr_len = ETH_ALEN; /* 6 */
dev->tx_queue_len = 0;
dev->type = ARPHRD_LOOPBACK; /* 0x0001 */
dev->rebuild_header = eth_rebuild_header;
dev->flags = IFF_LOOPBACK;
dev->features = NETIF_F_SG|NETIF_F_FRAGLIST|NETIF_F_NO_CSUM|NETIF_F_HIGHDMA;
/* Current netfilter will die with oom linearizing large skbs,
* however this will be cured before 2.5.x is done.
*/
dev->features |= NETIF_F_TSO;
dev->priv = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
if (dev->priv == NULL)
return -ENOMEM;
memset(dev->priv, 0, sizeof(struct net_device_stats));
dev->get_stats = get_stats;
struct net_device loopback_dev = {
.name = "lo",
.mtu = (16 * 1024) + 20 + 20 + 12,
.hard_start_xmit = loopback_xmit,
.hard_header = eth_header,
.hard_header_cache = eth_header_cache,
.header_cache_update = eth_header_cache_update,
.hard_header_len = ETH_HLEN, /* 14 */
.addr_len = ETH_ALEN, /* 6 */
.tx_queue_len = 0,
.type = ARPHRD_LOOPBACK, /* 0x0001*/
.rebuild_header = eth_rebuild_header,
.flags = IFF_LOOPBACK,
.features = NETIF_F_SG|NETIF_F_FRAGLIST
|NETIF_F_NO_CSUM|NETIF_F_HIGHDMA|NETIF_F_TSO,
};
/*
* Fill in the generic fields of the device structure.
*/
return(0);
/* Setup and register the of the LOOPBACK device. */
int __init loopback_init(void)
{
struct net_device_stats *stats;
/* Can survive without statistics */
stats = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
if (stats) {
memset(stats, 0, sizeof(struct net_device_stats));
loopback_dev.priv = stats;
loopback_dev.get_stats = &get_stats;
}
return register_netdev(&loopback_dev);
};
......@@ -1324,7 +1324,7 @@ static int __init lp486e_init_module(void) {
dev->base_addr = io;
dev->init = lp486e_probe;
if (register_netdev(dev) != 0) {
kfree(dev);
free_netdev(dev);
return -EIO;
}
dev_lp486e = dev;
......
......@@ -766,7 +766,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
i = pci_request_regions(pdev, dev->name);
if (i) {
kfree(dev);
free_netdev(dev);
return i;
}
......@@ -774,7 +774,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
void *mmio = ioremap (ioaddr, iosize);
if (!mmio) {
pci_release_regions(pdev);
kfree(dev);
free_netdev(dev);
return -ENOMEM;
}
ioaddr = (unsigned long) mmio;
......@@ -838,7 +838,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
if (i) {
pci_release_regions(pdev);
unregister_netdev(dev);
kfree(dev);
free_netdev(dev);
pci_set_drvdata(pdev, NULL);
return i;
}
......
......@@ -529,6 +529,7 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
struct net_device *dev;
struct pcnet32_access *a = NULL;
u8 promaddr[6];
int ret = -ENODEV;
/* reset the chip */
pcnet32_wio_reset(ioaddr);
......@@ -540,19 +541,15 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
pcnet32_dwio_reset(ioaddr);
if (pcnet32_dwio_read_csr(ioaddr, 0) == 4 && pcnet32_dwio_check(ioaddr)) {
a = &pcnet32_dwio;
} else {
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENODEV;
}
} else
goto err_release_region;
}
chip_version = a->read_csr(ioaddr, 88) | (a->read_csr(ioaddr,89) << 16);
if (pcnet32_debug > 2)
printk(KERN_INFO " PCnet chip version is %#x.\n", chip_version);
if ((chip_version & 0xfff) != 0x003) {
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENODEV;
}
if ((chip_version & 0xfff) != 0x003)
goto err_release_region;
/* initialize variables */
fdx = mii = fset = dxsuflo = ltint = 0;
......@@ -614,8 +611,7 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
default:
printk(KERN_INFO PFX "PCnet version %#x, no PCnet32 chip.\n",
chip_version);
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENODEV;
goto err_release_region;
}
/*
......@@ -635,8 +631,8 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
dev = alloc_etherdev(0);
if(!dev) {
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENOMEM;
ret = -ENOMEM;
goto err_release_region;
}
SET_NETDEV_DEV(dev, &pdev->dev);
......@@ -708,8 +704,8 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
dev->base_addr = ioaddr;
/* pci_alloc_consistent returns page-aligned memory, so we do not have to check the alignment */
if ((lp = pci_alloc_consistent(pdev, sizeof(*lp), &lp_dma_addr)) == NULL) {
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENOMEM;
ret = -ENOMEM;
goto err_free_netdev;
}
memset(lp, 0, sizeof(*lp));
......@@ -741,9 +737,8 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
if (!a) {
printk(KERN_ERR PFX "No access methods\n");
pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr);
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENODEV;
ret = -ENODEV;
goto err_free_consistent;
}
lp->a = *a;
......@@ -785,14 +780,12 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
mdelay (1);
dev->irq = probe_irq_off (irq_mask);
if (dev->irq)
printk(", probed IRQ %d.\n", dev->irq);
else {
if (!dev->irq) {
printk(", failed to detect IRQ line.\n");
pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr);
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return -ENODEV;
ret = -ENODEV;
goto err_free_consistent;
}
printk(", probed IRQ %d.\n", dev->irq);
}
/* Set the mii phy_id so that we can query the link state */
......@@ -821,6 +814,14 @@ pcnet32_probe1(unsigned long ioaddr, unsigned int irq_line, int shared,
printk(KERN_INFO "%s: registered as %s\n",dev->name, lp->name);
cards_found++;
return 0;
err_free_consistent:
pci_free_consistent(lp->pci_dev, sizeof(*lp), lp, lp->dma_addr);
err_free_netdev:
free_netdev(dev);
err_release_region:
release_region(ioaddr, PCNET32_TOTAL_SIZE);
return ret;
}
......
......@@ -454,7 +454,7 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out,
pci_disable_device(pdev);
err_out:
kfree(dev);
free_netdev(dev);
return rc;
}
......@@ -514,7 +514,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
iounmap(ioaddr);
pci_release_regions(pdev);
pci_disable_device(pdev);
kfree(dev);
free_netdev(dev);
return rc;
}
......
......@@ -269,7 +269,7 @@ rcpci45_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
pci_free_consistent (pdev, MSG_BUF_SIZE, pDpa->msgbuf,
pDpa->msgbuf_dma);
err_out_free_dev:
kfree (dev);
free_netdev (dev);
err_out:
card_idx--;
return error;
......
......@@ -213,9 +213,11 @@ sb1000_probe_one(struct pnp_dev *pdev, const struct pnp_device_id *id)
error = register_netdev(dev);
if (error)
goto out_release_regions;
goto out_free_netdev;
return 0;
out_free_netdev:
free_netdev(dev);
out_release_regions:
release_region(ioaddr[1], 16);
out_release_region0:
......
......@@ -470,7 +470,7 @@ SiS190_init_board(struct pci_dev *pdev, struct net_device **dev_out,
rc = pci_set_dma_mask(pdev, 0xffffffffULL);
if (rc)
goto err_out;
goto err_out_disable;
mmio_start = pci_resource_start(pdev, 0);
mmio_end = pci_resource_end(pdev, 0);
......@@ -482,18 +482,18 @@ SiS190_init_board(struct pci_dev *pdev, struct net_device **dev_out,
printk(KERN_ERR PFX
"region #0 not an MMIO resource, aborting\n");
rc = -ENODEV;
goto err_out;
goto err_out_disable;
}
// check for weird/broken PCI region reporting
if (mmio_len < SiS190_MIN_IO_SIZE) {
printk(KERN_ERR PFX "Invalid PCI region size(s), aborting\n");
rc = -ENODEV;
goto err_out;
goto err_out_disable;
}
rc = pci_request_regions(pdev, dev->name);
if (rc)
goto err_out;
goto err_out_disable;
// enable PCI bus-mastering
pci_set_master(pdev);
......@@ -521,9 +521,10 @@ SiS190_init_board(struct pci_dev *pdev, struct net_device **dev_out,
err_out_free_res:
pci_release_regions(pdev);
err_out:
err_out_disable:
pci_disable_device(pdev);
kfree(dev);
err_out:
free_netdev(dev);
return rc;
}
......@@ -603,7 +604,7 @@ SiS190_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
iounmap(ioaddr);
pci_release_regions(pdev);
pci_disable_device(pdev);
kfree(dev);
free_netdev(dev);
return rc;
}
......
......@@ -503,7 +503,7 @@ static int __devinit sis900_probe (struct pci_dev *pci_dev, const struct pci_dev
pci_set_drvdata(pci_dev, NULL);
pci_release_regions(pci_dev);
err_out:
kfree(net_dev);
free_netdev(net_dev);
return ret;
}
......
......@@ -132,7 +132,7 @@ int __init ultramca_probe(struct device *gen_dev)
struct mca_device *mca_dev = to_mca_device(gen_dev);
char slot = mca_dev->slot;
unsigned char pos2 = 0xff, pos3 = 0xff, pos4 = 0xff, pos5 = 0xff;
int i;
int i, rc;
int adapter = mca_dev->index;
int tbase = 0;
int tirq = 0;
......@@ -209,8 +209,9 @@ int __init ultramca_probe(struct device *gen_dev)
SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, gen_dev);
if((i = register_netdev(dev)) != 0)
return i;
rc = register_netdev(dev);
if (rc)
goto err_free_netdev;
printk(KERN_INFO "%s: %s found in slot %d\n",
dev->name, smc_mca_adapter_names[adapter], slot + 1);
......@@ -262,11 +263,15 @@ int __init ultramca_probe(struct device *gen_dev)
}
}
if (dev->mem_start == 0) /* sanity check, shouldn't happen */
return -ENODEV;
/* sanity check, shouldn't happen */
if (dev->mem_start == 0) {
rc = -ENODEV;
goto err_unregister_netdev;
}
if (!request_region(ioaddr, ULTRA_IO_EXTENT, dev->name))
return -EBUSY;
rc = request_region(ioaddr, ULTRA_IO_EXTENT, dev->name);
if (rc)
goto err_unregister_netdev;
reg4 = inb(ioaddr + 4) & 0x7f;
outb(reg4, ioaddr + 4);
......@@ -296,10 +301,10 @@ int __init ultramca_probe(struct device *gen_dev)
/* Allocate dev->priv and fill in 8390 specific dev fields.
*/
if (ethdev_init(dev)) {
rc = ethdev_init(dev);
if (rc) {
printk (", no memory for dev->priv.\n");
release_region(ioaddr, ULTRA_IO_EXTENT);
return -ENOMEM;
goto err_release_region;
}
gen_dev->driver_data = dev;
......@@ -334,6 +339,14 @@ int __init ultramca_probe(struct device *gen_dev)
NS8390_init(dev, 0);
return 0;
err_release_region:
release_region(ioaddr, ULTRA_IO_EXTENT);
err_unregister_netdev:
unregister_netdev(dev);
err_free_netdev:
free_netdev(dev);
return rc;
}
static int ultramca_open(struct net_device *dev)
......
......@@ -1070,7 +1070,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
err_out_free_res:
pci_release_regions (pdev);
err_out_free_netdev:
kfree(dev);
free_netdev(dev);
return -ENODEV;
}
......
......@@ -734,7 +734,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
#endif
pci_release_regions(pdev);
err_out_netdev:
kfree (dev);
free_netdev (dev);
return -ENODEV;
}
......
......@@ -2416,13 +2416,6 @@ static int gem_nway_reset(struct net_device *dev)
return 0;
}
static u32 gem_get_link(struct net_device *dev)
{
struct gem *gp = dev->priv;
return (gp->lstate == link_up);
}
static u32 gem_get_msglevel(struct net_device *dev)
{
struct gem *gp = dev->priv;
......@@ -2441,7 +2434,6 @@ static struct ethtool_ops gem_ethtool_ops = {
.get_settings = gem_get_settings,
.set_settings = gem_set_settings,
.nway_reset = gem_nway_reset,
.get_link = gem_get_link,
.get_msglevel = gem_get_msglevel,
.set_msglevel = gem_set_msglevel,
};
......@@ -2630,7 +2622,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
if (err) {
printk(KERN_ERR PFX "No usable DMA configuration, "
"aborting.\n");
return err;
goto err_disable_device;
}
pci_using_dac = 0;
}
......@@ -2641,20 +2633,23 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
if ((pci_resource_flags(pdev, 0) & IORESOURCE_IO) != 0) {
printk(KERN_ERR PFX "Cannot find proper PCI device "
"base address, aborting.\n");
return -ENODEV;
err = -ENODEV;
goto err_disable_device;
}
dev = alloc_etherdev(sizeof(*gp));
if (!dev) {
printk(KERN_ERR PFX "Etherdev alloc failed, aborting.\n");
return -ENOMEM;
err = -ENOMEM;
goto err_disable_device;
}
SET_MODULE_OWNER(dev);
SET_NETDEV_DEV(dev, &pdev->dev);
gp = dev->priv;
if (pci_request_regions(pdev, dev->name)) {
err = pci_request_regions(pdev, dev->name);
if (err) {
printk(KERN_ERR PFX "Cannot obtain PCI resources, "
"aborting.\n");
goto err_out_free_netdev;
......@@ -2688,6 +2683,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
if (gp->regs == 0UL) {
printk(KERN_ERR PFX "Cannot map device registers, "
"aborting.\n");
err = -EIO;
goto err_out_free_res;
}
......@@ -2711,8 +2707,10 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
/* By default, we start with autoneg */
gp->want_autoneg = 1;
if (gem_check_invariants(gp))
if (gem_check_invariants(gp)) {
err = -ENODEV;
goto err_out_iounmap;
}
/* It is guaranteed that the returned buffer will be at least
* PAGE_SIZE aligned.
......@@ -2723,6 +2721,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
if (!gp->init_block) {
printk(KERN_ERR PFX "Cannot allocate init block, "
"aborting.\n");
err = -ENOMEM;
goto err_out_iounmap;
}
......@@ -2735,6 +2734,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
if (register_netdev(dev)) {
printk(KERN_ERR PFX "Cannot register net device, "
"aborting.\n");
err = -ENOMEM;
goto err_out_free_consistent;
}
......@@ -2804,9 +2804,10 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
pci_release_regions(pdev);
err_out_free_netdev:
kfree(dev);
return -ENODEV;
free_netdev(dev);
err_disable_device:
pci_disable_device(pdev);
return err;
}
......
......@@ -2895,7 +2895,7 @@ static int __init happy_meal_sbus_init(struct sbus_dev *sdev, int is_qfe)
sbus_iounmap(hp->tcvregs, TCVR_REG_SIZE);
err_out_free_netdev:
kfree(dev);
free_netdev(dev);
err_out:
return err;
......@@ -3247,7 +3247,7 @@ static int __init happy_meal_pci_init(struct pci_dev *pdev)
if (qp != NULL)
qp->happy_meals[qfe_slot] = NULL;
kfree(dev);
free_netdev(dev);
err_out:
return err;
......
......@@ -949,7 +949,7 @@ static int __init qec_ether_init(struct net_device *dev, struct sbus_dev *sdev)
i = 4;
out:
while (i--)
kfree(qe_devs[i]);
free_netdev(qe_devs[i]);
return res;
}
......
......@@ -7740,7 +7740,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
iounmap((void *) tp->regs);
err_out_free_dev:
kfree(dev);
free_netdev(dev);
err_out_free_res:
pci_release_regions(pdev);
......
......@@ -670,7 +670,7 @@ static int __devinit TLan_probe1(struct pci_dev *pdev,
pci_free_consistent(priv->pciDev, priv->dmaSize, priv->dmaStorage,
priv->dmaStorageDMA );
err_out_free_dev:
kfree(dev);
free_netdev(dev);
err_out_regions:
if (pdev)
pci_release_regions(pdev);
......@@ -695,7 +695,7 @@ static void TLan_Eisa_Cleanup(void)
release_region( dev->base_addr, 0x10);
unregister_netdev( dev );
TLan_Eisa_Devices = priv->nextDevice;
kfree( dev );
free_netdev( dev );
tlan_have_eisa--;
}
}
......
......@@ -2455,7 +2455,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
error_out_regions:
pci_release_regions(pdev);
error_out_dev:
kfree(dev);
free_netdev(dev);
error_out:
return err;
}
......
......@@ -868,7 +868,7 @@ static int __devinit via_rhine_init_one (struct pci_dev *pdev,
#endif
pci_release_regions(pdev);
err_out_free_netdev:
kfree (dev);
free_netdev (dev);
err_out:
return -ENODEV;
}
......
......@@ -55,14 +55,13 @@
#include <asm/dma.h>
#include <asm/uaccess.h>
static const char devname[] = "dlci";
static const char version[] = "DLCI driver v0.35, 4 Jan 1997, mike.mclagan@linux.org";
static struct net_device *open_dev[CONFIG_DLCI_COUNT];
static LIST_HEAD(dlci_devs);
static spinlock_t dlci_dev_lock = SPIN_LOCK_UNLOCKED;
static char *basename[16];
int dlci_init(struct net_device *dev);
static void dlci_setup(struct net_device *);
/* allow FRAD's to register their name as a valid FRAD */
int register_frad(const char *name)
......@@ -115,6 +114,7 @@ int unregister_frad(const char *name)
return(0);
}
EXPORT_SYMBOL(unregister_frad);
/*
* these encapsulate the RFC 1490 requirements as well as
......@@ -168,6 +168,14 @@ static void dlci_receive(struct sk_buff *skb, struct net_device *dev)
int process, header;
dlp = dev->priv;
if (!pskb_may_pull(skb, sizeof(*hdr))) {
printk(KERN_NOTICE "%s: invalid data no header\n",
dev->name);
dlp->stats.rx_errors++;
kfree_skb(skb);
return;
}
hdr = (struct frhdr *) skb->data;
process = 0;
header = 0;
......@@ -277,7 +285,7 @@ static int dlci_transmit(struct sk_buff *skb, struct net_device *dev)
return(ret);
}
int dlci_config(struct net_device *dev, struct dlci_conf *conf, int get)
static int dlci_config(struct net_device *dev, struct dlci_conf *conf, int get)
{
struct dlci_conf config;
struct dlci_local *dlp;
......@@ -311,7 +319,7 @@ int dlci_config(struct net_device *dev, struct dlci_conf *conf, int get)
return(0);
}
int dlci_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
static int dlci_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
struct dlci_local *dlp;
......@@ -401,21 +409,23 @@ static struct net_device_stats *dlci_get_stats(struct net_device *dev)
return(&dlp->stats);
}
int dlci_add(struct dlci_add *dlci)
static int dlci_add(struct dlci_add *dlci)
{
struct net_device *master, *slave;
struct net_device *master, *slave;
struct dlci_local *dlp;
struct frad_local *flp;
int err, i;
char buf[10];
/* validate slave device */
slave = __dev_get_by_name(dlci->devname);
slave = dev_get_by_name(dlci->devname);
if (!slave)
return(-ENODEV);
if (slave->type != ARPHRD_FRAD)
if (slave->type != ARPHRD_FRAD) {
dev_put(slave);
return(-EINVAL);
}
/* check for registration */
for (i=0;i<sizeof(basename) / sizeof(char *); i++)
......@@ -424,33 +434,22 @@ int dlci_add(struct dlci_add *dlci)
(strlen(dlci->devname) > strlen(basename[i])))
break;
if (i == sizeof(basename) / sizeof(char *))
if (i == sizeof(basename) / sizeof(char *)) {
dev_put(slave);
return(-EINVAL);
/* check for too many open devices : should this be dynamic ? */
for(i=0;i<CONFIG_DLCI_COUNT;i++)
if (!open_dev[i])
break;
if (i == CONFIG_DLCI_COUNT)
return(-ENOSPC); /* #### Alan: Comments on this?? */
}
/* create device name */
sprintf(buf, "%s%02i", devname, i);
master = kmalloc(sizeof(*master), GFP_KERNEL);
if (!master)
master = alloc_netdev( sizeof(struct dlci_local), "dlci%d",
dlci_setup);
if (!master) {
dev_put(slave);
return(-ENOMEM);
memset(master, 0, sizeof(*master));
strcpy(master->name, buf);
master->init = dlci_init;
master->flags = 0;
}
err = register_netdev(master);
if (err < 0)
{
if (err < 0) {
dev_put(slave);
kfree(master);
return(err);
}
......@@ -459,64 +458,65 @@ int dlci_add(struct dlci_add *dlci)
dlp = (struct dlci_local *) master->priv;
dlp->slave = slave;
dlp->master = master;
flp = slave->priv;
err = flp ? (*flp->assoc)(slave, master) : -EINVAL;
if (err < 0)
{
unregister_netdev(master);
kfree(master->priv);
kfree(master);
dev_put(slave);
free_netdev(master);
return(err);
}
strcpy(dlci->devname, buf);
open_dev[i] = master;
MOD_INC_USE_COUNT;
strcpy(dlci->devname, master->name);
spin_lock_bh(&dlci_dev_lock);
list_add(&dlp->list, &dlci_devs);
spin_unlock_bh(&dlci_dev_lock);
return(0);
}
int dlci_del(struct dlci_add *dlci)
static int dlci_del(struct dlci_add *dlci)
{
struct dlci_local *dlp;
struct frad_local *flp;
struct net_device *master, *slave;
int i, err;
struct net_device *master, *slave;
int err;
/* validate slave device */
master = __dev_get_by_name(dlci->devname);
if (!master)
return(-ENODEV);
if (netif_running(master))
if (netif_running(master)) {
return(-EBUSY);
}
dlp = master->priv;
slave = dlp->slave;
flp = slave->priv;
err = (*flp->deassoc)(slave, master);
if (err)
if (err)
return(err);
unregister_netdev(master);
for(i=0;i<CONFIG_DLCI_COUNT;i++)
if (master == open_dev[i])
break;
spin_lock_bh(&dlci_dev_lock);
list_del(&dlp->list);
spin_unlock_bh(&dlci_dev_lock);
if (i<CONFIG_DLCI_COUNT)
open_dev[i] = NULL;
unregister_netdev(master);
kfree(master->priv);
dev_put(slave);
free_netdev(master);
MOD_DEC_USE_COUNT;
return(0);
}
int dlci_ioctl(unsigned int cmd, void *arg)
static int dlci_ioctl(unsigned int cmd, void *arg)
{
struct dlci_add add;
int err;
......@@ -548,16 +548,9 @@ int dlci_ioctl(unsigned int cmd, void *arg)
return(err);
}
int dlci_init(struct net_device *dev)
static void dlci_setup(struct net_device *dev)
{
struct dlci_local *dlp;
dev->priv = kmalloc(sizeof(struct dlci_local), GFP_KERNEL);
if (!dev->priv)
return(-ENOMEM);
memset(dev->priv, 0, sizeof(struct dlci_local));
dlp = dev->priv;
struct dlci_local *dlp = dev->priv;
dev->flags = 0;
dev->open = dlci_open;
......@@ -573,9 +566,7 @@ int dlci_init(struct net_device *dev)
dev->type = ARPHRD_DLCI;
dev->hard_header_len = sizeof(struct frhdr);
dev->addr_len = sizeof(short);
memset(dev->dev_addr, 0, sizeof(dev->dev_addr));
return(0);
}
int __init init_dlci(void)
......@@ -584,9 +575,6 @@ int __init init_dlci(void)
dlci_ioctl_set(dlci_ioctl);
printk("%s.\n", version);
for(i=0;i<CONFIG_DLCI_COUNT;i++)
open_dev[i] = NULL;
for(i=0;i<sizeof(basename) / sizeof(char *);i++)
basename[i] = NULL;
......@@ -596,7 +584,16 @@ int __init init_dlci(void)
void __exit dlci_exit(void)
{
struct dlci_local *dlp, *nxt;
dlci_ioctl_set(NULL);
list_for_each_entry_safe(dlp, nxt, &dlci_devs, list) {
unregister_netdev(dlp->master);
dev_put(dlp->slave);
free_netdev(dlp->master);
}
}
module_init(init_dlci);
......
......@@ -140,6 +140,7 @@ static void change_level( struct net_device * );
static void timeout_change_level( struct net_device * );
static u32 calc_crc32( u32, u8 *, u32 );
static struct sk_buff * get_rx_buf( struct net_device * );
static int sbni_init( struct net_device * );
#ifdef CONFIG_SBNI_MULTILINE
static int enslave( struct net_device *, struct net_device * );
......@@ -205,23 +206,44 @@ sbni_isa_probe( struct net_device *dev )
}
}
int __init
sbni_probe( struct net_device *dev )
static void __init sbni_devsetup(struct net_device *dev)
{
int i;
ether_setup( dev );
dev->init = &sbni_init;
dev->open = &sbni_open;
dev->stop = &sbni_close;
dev->hard_start_xmit = &sbni_start_xmit;
dev->get_stats = &sbni_get_stats;
dev->set_multicast_list = &set_multicast_list;
dev->do_ioctl = &sbni_ioctl;
SET_MODULE_OWNER( dev );
}
int __init sbni_probe(void)
{
struct net_device *dev;
static unsigned version_printed __initdata = 0;
if( version_printed++ == 0 )
printk( KERN_INFO "%s", version );
if( !dev ) { /* simple sanity check */
printk( KERN_ERR "sbni: NULL device!\n" );
return -ENODEV;
}
dev = alloc_netdev(sizeof(struct net_local), "sbni%d", sbni_devsetup);
if (!dev)
return -ENOMEM;
SET_MODULE_OWNER( dev );
netdev_boot_setup_check(dev);
if (register_netdev(dev)) {
kfree(dev);
return -ENODEV;
}
return 0;
}
static int __init sbni_init(struct net_device *dev)
{
int i;
if( dev->base_addr )
return sbni_isa_probe( dev );
/* otherwise we have to perform search our adapter */
......@@ -338,7 +360,7 @@ sbni_probe1( struct net_device *dev, unsigned long ioaddr, int irq )
dev->base_addr = ioaddr;
/* Allocate dev->priv and fill in sbni-specific dev fields. */
nl = (struct net_local *) kmalloc(sizeof(struct net_local), GFP_KERNEL);
nl = dev->priv;
if( !nl ) {
printk( KERN_ERR "%s: unable to get memory!\n", dev->name );
release_region( ioaddr, SBNI_IO_EXTENT );
......@@ -389,14 +411,6 @@ sbni_probe1( struct net_device *dev, unsigned long ioaddr, int irq )
nl->link = NULL;
#endif
dev->open = &sbni_open;
dev->stop = &sbni_close;
dev->hard_start_xmit = &sbni_start_xmit;
dev->get_stats = &sbni_get_stats;
dev->set_multicast_list = &set_multicast_list;
dev->do_ioctl = &sbni_ioctl;
ether_setup( dev );
sbni_cards[ num++ ] = dev;
return dev;
}
......@@ -1478,15 +1492,15 @@ init_module( void )
struct net_device *dev;
while( num < SBNI_MAX_NUM_CARDS ) {
if( !(dev = kmalloc(sizeof(struct net_device), GFP_KERNEL)) ){
dev = alloc_netdev(sizeof(struct net_local),
"sbni%d", sbni_devsetup);
if( !dev) {
printk( KERN_ERR "sbni: unable to allocate device!\n" );
return -ENOMEM;
}
memset( dev, 0, sizeof(struct net_device) );
sprintf( dev->name, "sbni%d", num );
dev->init = sbni_probe;
if( register_netdev( dev ) ) {
kfree( dev );
break;
......@@ -1506,7 +1520,6 @@ cleanup_module( void )
if( (dev = sbni_cards[ num ]) != NULL ) {
unregister_netdev( dev );
release_region( dev->base_addr, SBNI_IO_EXTENT );
kfree( dev->priv );
free_netdev( dev );
}
}
......
This diff is collapsed.
......@@ -577,7 +577,7 @@ static int __devinit yellowfin_init_one(struct pci_dev *pdev,
#endif
pci_release_regions(pdev);
err_out_free_netdev:
kfree (dev);
free_netdev (dev);
return -ENODEV;
}
......
......@@ -155,9 +155,11 @@ struct frhdr
struct dlci_local
{
struct net_device_stats stats;
struct net_device *slave;
struct net_device *master;
struct net_device *slave;
struct dlci_conf config;
int configured;
struct list_head list;
/* callback function */
void (*receive)(struct sk_buff *skb, struct net_device *);
......
......@@ -37,9 +37,6 @@
#ifdef __KERNEL__
#include <linux/config.h>
#ifdef CONFIG_NET_PROFILE
#include <net/profile.h>
#endif
struct divert_blk;
struct vlan_group;
......@@ -498,6 +495,7 @@ extern struct net_device loopback_dev; /* The loopback */
extern struct net_device *dev_base; /* All devices */
extern rwlock_t dev_base_lock; /* Device list lock */
extern void probe_old_netdevs(void);
extern int netdev_boot_setup_add(char *name, struct ifmap *map);
extern int netdev_boot_setup_check(struct net_device *dev);
extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr);
......
#include <linux/config.h> /* for CONFIG_NET_PROFILE */
#ifndef _NET_PROFILE_H_
#define _NET_PROFILE_H_ 1
#ifdef CONFIG_NET_PROFILE
#include <linux/types.h>
#include <linux/time.h>
#include <linux/kernel.h>
#include <asm/system.h>
#ifdef CONFIG_X86_TSC
#include <asm/msr.h>
#endif
struct net_profile_slot
{
char id[16];
struct net_profile_slot *next;
struct timeval entered;
struct timeval accumulator;
struct timeval irq;
int hits;
int active;
int underflow;
};
extern atomic_t net_profile_active;
extern struct timeval net_profile_adjust;
extern void net_profile_irq_adjust(struct timeval *entered, struct timeval* leaved);
#ifdef CONFIG_X86_TSC
static inline void net_profile_stamp(struct timeval *pstamp)
{
rdtsc(pstamp->tv_usec, pstamp->tv_sec);
}
static inline void net_profile_accumulate(struct timeval *entered,
struct timeval *leaved,
struct timeval *acc)
{
__asm__ __volatile__ ("subl %2,%0\n\t"
"sbbl %3,%1\n\t"
"addl %4,%0\n\t"
"adcl %5,%1\n\t"
"subl net_profile_adjust+4,%0\n\t"
"sbbl $0,%1\n\t"
: "=r" (acc->tv_usec), "=r" (acc->tv_sec)
: "g" (entered->tv_usec), "g" (entered->tv_sec),
"g" (leaved->tv_usec), "g" (leaved->tv_sec),
"0" (acc->tv_usec), "1" (acc->tv_sec));
}
static inline void net_profile_sub(struct timeval *sub,
struct timeval *acc)
{
__asm__ __volatile__ ("subl %2,%0\n\t"
"sbbl %3,%1\n\t"
: "=r" (acc->tv_usec), "=r" (acc->tv_sec)
: "g" (sub->tv_usec), "g" (sub->tv_sec),
"0" (acc->tv_usec), "1" (acc->tv_sec));
}
static inline void net_profile_add(struct timeval *add,
struct timeval *acc)
{
__asm__ __volatile__ ("addl %2,%0\n\t"
"adcl %3,%1\n\t"
: "=r" (acc->tv_usec), "=r" (acc->tv_sec)
: "g" (add->tv_usec), "g" (add->tv_sec),
"0" (acc->tv_usec), "1" (acc->tv_sec));
}
#elif defined (__alpha__)
extern __u32 alpha_lo;
extern long alpha_hi;
/* On alpha cycle counter has only 32 bits :-( :-( */
static inline void net_profile_stamp(struct timeval *pstamp)
{
__u32 result;
__asm__ __volatile__ ("rpcc %0" : "r="(result));
if (result <= alpha_lo)
alpha_hi++;
alpha_lo = result;
pstamp->tv_sec = alpha_hi;
pstamp->tv_usec = alpha_lo;
}
static inline void net_profile_accumulate(struct timeval *entered,
struct timeval *leaved,
struct timeval *acc)
{
time_t usecs = acc->tv_usec + leaved->tv_usec - entered->tv_usec
- net_profile_adjust.tv_usec;
time_t secs = acc->tv_sec + leaved->tv_sec - entered->tv_sec;
if (usecs >= 0x100000000L) {
usecs -= 0x100000000L;
secs++;
} else if (usecs < -0x100000000L) {
usecs += 0x200000000L;
secs -= 2;
} else if (usecs < 0) {
usecs += 0x100000000L;
secs--;
}
acc->tv_sec = secs;
acc->tv_usec = usecs;
}
static inline void net_profile_sub(struct timeval *entered,
struct timeval *leaved)
{
time_t usecs = leaved->tv_usec - entered->tv_usec;
time_t secs = leaved->tv_sec - entered->tv_sec;
if (usecs < 0) {
usecs += 0x100000000L;
secs--;
}
leaved->tv_sec = secs;
leaved->tv_usec = usecs;
}
static inline void net_profile_add(struct timeval *entered, struct timeval *leaved)
{
time_t usecs = leaved->tv_usec + entered->tv_usec;
time_t secs = leaved->tv_sec + entered->tv_sec;
if (usecs >= 0x100000000L) {
usecs -= 0x100000000L;
secs++;
}
leaved->tv_sec = secs;
leaved->tv_usec = usecs;
}
#else
static inline void net_profile_stamp(struct timeval *pstamp)
{
/* Not "fast" counterpart! On architectures without
cpu clock "fast" routine is absolutely useless in this
situation. do_gettimeofday still says something on slow-slow-slow
boxes, though it eats more cpu time than the subject of
investigation :-) :-)
*/
do_gettimeofday(pstamp);
}
static inline void net_profile_accumulate(struct timeval *entered,
struct timeval *leaved,
struct timeval *acc)
{
time_t usecs = acc->tv_usec + leaved->tv_usec - entered->tv_usec
- net_profile_adjust.tv_usec;
time_t secs = acc->tv_sec + leaved->tv_sec - entered->tv_sec;
if (usecs >= 1000000) {
usecs -= 1000000;
secs++;
} else if (usecs < -1000000) {
usecs += 2000000;
secs -= 2;
} else if (usecs < 0) {
usecs += 1000000;
secs--;
}
acc->tv_sec = secs;
acc->tv_usec = usecs;
}
static inline void net_profile_sub(struct timeval *entered,
struct timeval *leaved)
{
time_t usecs = leaved->tv_usec - entered->tv_usec;
time_t secs = leaved->tv_sec - entered->tv_sec;
if (usecs < 0) {
usecs += 1000000;
secs--;
}
leaved->tv_sec = secs;
leaved->tv_usec = usecs;
}
static inline void net_profile_add(struct timeval *entered, struct timeval *leaved)
{
time_t usecs = leaved->tv_usec + entered->tv_usec;
time_t secs = leaved->tv_sec + entered->tv_sec;
if (usecs >= 1000000) {
usecs -= 1000000;
secs++;
}
leaved->tv_sec = secs;
leaved->tv_usec = usecs;
}
#endif
static inline void net_profile_enter(struct net_profile_slot *s)
{
unsigned long flags;
save_flags(flags);
cli();
if (s->active++ == 0) {
net_profile_stamp(&s->entered);
atomic_inc(&net_profile_active);
}
restore_flags(flags);
}
static inline void net_profile_leave_irq(struct net_profile_slot *s)
{
unsigned long flags;
save_flags(flags);
cli();
if (--s->active <= 0) {
if (s->active == 0) {
struct timeval curr_pstamp;
net_profile_stamp(&curr_pstamp);
net_profile_accumulate(&s->entered, &curr_pstamp, &s->accumulator);
if (!atomic_dec_and_test(&net_profile_active))
net_profile_irq_adjust(&s->entered, &curr_pstamp);
} else {
s->underflow++;
}
}
s->hits++;
restore_flags(flags);
}
static inline void net_profile_leave(struct net_profile_slot *s)
{
unsigned long flags;
save_flags(flags);
cli();
if (--s->active <= 0) {
if (s->active == 0) {
struct timeval curr_pstamp;
net_profile_stamp(&curr_pstamp);
net_profile_accumulate(&s->entered, &curr_pstamp, &s->accumulator);
atomic_dec(&net_profile_active);
} else {
s->underflow++;
}
}
s->hits++;
restore_flags(flags);
}
#define NET_PROFILE_ENTER(slot) net_profile_enter(&net_prof_##slot)
#define NET_PROFILE_LEAVE(slot) net_profile_leave(&net_prof_##slot)
#define NET_PROFILE_LEAVE_IRQ(slot) net_profile_leave_irq(&net_prof_##slot)
#define NET_PROFILE_SKB_CLEAR(skb) ({ \
skb->pstamp.tv_usec = 0; \
})
#define NET_PROFILE_SKB_INIT(skb) ({ \
net_profile_stamp(&skb->pstamp); \
})
#define NET_PROFILE_SKB_PASSED(skb, slot) ({ \
if (skb->pstamp.tv_usec) { \
struct timeval cur_pstamp = skb->pstamp; \
net_profile_stamp(&skb->pstamp); \
net_profile_accumulate(&cur_pstamp, &skb->pstamp, &net_prof_##slot.accumulator); \
net_prof_##slot.hits++; \
}})
#define NET_PROFILE_DECL(slot) \
extern struct net_profile_slot net_prof_##slot;
#define NET_PROFILE_DEFINE(slot) \
struct net_profile_slot net_prof_##slot = { #slot, };
#define NET_PROFILE_REGISTER(slot) net_profile_register(&net_prof_##slot)
#define NET_PROFILE_UNREGISTER(slot) net_profile_unregister(&net_prof_##slot)
extern int net_profile_init(void);
extern int net_profile_register(struct net_profile_slot *);
extern int net_profile_unregister(struct net_profile_slot *);
#else
#define NET_PROFILE_ENTER(slot) do { /* nothing */ } while(0)
#define NET_PROFILE_LEAVE(slot) do { /* nothing */ } while(0)
#define NET_PROFILE_LEAVE_IRQ(slot) do { /* nothing */ } while(0)
#define NET_PROFILE_SKB_CLEAR(skb) do { /* nothing */ } while(0)
#define NET_PROFILE_SKB_INIT(skb) do { /* nothing */ } while(0)
#define NET_PROFILE_SKB_PASSED(skb, slot) do { /* nothing */ } while(0)
#define NET_PROFILE_DECL(slot)
#define NET_PROFILE_DEFINE(slot)
#define NET_PROFILE_REGISTER(slot) do { /* nothing */ } while(0)
#define NET_PROFILE_UNREGISTER(slot) do { /* nothing */ } while(0)
#endif
#endif
......@@ -676,7 +676,6 @@ config NET_SCHED
source "net/sched/Kconfig"
#bool 'Network code profiler' CONFIG_NET_PROFILE
endmenu
menu "Network testing"
......
......@@ -118,23 +118,24 @@ int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size)
{
unsigned long flags;
struct atm_dev_addr *walk;
int total;
int total = 0, error;
struct sockaddr_atmsvc *tmp_buf, *tmp_bufp;
spin_lock_irqsave(&dev->lock, flags);
total = 0;
for (walk = dev->local; walk; walk = walk->next) {
for (walk = dev->local; walk; walk = walk->next)
total += sizeof(struct sockaddr_atmsvc);
if (total > size) {
spin_unlock_irqrestore(&dev->lock, flags);
return -E2BIG;
}
if (copy_to_user(u_buf,&walk->addr,
sizeof(struct sockaddr_atmsvc))) {
spin_unlock_irqrestore(&dev->lock, flags);
return -EFAULT;
}
u_buf++;
tmp_buf = tmp_bufp = kmalloc(total, GFP_ATOMIC);
if (!tmp_buf) {
spin_unlock_irqrestore(&dev->lock, flags);
return -ENOMEM;
}
for (walk = dev->local; walk; walk = walk->next)
memcpy(tmp_bufp++, &walk->addr, sizeof(struct sockaddr_atmsvc));
spin_unlock_irqrestore(&dev->lock, flags);
return total;
error = total > size ? -E2BIG : total;
if (copy_to_user(u_buf, tmp_buf, total < size ? total : size))
error = -EFAULT;
kfree(tmp_buf);
return error;
}
......@@ -41,7 +41,6 @@
#include <linux/poll.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/interrupt.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
......
......@@ -1794,7 +1794,7 @@ static void *rfcomm_seq_next(struct seq_file *seq, void *e, loff_t *pos)
if (p->next != &s->dlcs)
return p->next;
for (p = s->list.next; p != &session_list; p = p->next) {
list_for_each(p, &session_list) {
s = list_entry(p, struct rfcomm_session, list);
__list_for_each(pp, &s->dlcs) {
seq->private = s;
......
......@@ -39,7 +39,6 @@
#include <linux/poll.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/interrupt.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
......
......@@ -41,7 +41,6 @@
#include <linux/poll.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/interrupt.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
......
......@@ -11,6 +11,5 @@ obj-y += flow.o dev.o ethtool.o net-sysfs.o dev_mcast.o dst.o \
obj-$(CONFIG_NETFILTER) += netfilter.o
obj-$(CONFIG_NET_DIVERT) += dv.o
obj-$(CONFIG_NET_PROFILE) += profile.o
obj-$(CONFIG_NET_PKTGEN) += pktgen.o
obj-$(CONFIG_NET_RADIO) += wireless.o
......@@ -99,7 +99,6 @@
#include <linux/divert.h>
#include <net/dst.h>
#include <net/pkt_sched.h>
#include <net/profile.h>
#include <net/checksum.h>
#include <linux/highmem.h>
#include <linux/init.h>
......@@ -128,9 +127,6 @@ extern int plip_init(void);
*/
#undef OFFLINE_SAMPLE
NET_PROFILE_DEFINE(dev_queue_xmit)
NET_PROFILE_DEFINE(softnet_process)
/*
* The list of packet types we will receive (as opposed to discard)
* and the routines to invoke.
......@@ -2981,7 +2977,6 @@ int unregister_netdevice(struct net_device *dev)
*/
static int __init net_dev_init(void)
{
struct net_device *dev, **dp;
int i, rc = -ENOMEM;
BUG_ON(!dev_boot_phase);
......@@ -3016,88 +3011,15 @@ static int __init net_dev_init(void)
atomic_set(&queue->backlog_dev.refcnt, 1);
}
#ifdef CONFIG_NET_PROFILE
net_profile_init();
NET_PROFILE_REGISTER(dev_queue_xmit);
NET_PROFILE_REGISTER(softnet_process);
#endif
#ifdef OFFLINE_SAMPLE
samp_timer.expires = jiffies + (10 * HZ);
add_timer(&samp_timer);
#endif
/*
* Add the devices.
* If the call to dev->init fails, the dev is removed
* from the chain disconnecting the device until the
* next reboot.
*
* NB At boot phase networking is dead. No locking is required.
* But we still preserve dev_base_lock for sanity.
*/
dp = &dev_base;
while ((dev = *dp) != NULL) {
spin_lock_init(&dev->queue_lock);
spin_lock_init(&dev->xmit_lock);
#ifdef CONFIG_NET_FASTROUTE
dev->fastpath_lock = RW_LOCK_UNLOCKED;
#endif
dev->xmit_lock_owner = -1;
dev->iflink = -1;
dev_hold(dev);
/*
* Allocate name. If the init() fails
* the name will be reissued correctly.
*/
if (strchr(dev->name, '%'))
dev_alloc_name(dev, dev->name);
/*
* Check boot time settings for the device.
*/
netdev_boot_setup_check(dev);
if ( (dev->init && dev->init(dev)) ||
netdev_register_sysfs(dev) ) {
/*
* It failed to come up. It will be unhooked later.
* dev_alloc_name can now advance to next suitable
* name that is checked next.
*/
dp = &dev->next;
} else {
dp = &dev->next;
dev->ifindex = dev_new_index();
dev->reg_state = NETREG_REGISTERED;
if (dev->iflink == -1)
dev->iflink = dev->ifindex;
if (!dev->rebuild_header)
dev->rebuild_header = default_rebuild_header;
dev_init_scheduler(dev);
set_bit(__LINK_STATE_PRESENT, &dev->state);
}
}
/*
* Unhook devices that failed to come up
*/
dp = &dev_base;
while ((dev = *dp) != NULL) {
if (dev->reg_state != NETREG_REGISTERED) {
write_lock_bh(&dev_base_lock);
*dp = dev->next;
write_unlock_bh(&dev_base_lock);
dev_put(dev);
} else {
dp = &dev->next;
}
}
dev_boot_phase = 0;
probe_old_netdevs();
open_softirq(NET_TX_SOFTIRQ, net_tx_action, NULL);
open_softirq(NET_RX_SOFTIRQ, net_rx_action, NULL);
......
......@@ -11,7 +11,6 @@
*
*/
#include <linux/workqueue.h>
#include <linux/config.h>
#include <linux/netdevice.h>
#include <linux/if.h>
......
......@@ -101,7 +101,7 @@ int nf_register_sockopt(struct nf_sockopt_ops *reg)
if (down_interruptible(&nf_sockopt_mutex) != 0)
return -EINTR;
for (i = nf_sockopts.next; i != &nf_sockopts; i = i->next) {
list_for_each(i, &nf_sockopts) {
struct nf_sockopt_ops *ops = (struct nf_sockopt_ops *)i;
if (ops->pf == reg->pf
&& (overlap(ops->set_optmin, ops->set_optmax,
......@@ -296,7 +296,7 @@ static int nf_sockopt(struct sock *sk, int pf, int val,
if (down_interruptible(&nf_sockopt_mutex) != 0)
return -EINTR;
for (i = nf_sockopts.next; i != &nf_sockopts; i = i->next) {
list_for_each(i, &nf_sockopts) {
ops = (struct nf_sockopt_ops *)i;
if (ops->pf == pf) {
if (get) {
......
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/jiffies.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/netdevice.h>
#include <linux/string.h>
#include <linux/skbuff.h>
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/ip.h>
#include <linux/inet.h>
#include <net/checksum.h>
#include <asm/processor.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <net/profile.h>
#ifdef CONFIG_NET_PROFILE
atomic_t net_profile_active;
struct timeval net_profile_adjust;
NET_PROFILE_DEFINE(total);
struct net_profile_slot *net_profile_chain = &net_prof_total;
#ifdef __alpha__
__u32 alpha_lo;
long alpha_hi;
static void alpha_tick(unsigned long);
static struct timer_list alpha_timer = TIMER_INITIALIZER(alpha_tick, 0, 0);
void alpha_tick(unsigned long dummy)
{
struct timeval dummy_stamp;
net_profile_stamp(&dummy_stamp);
alpha_timer.expires = jiffies + 4*HZ;
add_timer(&alpha_timer);
}
#endif
void net_profile_irq_adjust(struct timeval *entered, struct timeval* leaved)
{
struct net_profile_slot *s;
net_profile_sub(entered, leaved);
for (s = net_profile_chain; s; s = s->next) {
if (s->active)
net_profile_add(leaved, &s->irq);
}
}
#ifdef CONFIG_PROC_FS
static int profile_read_proc(char *buffer, char **start, off_t offset,
int length, int *eof, void *data)
{
off_t pos=0;
off_t begin=0;
int len=0;
struct net_profile_slot *s;
len+= sprintf(buffer, "Slot Hits Hi Lo OnIrqHi OnIrqLo Ufl\n");
if (offset == 0) {
cli();
net_prof_total.active = 1;
atomic_inc(&net_profile_active);
NET_PROFILE_LEAVE(total);
sti();
}
for (s = net_profile_chain; s; s = s->next) {
struct net_profile_slot tmp;
cli();
tmp = *s;
/* Wrong, but pretty close to truth */
s->accumulator.tv_sec = 0;
s->accumulator.tv_usec = 0;
s->irq.tv_sec = 0;
s->irq.tv_usec = 0;
s->hits = 0;
s->underflow = 0;
/* Repair active count, it is possible, only if code has a bug */
if (s->active) {
s->active = 0;
atomic_dec(&net_profile_active);
}
sti();
net_profile_sub(&tmp.irq, &tmp.accumulator);
len += sprintf(buffer+len,"%-15s %-10d %-10ld %-10lu %-10lu %-10lu %d/%d",
tmp.id,
tmp.hits,
tmp.accumulator.tv_sec,
tmp.accumulator.tv_usec,
tmp.irq.tv_sec,
tmp.irq.tv_usec,
tmp.underflow, tmp.active);
buffer[len++]='\n';
pos=begin+len;
if(pos<offset) {
len=0;
begin=pos;
}
if(pos>offset+length)
goto done;
}
*eof = 1;
done:
*start=buffer+(offset-begin);
len-=(offset-begin);
if(len>length)
len=length;
if (len < 0)
len = 0;
if (offset == 0) {
cli();
net_prof_total.active = 0;
net_prof_total.hits = 0;
net_profile_stamp(&net_prof_total.entered);
sti();
}
return len;
}
#endif
struct iphdr whitehole_iph;
int whitehole_count;
static int whitehole_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct net_device_stats *stats;
stats = (struct net_device_stats *)dev->priv;
stats->tx_packets++;
stats->tx_bytes+=skb->len;
dev_kfree_skb(skb);
return 0;
}
static void whitehole_inject(unsigned long);
int whitehole_init(struct net_device *dev);
static struct timer_list whitehole_timer =
TIMER_INITIALIZER(whitehole_inject, 0, 0);
static struct net_device whitehole_dev = {
.name = "whitehole",
.init = whitehole_init,
};
static int whitehole_open(struct net_device *dev)
{
whitehole_count = 100000;
whitehole_timer.expires = jiffies + 5*HZ;
add_timer(&whitehole_timer);
return 0;
}
static int whitehole_close(struct net_device *dev)
{
del_timer(&whitehole_timer);
return 0;
}
static void whitehole_inject(unsigned long dummy)
{
struct net_device_stats *stats = (struct net_device_stats *)whitehole_dev.priv;
extern int netdev_dropping;
do {
struct iphdr *iph;
struct sk_buff *skb = alloc_skb(128, GFP_ATOMIC);
if (!skb)
break;
skb_reserve(skb, 32);
iph = (struct iphdr*)skb_put(skb, sizeof(*iph));
skb->mac.raw = ((u8*)iph) - 14;
memcpy(iph, &whitehole_iph, sizeof(*iph));
skb->protocol = __constant_htons(ETH_P_IP);
skb->dev = &whitehole_dev;
skb->pkt_type = PACKET_HOST;
stats->rx_packets++;
stats->rx_bytes += skb->len;
netif_rx(skb);
whitehole_count--;
} while (netdev_dropping == 0 && whitehole_count>0);
if (whitehole_count > 0) {
whitehole_timer.expires = jiffies + 1;
add_timer(&whitehole_timer);
}
}
static struct net_device_stats *whitehole_get_stats(struct net_device *dev)
{
struct net_device_stats *stats = (struct net_device_stats *) dev->priv;
return stats;
}
int __init whitehole_init(struct net_device *dev)
{
dev->priv = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
if (dev->priv == NULL)
return -ENOBUFS;
memset(dev->priv, 0, sizeof(struct net_device_stats));
dev->get_stats = whitehole_get_stats;
dev->hard_start_xmit = whitehole_xmit;
dev->open = whitehole_open;
dev->stop = whitehole_close;
ether_setup(dev);
dev->tx_queue_len = 0;
dev->flags |= IFF_NOARP;
dev->flags &= ~(IFF_BROADCAST|IFF_MULTICAST);
dev->iflink = 0;
whitehole_iph.ihl = 5;
whitehole_iph.version = 4;
whitehole_iph.ttl = 2;
whitehole_iph.saddr = in_aton("193.233.7.21");
whitehole_iph.daddr = in_aton("193.233.7.10");
whitehole_iph.tot_len = htons(20);
whitehole_iph.check = ip_compute_csum((void *)&whitehole_iph, 20);
return 0;
}
int net_profile_register(struct net_profile_slot *slot)
{
cli();
slot->next = net_profile_chain;
net_profile_chain = slot;
sti();
return 0;
}
int net_profile_unregister(struct net_profile_slot *slot)
{
struct net_profile_slot **sp, *s;
for (sp = &net_profile_chain; (s = *sp) != NULL; sp = &s->next) {
if (s == slot) {
cli();
*sp = s->next;
sti();
return 0;
}
}
return -ESRCH;
}
int __init net_profile_init(void)
{
int i;
#ifdef CONFIG_PROC_FS
create_proc_read_entry("net/profile", 0, 0, profile_read_proc, NULL);
#endif
register_netdevice(&whitehole_dev);
printk("Evaluating net profiler cost ...");
#ifdef __alpha__
alpha_tick(0);
#endif
for (i=0; i<1024; i++) {
NET_PROFILE_ENTER(total);
NET_PROFILE_LEAVE(total);
}
if (net_prof_total.accumulator.tv_sec) {
printk(" too high!\n");
} else {
net_profile_adjust.tv_usec = net_prof_total.accumulator.tv_usec>>10;
printk("%ld units\n", net_profile_adjust.tv_usec);
}
net_prof_total.hits = 0;
net_profile_stamp(&net_prof_total.entered);
return 0;
}
#endif
......@@ -35,7 +35,6 @@
#include <linux/string.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/sysctl.h>
......
......@@ -31,7 +31,6 @@
#include <linux/proc_fs.h>
#include <linux/timer.h>
#include <linux/swap.h>
#include <linux/proc_fs.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
......
......@@ -150,8 +150,7 @@ list_conntracks(char *buffer, char **start, off_t offset, int length)
}
/* Now iterate through expecteds. */
for (e = ip_conntrack_expect_list.next;
e != &ip_conntrack_expect_list; e = e->next) {
list_for_each(e, &ip_conntrack_expect_list) {
unsigned int last_len;
struct ip_conntrack_expect *expect
= (struct ip_conntrack_expect *)e;
......@@ -319,7 +318,7 @@ int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto)
struct list_head *i;
WRITE_LOCK(&ip_conntrack_lock);
for (i = protocol_list.next; i != &protocol_list; i = i->next) {
list_for_each(i, &protocol_list) {
if (((struct ip_conntrack_protocol *)i)->proto
== proto->proto) {
ret = -EBUSY;
......
......@@ -157,8 +157,8 @@ in_range(const struct ip_conntrack_tuple *tuple,
continue;
}
if ((mr->range[i].flags & IP_NAT_RANGE_PROTO_SPECIFIED)
&& proto->in_range(&newtuple, IP_NAT_MANIP_SRC,
if (!(mr->range[i].flags & IP_NAT_RANGE_PROTO_SPECIFIED)
|| proto->in_range(&newtuple, IP_NAT_MANIP_SRC,
&mr->range[i].min, &mr->range[i].max))
return 1;
}
......
......@@ -50,7 +50,6 @@
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter_ipv4/ip_nat.h>
#include <linux/netfilter_ipv4/ip_nat_helper.h>
#include <linux/types.h>
#include <linux/ip.h>
#include <net/udp.h>
#include <asm/uaccess.h>
......
......@@ -271,7 +271,7 @@ int ip_nat_protocol_register(struct ip_nat_protocol *proto)
struct list_head *i;
WRITE_LOCK(&ip_nat_lock);
for (i = protos.next; i != &protos; i = i->next) {
list_for_each(i, &protos) {
if (((struct ip_nat_protocol *)i)->protonum
== proto->protonum) {
ret = -EBUSY;
......
......@@ -45,7 +45,6 @@
#include <linux/netlink.h>
#include <linux/netdevice.h>
#include <linux/mm.h>
#include <linux/socket.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netfilter_ipv4/ipt_ULOG.h>
#include <linux/netfilter_ipv4/lockhelp.h>
......
......@@ -1349,64 +1349,65 @@ struct proto udp_prot = {
/* ------------------------------------------------------------------------ */
#ifdef CONFIG_PROC_FS
static __inline__ struct sock *udp_get_bucket(struct seq_file *seq, loff_t *pos)
static struct sock *udp_get_first(struct seq_file *seq)
{
int i;
struct sock *sk;
struct hlist_node *node;
loff_t l = *pos;
struct udp_iter_state *state = seq->private;
for (; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) {
i = 0;
for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) {
struct hlist_node *node;
sk_for_each(sk, node, &udp_hash[state->bucket]) {
if (sk->sk_family != state->family) {
++i;
continue;
}
if (l--) {
++i;
continue;
}
*pos = i;
goto out;
if (sk->sk_family == state->family)
goto found;
}
}
sk = NULL;
out:
found:
return sk;
}
static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk)
{
struct udp_iter_state *state = seq->private;
do {
sk = sk_next(sk);
try_again:
;
} while (sk && sk->sk_family != state->family);
if (!sk && ++state->bucket < UDP_HTABLE_SIZE) {
sk = sk_head(&udp_hash[state->bucket]);
goto try_again;
}
return sk;
}
static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos)
{
struct sock *sk = udp_get_first(seq);
if (sk)
while(pos && (sk = udp_get_next(seq, sk)) != NULL)
--pos;
return pos ? NULL : sk;
}
static void *udp_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&udp_hash_lock);
return *pos ? udp_get_bucket(seq, pos) : (void *)1;
return *pos ? udp_get_idx(seq, *pos-1) : (void *)1;
}
static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct sock *sk;
struct hlist_node *node;
struct udp_iter_state *state;
if (v == (void *)1) {
sk = udp_get_bucket(seq, pos);
goto out;
}
state = seq->private;
sk = v;
sk_for_each_continue(sk, node)
if (sk->sk_family == state->family)
goto out;
if (++state->bucket >= UDP_HTABLE_SIZE)
goto out;
if (v == (void *)1)
sk = udp_get_idx(seq, 0);
else
sk = udp_get_next(seq, v);
*pos = 0;
sk = udp_get_bucket(seq, pos);
out:
++*pos;
return sk;
}
......
......@@ -57,7 +57,6 @@
#include <linux/delay.h>
#include <linux/notifier.h>
#include <linux/proc_fs.h>
#include <net/sock.h>
#include <net/snmp.h>
......
......@@ -40,7 +40,6 @@
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
#include <linux/version.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
......
......@@ -28,7 +28,6 @@
#include <linux/module.h>
#include <net/inet_ecn.h>
#include <net/ip.h>
#include <net/xfrm.h>
#include <net/ah.h>
#include <linux/crypto.h>
#include <linux/pfkeyv2.h>
......
......@@ -968,7 +968,7 @@ int netlink_post(int unit, struct sk_buff *skb)
#ifdef CONFIG_PROC_FS
static struct sock *netlink_seq_socket_idx(struct seq_file *seq, loff_t pos)
{
int i;
long i;
struct sock *s;
struct hlist_node *node;
loff_t off = 0;
......@@ -1002,7 +1002,7 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos)
s = sk_next(v);
if (!s) {
int i = (int) seq->private;
long i = (long)seq->private;
while (++i < MAX_LINKS) {
s = sk_head(&nl_table[i]);
......
......@@ -14,7 +14,6 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/sysctl.h>
#include <linux/config.h>
#include <rxrpc/types.h>
#include <rxrpc/rxrpc.h>
#include <asm/errno.h>
......
......@@ -20,7 +20,6 @@
#include <linux/proc_fs.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/svcsock.h>
#include <linux/init.h>
#define RPCDBG_FACILITY RPCDBG_MISC
......
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