summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 17:52:29 -0800
committerLinus Torvalds <torvalds@athlon.transmeta.com>2002-02-04 17:52:29 -0800
commitbaf4e2cf9dddbc39fdb7dde6e3f9ebc107b67b78 (patch)
treeb11a69e0dda62c40b231ae748138ce7908d9cade /drivers/net
parent6805de5d7eb97f6e905b152b2fc1ee03fd0fb3aa (diff)
v2.4.0.9 -> v2.4.0.10
- got a few too-new R128 #defines in the Radeon merge. Fix. - tulip driver update from Jeff Garzik - more cpq and DAC elevator fixes from Jens. Looks good. - Petr Vandrovec: nicer ncpfs behaviour - Andy Grover: APCI update - Cort Dougan: PPC update - David Miller: sparc updates - David Miller: networking updates - Neil Brown: RAID5 fixes
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/hamradio/mkiss.c2
-rw-r--r--drivers/net/hamradio/scc.c4
-rw-r--r--drivers/net/myri_sbus.c10
-rw-r--r--drivers/net/pppoe.c37
-rw-r--r--drivers/net/sunbmac.c61
-rw-r--r--drivers/net/tulip/ChangeLog36
-rw-r--r--drivers/net/tulip/eeprom.c12
-rw-r--r--drivers/net/tulip/media.c6
-rw-r--r--drivers/net/tulip/tulip_core.c2
-rw-r--r--drivers/net/wan/lapbether.c172
-rw-r--r--drivers/net/wan/lmc/lmc.h3
-rw-r--r--drivers/net/wan/lmc/lmc_media.h3
-rw-r--r--drivers/net/wan/lmc/lmc_prot.h3
-rw-r--r--drivers/net/wan/lmc/lmc_proto.h3
-rw-r--r--drivers/net/wan/sdla.c2
15 files changed, 172 insertions, 184 deletions
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index 7dab437e6796..3ec09be5a737 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -153,7 +153,7 @@ static int check_crc_flex(unsigned char *cp, int size)
/* Find a free channel, and link in this `tty' line. */
static inline struct ax_disp *ax_alloc(void)
{
- ax25_ctrl_t *axp;
+ ax25_ctrl_t *axp=NULL;
int i;
for (i = 0; i < ax25_maxdev; i++) {
diff --git a/drivers/net/hamradio/scc.c b/drivers/net/hamradio/scc.c
index d65fddc415e0..cc31e9e3011f 100644
--- a/drivers/net/hamradio/scc.c
+++ b/drivers/net/hamradio/scc.c
@@ -136,7 +136,7 @@
/* ----------------------------------------------------------------------- */
-#undef SCC_LDELAY 1 /* slow it even a bit more down */
+#undef SCC_LDELAY /* slow it even a bit more down */
#undef SCC_DONT_CHECK /* don't look if the SCCs you specified are available */
#define SCC_MAXCHIPS 4 /* number of max. supported chips */
@@ -1776,7 +1776,7 @@ static int scc_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
if (hwcfg.vector_latch) {
if (!request_region(Vector_Latch, 1, "scc vector latch"))
- printk(KERN_WARNING "z8530drv: warning, cannot reserve vector latch port 0x%x\n, disabled.", hwcfg.vector_latch);
+ printk(KERN_WARNING "z8530drv: warning, cannot reserve vector latch port 0x%x\n, disabled.", (unsigned int)hwcfg.vector_latch);
else
Vector_Latch = hwcfg.vector_latch;
}
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index ba9c60250d45..56ca24689517 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -892,6 +892,9 @@ static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev,
DET(("myri_ether_init(%p,%p,%d):\n", dev, sdev, num));
dev = init_etherdev(0, sizeof(struct myri_eth));
+ if (!dev)
+ return -ENOMEM;
+
if (version_printed++ == 0)
printk(version);
@@ -982,7 +985,7 @@ static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev,
mp->reg_size, "MyriCOM Regs");
if (!mp->regs) {
printk("MyriCOM: Cannot map MyriCOM registers.\n");
- return -ENODEV;
+ goto err;
}
mp->lanai = (unsigned short *) (mp->regs + (256 * 1024));
mp->lanai3 = (unsigned int *) mp->lanai;
@@ -1059,7 +1062,7 @@ static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev,
if (request_irq(dev->irq, &myri_interrupt,
SA_SHIRQ, "MyriCOM Ethernet", (void *) dev)) {
printk("MyriCOM: Cannot register interrupt handler.\n");
- return -ENODEV;
+ goto err;
}
DET(("ether_setup()\n"));
@@ -1083,6 +1086,9 @@ static int __init myri_ether_init(struct net_device *dev, struct sbus_dev *sdev,
root_myri_dev = mp;
#endif
return 0;
+err: unregister_netdev(dev);
+ kfree(dev);
+ return -ENODEV;
}
static int __init myri_sbus_match(struct sbus_dev *sdev)
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 8744f6186457..1cdec0a45faf 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -5,23 +5,24 @@
* PPPoE --- PPP over Ethernet (RFC 2516)
*
*
- * Version: 0.6.4
+ * Version: 0.6.5
*
* 030700 : Fixed connect logic to allow for disconnect.
- * 270700 : Fixed potential SMP problems; we must protect against
- * simultaneous invocation of ppp_input
+ * 270700 : Fixed potential SMP problems; we must protect against
+ * simultaneous invocation of ppp_input
* and ppp_unregister_channel.
* 040800 : Respect reference count mechanisms on net-devices.
* 200800 : fix kfree(skb) in pppoe_rcv (acme)
* Module reference count is decremented in the right spot now,
- * guards against sock_put not actually freeing the sk
+ * guards against sock_put not actually freeing the sk
* in pppoe_release.
* 051000 : Initialization cleanup.
* 111100 : Fix recvmsg.
+ * 050101 : Fix PADT procesing.
*
* Author: Michal Ostrowski <mostrows@styx.uwaterloo.ca>
* Contributors:
- * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+ * Arnaldo Carvalho de Melo <acme@xconectiva.com.br>
*
* License:
* This program is free software; you can redistribute it and/or
@@ -110,7 +111,7 @@ static int hash_item(unsigned long sid, unsigned char *addr)
hash ^= sid >> (i*PPPOE_HASH_BITS);
return hash & ( PPPOE_HASH_SIZE - 1 );
-}
+}
static struct pppox_opt *item_hash_table[PPPOE_HASH_SIZE] = { 0, };
@@ -238,7 +239,7 @@ static int pppoe_device_event(struct notifier_block *this,
struct net_device *dev = (struct net_device *) ptr;
struct pppox_opt *po = NULL;
int hash = 0;
-
+
/* Only look at sockets that are using this specific device. */
switch (event) {
case NETDEV_CHANGEMTU:
@@ -255,13 +256,13 @@ static int pppoe_device_event(struct notifier_block *this,
po = item_hash_table[hash];
++hash;
}
-
+
while (po && hash < PPPOE_HASH_SIZE){
if(po->pppoe_dev == dev){
lock_sock(po->sk);
if (po->sk->state & (PPPOX_CONNECTED|PPPOX_BOUND)){
pppox_unbind_sock(po->sk);
-
+
dev_put(po->pppoe_dev);
po->pppoe_dev = NULL;
@@ -308,7 +309,7 @@ int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb){
if (sk->state & PPPOX_BOUND) {
skb_pull(skb, sizeof(struct pppoe_hdr));
-
+
ppp_input(&po->chan, skb);
} else if( sk->state & PPPOX_RELAY ){
@@ -318,7 +319,7 @@ int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb){
!( relay_po->sk->state & PPPOX_CONNECTED ) ){
goto abort;
}
-
+
skb_pull(skb, sizeof(struct pppoe_hdr));
if( !__pppoe_xmit( relay_po->sk , skb) ){
goto abort;
@@ -369,7 +370,7 @@ static int pppoe_rcv(struct sk_buff *skb,
}else{
ret = pppoe_rcv_core(sk, skb);
}
-
+
bh_unlock_sock(sk);
sock_put(sk);
return ret;
@@ -466,9 +467,9 @@ static int pppoe_create(struct socket *sock)
{
int error = 0;
struct sock *sk;
-
+
MOD_INC_USE_COUNT;
-
+
sk = sk_alloc(PF_PPPOX, GFP_KERNEL, 1);
if (!sk)
return -ENOMEM;
@@ -528,7 +529,7 @@ int pppoe_release(struct socket *sock)
po = sk->protinfo.pppox;
if (po->pppoe_pa.sid)
delete_item(po->pppoe_pa.sid, po->pppoe_pa.remote);
-
+
if (po->pppoe_dev)
dev_put(po->pppoe_dev);
@@ -945,7 +946,7 @@ int pppoe_proc_info(char *buffer, char **start, off_t offset, int length)
off_t begin = 0;
int size;
int i;
-
+
len += sprintf(buffer,
"Id Address Device\n");
pos = len;
@@ -1025,9 +1026,10 @@ int __init pppoe_init(void)
int err = register_pppox_proto(PX_PROTO_OE, &pppoe_proto);
if (err == 0) {
- printk(KERN_INFO "Registered PPPoE v0.6.4\n");
+ printk(KERN_INFO "Registered PPPoE v0.6.5\n");
dev_add_pack(&pppoes_ptype);
+ dev_add_pack(&pppoed_ptype);
register_netdevice_notifier(&pppoe_notifier);
proc_net_create("pppoe", 0, pppoe_proc_info);
}
@@ -1038,6 +1040,7 @@ void __exit pppoe_exit(void)
{
unregister_pppox_proto(PX_PROTO_OE);
dev_remove_pack(&pppoes_ptype);
+ dev_remove_pack(&pppoed_ptype);
unregister_netdevice_notifier(&pppoe_notifier);
proc_net_remove("pppoe");
}
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
index 3036684f9835..2535485992ad 100644
--- a/drivers/net/sunbmac.c
+++ b/drivers/net/sunbmac.c
@@ -1,12 +1,9 @@
-/* $Id: sunbmac.c,v 1.21 2000/10/22 16:08:38 davem Exp $
+/* $Id: sunbmac.c,v 1.23 2001/01/20 03:36:40 davem Exp $
* sunbmac.c: Driver for Sparc BigMAC 100baseT ethernet adapters.
*
* Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com)
*/
-static char *version =
- "sunbmac.c:v1.9 11/Sep/99 David S. Miller (davem@redhat.com)\n";
-
#include <linux/module.h>
#include <linux/kernel.h>
@@ -41,6 +38,9 @@ static char *version =
#include "sunbmac.h"
+static char version[] __initdata =
+ "sunbmac.c:v1.9 11/Sep/99 David S. Miller (davem@redhat.com)\n";
+
#undef DEBUG_PROBE
#undef DEBUG_TX
#undef DEBUG_IRQ
@@ -1051,10 +1051,10 @@ static void bigmac_set_multicast(struct net_device *dev)
static int __init bigmac_ether_init(struct net_device *dev, struct sbus_dev *qec_sdev)
{
- static int version_printed = 0;
- struct bigmac *bp = 0;
+ static int version_printed;
+ struct bigmac *bp;
u8 bsizes, bsizes_more;
- int i, res = ENOMEM;
+ int i;
/* Get a new device struct for this interface. */
dev = init_etherdev(0, sizeof(struct bigmac));
@@ -1062,6 +1062,9 @@ static int __init bigmac_ether_init(struct net_device *dev, struct sbus_dev *qec
if (version_printed++ == 0)
printk(KERN_INFO "%s", version);
+ if (!dev)
+ return -ENOMEM;
+
/* Report what we have found to the user. */
printk(KERN_INFO "%s: BigMAC 100baseT Ethernet ", dev->name);
dev->base_addr = (long) qec_sdev;
@@ -1077,9 +1080,6 @@ static int __init bigmac_ether_init(struct net_device *dev, struct sbus_dev *qec
spin_lock_init(&bp->lock);
- /* All further failures we find return this. */
- res = ENODEV;
-
/* Verify the registers we expect, are actually there. */
if ((bp->bigmac_sdev->num_registers != 3) ||
(bp->qec_sdev->num_registers != 2)) {
@@ -1205,28 +1205,25 @@ static int __init bigmac_ether_init(struct net_device *dev, struct sbus_dev *qec
fail_and_cleanup:
/* Something went wrong, undo whatever we did so far. */
- if (bp) {
- /* Free register mappings if any. */
- if (bp->gregs)
- sbus_iounmap(bp->gregs, GLOB_REG_SIZE);
- if (bp->creg)
- sbus_iounmap(bp->creg, CREG_REG_SIZE);
- if (bp->bregs)
- sbus_iounmap(bp->bregs, BMAC_REG_SIZE);
- if (bp->tregs)
- sbus_iounmap(bp->tregs, TCVR_REG_SIZE);
-
- if (bp->bmac_block)
- sbus_free_consistent(bp->bigmac_sdev,
- PAGE_SIZE,
- bp->bmac_block,
- bp->bblock_dvma);
-
- /* Free the BigMAC softc. */
- kfree(bp);
- dev->priv = 0;
- }
- return res; /* Return error code. */
+ /* Free register mappings if any. */
+ if (bp->gregs)
+ sbus_iounmap(bp->gregs, GLOB_REG_SIZE);
+ if (bp->creg)
+ sbus_iounmap(bp->creg, CREG_REG_SIZE);
+ if (bp->bregs)
+ sbus_iounmap(bp->bregs, BMAC_REG_SIZE);
+ if (bp->tregs)
+ sbus_iounmap(bp->tregs, TCVR_REG_SIZE);
+
+ if (bp->bmac_block)
+ sbus_free_consistent(bp->bigmac_sdev,
+ PAGE_SIZE,
+ bp->bmac_block,
+ bp->bblock_dvma);
+
+ unregister_netdev(dev);
+ kfree(dev);
+ return -ENODEV;
}
/* QEC can be the parent of either QuadEthernet or
diff --git a/drivers/net/tulip/ChangeLog b/drivers/net/tulip/ChangeLog
index dfac943492b9..bb5b70f019d5 100644
--- a/drivers/net/tulip/ChangeLog
+++ b/drivers/net/tulip/ChangeLog
@@ -1,7 +1,37 @@
-2000-12-17 Alan Cox <alan@redhat.com>
+2001-01-16 Jeff Garzik <jgarzik@mandrakesoft.com>
- * merge support for the Davicom's quirks into the main tulip. Patch
- by Tobias Ringstrom
+ * tulip_core.c: static vars no longer explicitly
+ initialized to zero.
+ * eeprom.c (tulip_read_eeprom): Make sure to delay between
+ EE_ENB and EE_ENB|EE_SHIFT_CLK. Merged from becker tulip.c.
+
+2001-01-05 Peter De Schrijver <p2@mind.be>
+
+ * eeprom.c (tulip_parse_eeprom): Interpret a bit more of 21142
+ extended format type 3 info blocks in a tulip SROM.
+
+2001-01-03 Matti Aarnio <matti.aarnio@zmailer.org>
+
+ * media.c (tulip_select_media): Support media types 5 and 6
+
+2001-??-?? ??
+
+ * tulip_core.c: Add comment about LanMedia needing
+ a different driver.
+ Enable workarounds for early PCI chipsets.
+ Add IA64 csr0 support, update HPPA csr0 support.
+
+2000-12-17 Alan Cox <alan@redhat.com>
+
+ * eeprom.c, timer.c, tulip.h, tulip_core.c: Merge support
+ for the Davicom's quirks into the main tulip.
+ Patch by Tobias Ringstrom
+
+2000-11-08 Jim Studt <jim@federated.com>
+
+ * eeprom.c (tulip_parse_eeprom): Check array bounds for
+ medianame[] and block_name[] arrays to avoid oops due
+ to bad values returned from hardware.
2000-11-02 Jeff Garzik <jgarzik@mandrakesoft.com>
diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c
index 49e8bf42e772..f42baefc2ac3 100644
--- a/drivers/net/tulip/eeprom.c
+++ b/drivers/net/tulip/eeprom.c
@@ -207,8 +207,13 @@ subsequent_board:
p += (p[0] & 0x3f) + 1;
continue;
} else if (p[1] & 1) {
+ int gpr_len, reset_len;
+
mtable->has_mii = 1;
leaf->media = 11;
+ gpr_len=p[3]*2;
+ reset_len=p[4+gpr_len]*2;
+ new_advertise |= get_u16(&p[7+gpr_len+reset_len]);
} else {
mtable->has_nonmii = 1;
leaf->media = p[2] & 0x0f;
@@ -247,9 +252,9 @@ subsequent_board:
}
printk(KERN_INFO "%s: Index #%d - Media %s (#%d) described "
"by a %s (%d) block.\n",
- dev->name, i, medianame[leaf->media], leaf->media,
- leaf->type >= ARRAY_SIZE(block_name) ? "UNKNOWN" :
- block_name[leaf->type], leaf->type);
+ dev->name, i, medianame[leaf->media & 15], leaf->media,
+ leaf->type < ARRAY_SIZE(block_name) ? block_name[leaf->type] : "<unknown>",
+ leaf->type);
}
if (new_advertise)
tp->to_advertise = new_advertise;
@@ -278,6 +283,7 @@ int __devinit tulip_read_eeprom(long ioaddr, int location, int addr_len)
retval = (retval << 1) | ((inl(ee_addr) & EE_DATA_READ) ? 1 : 0);
}
outl(EE_ENB, ee_addr);
+ eeprom_delay();
for (i = 16; i > 0; i--) {
outl(EE_ENB | EE_SHIFT_CLK, ee_addr);
diff --git a/drivers/net/tulip/media.c b/drivers/net/tulip/media.c
index b8203f33a6fd..bc8e7bbbcb6b 100644
--- a/drivers/net/tulip/media.c
+++ b/drivers/net/tulip/media.c
@@ -148,7 +148,7 @@ void tulip_select_media(struct net_device *dev, int startup)
long ioaddr = dev->base_addr;
struct tulip_private *tp = (struct tulip_private *)dev->priv;
struct mediatable *mtable = tp->mtable;
- u32 new_csr6;
+ u32 new_csr6=0;
int i;
if (mtable) {
@@ -265,7 +265,9 @@ void tulip_select_media(struct net_device *dev, int startup)
}
case 5: case 6: {
u16 setup[5];
- u32 csr13val, csr14val, csr15dir, csr15val;
+
+ new_csr6 = 0; /* FIXME */
+
for (i = 0; i < 5; i++)
setup[i] = get_u16(&p[i*2 + 1]);
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index 765cd6c7cdde..0517b90af83c 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -28,7 +28,7 @@
#include <asm/unaligned.h>
static char version[] __devinitdata =
- "Linux Tulip driver version 0.9.13 (January 2, 2001)\n";
+ "Linux Tulip driver version 0.9.13a (January 20, 2001)\n";
/* A few user-configurable values. */
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index eaba0cd3415f..3f23aec1c1a7 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -45,25 +45,10 @@
#include <linux/lapb.h>
#include <linux/init.h>
-static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
-
-static int lapbeth_rcv(struct sk_buff *, struct net_device *, struct packet_type *);
-static int lapbeth_device_event(struct notifier_block *, unsigned long, void *);
-
-static struct packet_type lapbeth_packet_type = {
- 0, /* ntohs(ETH_P_DEC),*/
- 0, /* copy */
- lapbeth_rcv,
- NULL,
- NULL,
-};
-
-static struct notifier_block lapbeth_dev_notifier = {
- lapbeth_device_event,
- 0
-};
-
+static char bcast_addr[6] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
+/* If this number is made larger, check that the temporary string buffer
+ * in lapbeth_new_device is large enough to store the probe device name.*/
#define MAXLAPBDEV 100
static struct lapbethdev {
@@ -72,29 +57,14 @@ static struct lapbethdev {
struct net_device *ethdev; /* link to ethernet device */
struct net_device axdev; /* lapbeth device (lapb#) */
struct net_device_stats stats; /* some statistics */
-} *lapbeth_devices = NULL;
-
+} *lapbeth_devices /* = NULL initially */;
/* ------------------------------------------------------------------------ */
-
-/*
- * Get the ethernet device for a LAPB device
- */
-#if 0
-static __inline__ struct net_device *lapbeth_get_ether_dev(struct net_device *dev)
-{
- struct lapbethdev *lapbeth;
-
- lapbeth = (struct lapbethdev *)dev->priv;
-
- return (lapbeth != NULL) ? lapbeth->ethdev : NULL;
-}
-#endif
/*
* Get the LAPB device for the ethernet device
*/
-static __inline__ struct net_device *lapbeth_get_x25_dev(struct net_device *dev)
+static inline struct net_device *lapbeth_get_x25_dev(struct net_device *dev)
{
struct lapbethdev *lapbeth;
@@ -105,7 +75,7 @@ static __inline__ struct net_device *lapbeth_get_x25_dev(struct net_device *dev)
return NULL;
}
-static __inline__ int dev_is_ethdev(struct net_device *dev)
+static inline int dev_is_ethdev(struct net_device *dev)
{
return (
dev->type == ARPHRD_ETHER
@@ -122,7 +92,7 @@ static int lapbeth_check_devices(struct net_device *dev)
struct lapbethdev *lapbeth, *lapbeth_prev;
int result = 0;
unsigned long flags;
-
+
save_flags(flags);
cli();
@@ -134,7 +104,7 @@ static int lapbeth_check_devices(struct net_device *dev)
lapbeth_prev->next = lapbeth->next;
else
lapbeth_devices = lapbeth->next;
-
+
if (&lapbeth->axdev == dev)
result = 1;
@@ -145,16 +115,14 @@ static int lapbeth_check_devices(struct net_device *dev)
lapbeth_prev = lapbeth;
}
-
+
restore_flags(flags);
-
+
return result;
}
-
/* ------------------------------------------------------------------------ */
-
/*
* Receive a LAPB frame via an ethernet interface.
*/
@@ -164,7 +132,7 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
struct lapbethdev *lapbeth;
skb->sk = NULL; /* Initially we don't know who it's for */
-
+
dev = lapbeth_get_x25_dev(dev);
if (dev == NULL || !netif_running(dev)) {
@@ -172,7 +140,7 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
return 0;
}
- lapbeth = (struct lapbethdev *)dev->priv;
+ lapbeth = (struct lapbethdev *) dev->priv;
lapbeth->stats.rx_packets++;
@@ -191,7 +159,7 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
static int lapbeth_data_indication(void *token, struct sk_buff *skb)
{
- struct lapbethdev *lapbeth = (struct lapbethdev *)token;
+ struct lapbethdev *lapbeth = (struct lapbethdev *) token;
unsigned char *ptr;
ptr = skb_push(skb, 1);
@@ -206,14 +174,12 @@ static int lapbeth_data_indication(void *token, struct sk_buff *skb)
}
/*
- * Send a LAPB frame via an ethernet interface
+ * Send a LAPB frame via an ethernet interface
*/
static int lapbeth_xmit(struct sk_buff *skb, struct net_device *dev)
{
- struct lapbethdev *lapbeth;
+ struct lapbethdev *lapbeth = (struct lapbethdev *) dev->priv;
int err;
-
- lapbeth = (struct lapbethdev *)dev->priv;
/*
* Just to be *really* sure not to send anything if the interface
@@ -253,10 +219,10 @@ static int lapbeth_xmit(struct sk_buff *skb, struct net_device *dev)
return 0;
}
-
+
static void lapbeth_data_transmit(void *token, struct sk_buff *skb)
{
- struct lapbethdev *lapbeth = (struct lapbethdev *)token;
+ struct lapbethdev *lapbeth = (struct lapbethdev *) token;
unsigned char *ptr;
struct net_device *dev;
int size;
@@ -281,7 +247,7 @@ static void lapbeth_data_transmit(void *token, struct sk_buff *skb)
static void lapbeth_connected(void *token, int reason)
{
- struct lapbethdev *lapbeth = (struct lapbethdev *)token;
+ struct lapbethdev *lapbeth = (struct lapbethdev *) token;
struct sk_buff *skb;
unsigned char *ptr;
@@ -303,7 +269,7 @@ static void lapbeth_connected(void *token, int reason)
static void lapbeth_disconnected(void *token, int reason)
{
- struct lapbethdev *lapbeth = (struct lapbethdev *)token;
+ struct lapbethdev *lapbeth = (struct lapbethdev *) token;
struct sk_buff *skb;
unsigned char *ptr;
@@ -328,10 +294,7 @@ static void lapbeth_disconnected(void *token, int reason)
*/
static struct net_device_stats *lapbeth_get_stats(struct net_device *dev)
{
- struct lapbethdev *lapbeth;
-
- lapbeth = (struct lapbethdev *)dev->priv;
-
+ struct lapbethdev *lapbeth = (struct lapbethdev *) dev->priv;
return &lapbeth->stats;
}
@@ -340,18 +303,11 @@ static struct net_device_stats *lapbeth_get_stats(struct net_device *dev)
*/
static int lapbeth_set_mac_address(struct net_device *dev, void *addr)
{
- struct sockaddr *sa = (struct sockaddr *)addr;
-
+ struct sockaddr *sa = (struct sockaddr *) addr;
memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
-
return 0;
}
-static int lapbeth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
-{
- return -EINVAL;
-}
-
/*
* open/close a device
*/
@@ -363,8 +319,8 @@ static int lapbeth_open(struct net_device *dev)
if (lapbeth_check_devices(dev))
return -ENODEV; /* oops, it's gone */
-
- lapbeth = (struct lapbethdev *)dev->priv;
+
+ lapbeth = (struct lapbethdev *) dev->priv;
lapbeth_callbacks.connect_confirmation = lapbeth_connected;
lapbeth_callbacks.connect_indication = lapbeth_connected;
@@ -378,31 +334,20 @@ static int lapbeth_open(struct net_device *dev)
return -ENODEV;
}
- MOD_INC_USE_COUNT;
netif_start_queue(dev);
-
return 0;
}
static int lapbeth_close(struct net_device *dev)
{
- struct lapbethdev *lapbeth;
+ struct lapbethdev *lapbeth = (struct lapbethdev *) dev->priv;
int err;
netif_stop_queue(dev);
-
- lapbeth = (struct lapbethdev *)dev->priv;
if ((err = lapb_unregister(lapbeth)) != LAPB_OK)
printk(KERN_ERR "lapbeth: lapb_unregister error - %d\n", err);
- MOD_DEC_USE_COUNT;
-
- return 0;
-}
-
-static int lapbeth_dev_init(struct net_device *dev)
-{
return 0;
}
@@ -414,14 +359,14 @@ static int lapbeth_dev_init(struct net_device *dev)
static int lapbeth_new_device(struct net_device *dev)
{
int k;
- unsigned char *buf;
+ unsigned char buf[14];
struct lapbethdev *lapbeth, *lapbeth2;
-
+
if ((lapbeth = kmalloc(sizeof(struct lapbethdev), GFP_KERNEL)) == NULL)
return -ENOMEM;
-
+
memset(lapbeth, 0, sizeof(struct lapbethdev));
-
+
dev_hold(dev);
lapbeth->ethdev = dev;
@@ -429,7 +374,7 @@ static int lapbeth_new_device(struct net_device *dev)
strncpy(lapbeth->ethname, dev->name, sizeof(lapbeth->ethname)-1);
dev = &lapbeth->axdev;
- buf = kmalloc(14, GFP_KERNEL);
+ SET_MODULE_OWNER(dev);
for (k = 0; k < MAXLAPBDEV; k++) {
struct net_device *odev;
@@ -445,10 +390,9 @@ static int lapbeth_new_device(struct net_device *dev)
kfree(lapbeth);
return -ENODEV;
}
-
+
dev->priv = (void *)lapbeth; /* pointer back */
strcpy(dev->name, buf);
- dev->init = lapbeth_dev_init;
if (register_netdev(dev) != 0) {
dev_put(dev);
@@ -463,10 +407,6 @@ static int lapbeth_new_device(struct net_device *dev)
dev->stop = lapbeth_close;
dev->set_mac_address = lapbeth_set_mac_address;
dev->get_stats = lapbeth_get_stats;
- dev->do_ioctl = lapbeth_ioctl;
-
- dev->flags = 0;
-
dev->type = ARPHRD_X25;
dev->hard_header_len = 3;
dev->mtu = 1000;
@@ -480,20 +420,19 @@ static int lapbeth_new_device(struct net_device *dev)
for (lapbeth2 = lapbeth_devices; lapbeth2->next != NULL; lapbeth2 = lapbeth2->next);
lapbeth2->next = lapbeth;
}
-
+
sti();
return 0;
}
-
/*
* Handle device status changes.
*/
-static int lapbeth_device_event(struct notifier_block *this,unsigned long event, void *ptr)
+static int lapbeth_device_event(struct notifier_block *this, unsigned long event, void *ptr)
{
- struct net_device *dev = (struct net_device *)ptr;
-
+ struct net_device *dev = (struct net_device *) ptr;
+
if (!dev_is_ethdev(dev))
return NOTIFY_DONE;
@@ -518,23 +457,28 @@ static int lapbeth_device_event(struct notifier_block *this,unsigned long event,
return NOTIFY_DONE;
}
-
/* ------------------------------------------------------------------------ */
-/*
- * Initialize driver. To be called from af_ax25 if not compiled as a
- * module
- */
-int lapbeth_init(void)
+static struct packet_type lapbeth_packet_type = {
+ type: __constant_htons(ETH_P_DEC),
+ func: lapbeth_rcv,
+};
+
+static struct notifier_block lapbeth_dev_notifier = {
+ notifier_call: lapbeth_device_event,
+};
+
+static const char banner[] __initdata = KERN_INFO "LAPB Ethernet driver version 0.01\n";
+
+static int __init lapbeth_init_driver(void)
{
struct net_device *dev;
- lapbeth_packet_type.type = htons(ETH_P_DEC);
dev_add_pack(&lapbeth_packet_type);
register_netdevice_notifier(&lapbeth_dev_notifier);
- printk(KERN_INFO "LAPB Ethernet driver version 0.01\n");
+ printk(banner);
read_lock_bh(&dev_base_lock);
for (dev = dev_base; dev != NULL; dev = dev->next) {
@@ -548,19 +492,9 @@ int lapbeth_init(void)
return 0;
}
+module_init(lapbeth_init_driver);
-#ifdef MODULE
-EXPORT_NO_SYMBOLS;
-
-MODULE_AUTHOR("Jonathan Naylor <g4klx@g4klx.demon.co.uk>");
-MODULE_DESCRIPTION("The unofficial LAPB over Ethernet driver");
-
-int init_module(void)
-{
- return lapbeth_init();
-}
-
-void cleanup_module(void)
+static void __exit lapbeth_cleanup_driver(void)
{
struct lapbethdev *lapbeth;
@@ -571,4 +505,10 @@ void cleanup_module(void)
for (lapbeth = lapbeth_devices; lapbeth != NULL; lapbeth = lapbeth->next)
unregister_netdev(&lapbeth->axdev);
}
-#endif
+module_exit(lapbeth_cleanup_driver);
+
+EXPORT_NO_SYMBOLS;
+
+MODULE_AUTHOR("Jonathan Naylor <g4klx@g4klx.demon.co.uk>");
+MODULE_DESCRIPTION("The unofficial LAPB over Ethernet driver");
+
diff --git a/drivers/net/wan/lmc/lmc.h b/drivers/net/wan/lmc/lmc.h
index 91b9e8f00ee1..882e58c1bfd7 100644
--- a/drivers/net/wan/lmc/lmc.h
+++ b/drivers/net/wan/lmc/lmc.h
@@ -29,4 +29,5 @@ extern lmc_media_t lmc_hssi_media;
static void lmcEventLog( u_int32_t EventNum, u_int32_t arg2, u_int32_t arg3 );
#endif
-#endif \ No newline at end of file
+#endif
+
diff --git a/drivers/net/wan/lmc/lmc_media.h b/drivers/net/wan/lmc/lmc_media.h
index 7cc6c1650ffc..ddcc00403563 100644
--- a/drivers/net/wan/lmc/lmc_media.h
+++ b/drivers/net/wan/lmc/lmc_media.h
@@ -61,4 +61,5 @@ lmc_media_t lmc_t1_media = {
};
-#endif \ No newline at end of file
+#endif
+
diff --git a/drivers/net/wan/lmc/lmc_prot.h b/drivers/net/wan/lmc/lmc_prot.h
index 859ef0f006a1..f3b1df9e2cdb 100644
--- a/drivers/net/wan/lmc/lmc_prot.h
+++ b/drivers/net/wan/lmc/lmc_prot.h
@@ -11,4 +11,5 @@ void lmc_proto_close(lmc_softc_t *sc const)
unsigned short lmc_proto_type(lmc_softc_t *sc const, struct skbuff *skb)
-#endif \ No newline at end of file
+#endif
+
diff --git a/drivers/net/wan/lmc/lmc_proto.h b/drivers/net/wan/lmc/lmc_proto.h
index 6136dfad7516..080a55773349 100644
--- a/drivers/net/wan/lmc/lmc_proto.h
+++ b/drivers/net/wan/lmc/lmc_proto.h
@@ -12,4 +12,5 @@ unsigned short lmc_proto_type(lmc_softc_t *sc, struct sk_buff *skb);
void lmc_proto_netif(lmc_softc_t *sc, struct sk_buff *skb);
int lmc_skb_rawpackets(char *buf, char **start, off_t offset, int len, int unused);
-#endif \ No newline at end of file
+#endif
+
diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
index ef489b1a687f..1eb66b44e7cd 100644
--- a/drivers/net/wan/sdla.c
+++ b/drivers/net/wan/sdla.c
@@ -744,7 +744,7 @@ static void sdla_receive(struct net_device *dev)
struct buf_entry *pbuf;
unsigned long flags;
- int i, received, success, addr, buf_base, buf_top;
+ int i=0, received, success, addr, buf_base, buf_top;
short dlci, len, len2, split;
flp = dev->priv;