summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-06-15 01:55:58 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-06-15 01:55:58 +0000
commit53b3988d474435254a3b053a68bb24ce9e439295 (patch)
treef8da8e40f01f4ad02bbd76b8c9920749b118235f /drivers/net
parentb0cb48abe83d1a4389ea938bf624f8baa82c5047 (diff)
Merge with 2.3.99-pre9.
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/3c59x.c2
-rw-r--r--drivers/net/8139too.c107
-rw-r--r--drivers/net/Config.in5
-rw-r--r--drivers/net/Makefile2
-rw-r--r--drivers/net/Space.c22
-rw-r--r--drivers/net/acenic.c2
-rw-r--r--drivers/net/am79c961a.c235
-rw-r--r--drivers/net/arcnet/arc-rimi.c5
-rw-r--r--drivers/net/arcnet/com20020-isa.c5
-rw-r--r--drivers/net/arcnet/com20020-pci.c4
-rw-r--r--drivers/net/arcnet/com90io.c5
-rw-r--r--drivers/net/arcnet/com90xx.c5
-rw-r--r--drivers/net/eepro100.c2
-rw-r--r--drivers/net/epic100.c2
-rw-r--r--drivers/net/hp100.c16
-rw-r--r--drivers/net/ncr885e.c2
-rw-r--r--drivers/net/ne2k-pci.c2
-rw-r--r--drivers/net/pcnet32.c4
-rw-r--r--drivers/net/ppp_synctty.c12
-rw-r--r--drivers/net/pppoe.c83
-rw-r--r--drivers/net/setup.c23
-rw-r--r--drivers/net/sis900.c3
-rw-r--r--drivers/net/slhc.c7
-rw-r--r--drivers/net/starfire.c2
-rw-r--r--drivers/net/stnic.c302
-rw-r--r--drivers/net/tulip/tulip_core.c2
-rw-r--r--drivers/net/via-rhine.c2
-rw-r--r--drivers/net/wan/comx-hw-comx.c12
-rw-r--r--drivers/net/wan/comx-hw-locomx.c8
-rw-r--r--drivers/net/wan/comx-hw-mixcom.c10
-rw-r--r--drivers/net/wan/comx-proto-fr.c9
-rw-r--r--drivers/net/wan/comx-proto-lapb.c6
-rw-r--r--drivers/net/wan/comx.c127
-rw-r--r--drivers/net/wan/lmc/lmc_main.c2
-rw-r--r--drivers/net/wavelan.c1
-rw-r--r--drivers/net/wavelan.p.h2
-rw-r--r--drivers/net/yellowfin.c2
37 files changed, 623 insertions, 419 deletions
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index c5fcec9bc..d90732d8a 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -423,7 +423,7 @@ static struct pci_device_id vortex_pci_tbl[] __devinitdata = {
{ 0x10B7, 0x6560, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3CCFE656 },
{ 0x10B7, 0x6562, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3CCFEM656 },
{ 0x10B7, 0x4500, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_3C450 },
- {0,}, /* 0 terminated list. */
+ {0,} /* 0 terminated list. */
};
MODULE_DEVICE_TABLE(pci, vortex_pci_tbl);
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 9a5b25038..c1b970143 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -24,6 +24,15 @@
Daniel Kobras - identified specific locations of
posted MMIO write bugginess
+ Gerard Sharp - bug fix
+
+ Submitting bug reports:
+
+ "rtl8139-diag -mmmaaavvveefN" output
+ enable RTL8139_DEBUG below, and look at 'dmesg' or kernel log
+
+ See 8139too.txt for more details.
+
-----------------------------------------------------------------------------
Theory of Operation
@@ -88,7 +97,7 @@ an MMIO register read.
#include <asm/io.h>
-#define RTL8139_VERSION "0.9.4.1"
+#define RTL8139_VERSION "0.9.5"
#define RTL8139_MODULE_NAME "8139too"
#define RTL8139_DRIVER_NAME RTL8139_MODULE_NAME " Fast Ethernet driver " RTL8139_VERSION
#define PFX RTL8139_MODULE_NAME ": "
@@ -201,7 +210,7 @@ static struct pci_device_id rtl8139_pci_tbl[] __devinitdata = {
/* {0x1113, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MPX5030 },*/
{0x1500, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DELTA8139 },
{0x4033, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ADDTRON8139 },
- {0,},
+ {0,}
};
MODULE_DEVICE_TABLE (pci, rtl8139_pci_tbl);
@@ -304,6 +313,17 @@ enum rx_mode_bits {
AcceptAllPhys = 0x01,
};
+/* Bits in TxConfig. */
+enum tx_config_bits {
+ TxIFG1 = (1 << 25), /* Interframe Gap Time */
+ TxIFG0 = (1 << 24), /* Enabling these bits violates IEEE 802.3 */
+ TxLoopBack = (1 << 18) | (1 << 17), /* enable loopback test mode */
+ TxCRC = (1 << 16), /* DISABLE appending CRC to end of Tx packets */
+ TxClearAbt = (1 << 0), /* Clear abort (WO) */
+
+ TxVersionMask = 0x7C800000, /* mask out version bits 30-26, 23 */
+};
+
/* Bits in Config1 */
enum Config1Bits {
Cfg1_PM_Enable = 0x01,
@@ -369,28 +389,53 @@ struct ring_info {
dma_addr_t mapping;
};
+
typedef enum {
CH_8139 = 0,
CH_8139A,
+ CH_8139A_G,
CH_8139B,
+ CH_8130,
+ CH_8139C,
} chip_t;
+
/* directly indexed by chip_t, above */
const static struct {
const char *name;
+ u32 version; /* from RTL8139C docs */
u32 RxConfigMask; /* should clear the bits supported by this chip */
} rtl_chip_info[] = {
{ "RTL-8139",
+ 0x60000000,
0xf0fe0040, /* XXX copied from RTL8139A, verify */
},
{ "RTL-8139A",
+ 0x70000000,
0xf0fe0040,
},
- { "RTL-8139B(L)",
+ { "RTL-8139A rev. G",
+ 0x70800000,
+ 0xf0fe0040,
+ },
+
+ { "RTL-8139B",
+ 0x78000000,
0xf0fc0040
},
+
+ { "RTL-8130",
+ 0x7C000000,
+ 0xf0fe0040, /* XXX copied from RTL8139A, verify */
+ },
+
+ { "RTL-8139C",
+ 0x74000000,
+ 0xf0fc0040, /* XXX copied from RTL8139B, verify */
+ },
+
};
@@ -574,12 +619,8 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
/* enable device (incl. PCI PM wakeup), and bus-mastering */
rc = pci_enable_device (pdev);
- if (rc) {
- printk (KERN_ERR PFX "cannot enable PCI device (bus %d, "
- "devfn %d), aborting\n",
- pdev->bus->number, pdev->devfn);
+ if (rc)
goto err_out_free_mmio;
- }
pci_set_master (pdev);
@@ -631,15 +672,20 @@ static int __devinit rtl8139_init_board (struct pci_dev *pdev,
}
/* identify chip attached to board */
- tmp = RTL_R32 (TxConfig);
- if (((tmp >> 28) & 7) == 7) {
- if (pio_len == RTL8139B_IO_SIZE)
- tp->chipset = CH_8139B;
- else
- tp->chipset = CH_8139A;
- } else {
- tp->chipset = CH_8139;
- }
+ tmp = RTL_R32 (TxConfig) & TxVersionMask;
+ for (i = arraysize (rtl_chip_info) - 1; i >= 0; i--)
+ if (tmp == rtl_chip_info[i].version) {
+ tp->chipset = i;
+ goto match;
+ }
+
+ /* if unknown chip, assume array element #0, original RTL-8139 in this case */
+ printk (KERN_DEBUG PFX "PCI device %s: unknown chip version, assuming RTL-8139\n",
+ pdev->slot_name);
+ printk (KERN_DEBUG PFX "PCI device %s: TxConfig = 0x%x\n", pdev->slot_name, RTL_R32 (TxConfig));
+ tp->chipset = 0;
+
+match:
DPRINTK ("chipset id (%d/%d/%d) == %d, '%s'\n",
CH_8139,
CH_8139A,
@@ -738,7 +784,7 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
tp->phys[0] = 32;
- printk (KERN_INFO "%s: '%s' board found at 0x%lx, IRQ %d\n",
+ printk (KERN_INFO "%s: %s board found at 0x%lx, IRQ %d\n",
dev->name, board_info[ent->driver_data].name,
dev->base_addr, dev->irq);
@@ -1122,6 +1168,7 @@ static void rtl8139_hw_start (struct net_device *dev)
/* Check this value: the documentation for IFG contradicts ifself. */
RTL_W32 (TxConfig, (TX_DMA_BURST << 8));
+#if 0
/* if link status not ok... */
if ((RTL_R16 (BasicModeStatus) & (1<<2)) == 0) {
printk (KERN_INFO "%s: no link, starting NWay\n", dev->name);
@@ -1144,10 +1191,13 @@ static void rtl8139_hw_start (struct net_device *dev)
/* XXX writing Config1 here is flat out wrong */
/* RTL_W8 (Config1, tp->full_duplex ? 0x60 : 0x20); */
}
+#endif
- tmp = RTL_R8 (Config1) & Config1Clear;
- tmp |= (tp->chipset == CH_8139B) ? 3 : 1; /* Enable PM/VPD */
- RTL_W8_F (Config1, tmp);
+ if (tp->chipset > CH_8139) {
+ tmp = RTL_R8 (Config1) & Config1Clear;
+ tmp |= (tp->chipset == CH_8139B) ? 3 : 1; /* Enable PM/VPD */
+ RTL_W8_F (Config1, tmp);
+ }
if (tp->chipset == CH_8139B) {
tmp = RTL_R8 (Config4) & ~(1<<2);
@@ -1596,13 +1646,19 @@ static void rtl8139_rx_interrupt (struct net_device *dev,
/* A.C.: Reset the multicast list. */
rtl8139_set_rx_mode (dev);
+ /* XXX potentially temporary hack to
+ * restart hung receiver */
while (--tmp_work > 0) {
- tmp8 = RTL_R8 (ChipCmd) & ChipCmdClear;
+ tmp8 = RTL_R8 (ChipCmd);
if ((tmp8 & CmdRxEnb) && (tmp8 & CmdTxEnb))
break;
- RTL_W8_F (ChipCmd, tmp8 | CmdRxEnb | CmdTxEnb);
+ RTL_W8_F (ChipCmd, (tmp8 & ChipCmdClear) | CmdRxEnb | CmdTxEnb);
}
+ /* G.S.: Re-enable receiver */
+ /* XXX temporary hack to work around receiver hang */
+ rtl8139_set_rx_mode (dev);
+
if (tmp_work <= 0)
printk (KERN_WARNING PFX "tx/rx enable wait too long\n");
} else {
@@ -1973,7 +2029,6 @@ static void rtl8139_set_rx_mode (struct net_device *dev)
u32 mc_filter[2]; /* Multicast hash filter */
int i, rx_mode;
u32 tmp;
- unsigned long flags=0;
DPRINTK ("ENTER\n");
@@ -2006,7 +2061,7 @@ static void rtl8139_set_rx_mode (struct net_device *dev)
/* if called from irq handler, lock already acquired */
if (!in_irq ())
- spin_lock_irqsave (&tp->lock, flags);
+ spin_lock_irq (&tp->lock);
/* We can safely update without stopping the chip. */
tmp = rtl8139_rx_config | rx_mode |
@@ -2016,7 +2071,7 @@ static void rtl8139_set_rx_mode (struct net_device *dev)
RTL_W32_F (MAR0 + 4, mc_filter[1]);
if (!in_irq ())
- spin_unlock_irqrestore (&tp->lock, flags);
+ spin_unlock_irq (&tp->lock);
DPRINTK ("EXIT\n");
}
diff --git a/drivers/net/Config.in b/drivers/net/Config.in
index 7aaeb9398..43c9d00af 100644
--- a/drivers/net/Config.in
+++ b/drivers/net/Config.in
@@ -51,6 +51,9 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then
if [ "$CONFIG_SGI_IP27" = "y" ]; then
bool ' SGI IOC3 Ethernet' CONFIG_SGI_IOC3_ETH
fi
+ if [ "$CONFIG_SUPERH" = "y" -a "$CONFIG_SH_SOLUTION_ENGINE" = "y" ]; then
+ tristate ' National DP83902AV support' CONFIG_STNIC
+ fi
bool ' 3COM cards' CONFIG_NET_VENDOR_3COM
if [ "$CONFIG_NET_VENDOR_3COM" = "y" ]; then
tristate ' 3c501 "EtherLink" support' CONFIG_EL1
@@ -218,7 +221,7 @@ if [ ! "$CONFIG_PPP" = "n" ]; then
dep_tristate ' PPP support for async serial ports' CONFIG_PPP_ASYNC $CONFIG_PPP
dep_tristate ' PPP support for sync tty ports' CONFIG_PPP_SYNC_TTY $CONFIG_PPP
dep_tristate ' PPP Deflate compression' CONFIG_PPP_DEFLATE $CONFIG_PPP
- dep_tristate ' PPP BSD-Compress compression' CONFIG_PPP_BSDCOMP
+ dep_tristate ' PPP BSD-Compress compression' CONFIG_PPP_BSDCOMP $CONFIG_PPP
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
dep_tristate ' PPP over Ethernet (EXPERIMENTAL)' CONFIG_PPPOE $CONFIG_PPP
fi
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 3490fd92f..35e8aff80 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -146,6 +146,8 @@ obj-$(CONFIG_DM9102) += dmfe.o
obj-$(CONFIG_YELLOWFIN) += yellowfin.o
obj-$(CONFIG_ACENIC) += acenic.o
+obj-$(CONFIG_STNIC) += stnic.o 8390.o
+
ifeq ($(CONFIG_SK98LIN),y)
SUB_DIRS += sk98lin
obj-y += sk98lin/sk98lin.o
diff --git a/drivers/net/Space.c b/drivers/net/Space.c
index e93a9f70d..57fa9a44e 100644
--- a/drivers/net/Space.c
+++ b/drivers/net/Space.c
@@ -94,10 +94,6 @@ extern int bionet_probe(struct net_device *);
extern int pamsnet_probe(struct net_device *);
extern int cs89x0_probe(struct net_device *dev);
extern int ethertap_probe(struct net_device *dev);
-extern int ether1_probe (struct net_device *dev);
-extern int ether3_probe (struct net_device *dev);
-extern int etherh_probe (struct net_device *dev);
-extern int am79c961_probe(struct net_device *dev);
extern int hplance_probe(struct net_device *dev);
extern int bagetlance_probe(struct net_device *);
extern int mvme147lance_probe(struct net_device *dev);
@@ -393,22 +389,6 @@ struct devprobe mips_probes[] __initdata = {
{NULL, 0},
};
-struct devprobe arm_probes[] __initdata = {
-#ifdef CONFIG_ARM_ETHERH
- {etherh_probe , 0},
-#endif
-#ifdef CONFIG_ARM_ETHER3
- {ether3_probe , 0},
-#endif
-#ifdef CONFIG_ARM_ETHER1
- {ether1_probe , 0},
-#endif
-#ifdef CONFIG_ARM_AM79C961A
- {am79c961_probe, 0},
-#endif
- {NULL, 0},
-};
-
/*
* Unified ethernet device probe, segmented per architecture and
* per bus interface. This drives the legacy devices only for now.
@@ -429,8 +409,6 @@ static int __init ethif_probe(struct net_device *dev)
* 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, arm_probes) == 0)
- return 0;
if (probe_list(dev, m68k_probes) == 0)
return 0;
if (probe_list(dev, mips_probes) == 0)
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 7d53e1260..29d5d7638 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -2966,6 +2966,6 @@ static int __init read_eeprom_byte(struct net_device *dev,
/*
* Local variables:
- * compile-command: "gcc -D__SMP__ -D__KERNEL__ -DMODULE -I../../include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -fno-strength-reduce -DMODVERSIONS -include ../../include/linux/modversions.h -c -o acenic.o acenic.c"
+ * compile-command: "gcc -D__KERNEL__ -DMODULE -I../../include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -fno-strength-reduce -DMODVERSIONS -include ../../include/linux/modversions.h -c -o acenic.o acenic.c"
* End:
*/
diff --git a/drivers/net/am79c961a.c b/drivers/net/am79c961a.c
index c7e7f2fe5..83012de44 100644
--- a/drivers/net/am79c961a.c
+++ b/drivers/net/am79c961a.c
@@ -3,7 +3,10 @@
*
* Derived from various things including skeleton.c
*
- * R.M.King 1995.
+ * Russell King 1995-2000.
+ *
+ * This is a special driver for the am79c961A Lance chip used in the
+ * Intel (formally Digital Equipment Corp) EBSA110 platform.
*/
#include <linux/module.h>
#include <linux/kernel.h>
@@ -21,9 +24,11 @@
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/delay.h>
+#include <linux/init.h>
#include <asm/system.h>
#include <asm/bitops.h>
+#include <asm/irq.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/ecard.h>
@@ -33,26 +38,13 @@
#include "am79c961a.h"
-static int am79c961_probe1 (struct net_device *dev);
-static int am79c961_open (struct net_device *dev);
-static int am79c961_sendpacket (struct sk_buff *skb, struct net_device *dev);
static void am79c961_interrupt (int irq, void *dev_id, struct pt_regs *regs);
static void am79c961_rx (struct net_device *dev, struct dev_priv *priv);
static void am79c961_tx (struct net_device *dev, struct dev_priv *priv);
-static int am79c961_close (struct net_device *dev);
-static struct enet_statistics *am79c961_getstats (struct net_device *dev);
-static void am79c961_setmulticastlist (struct net_device *dev);
-static void am79c961_timeout(struct net_device *dev);
static unsigned int net_debug = NET_DEBUG;
-static void
-am79c961_setmulticastlist (struct net_device *dev);
-
-static char *version = "am79c961 ethernet driver (c) 1995 R.M.King v0.01\n";
-
-#define FUNC_PROLOGUE \
- struct dev_priv *priv = (struct dev_priv *)dev->priv
+static char *version = "am79c961 ethernet driver (c) 1995 R.M.King v0.02\n";
/* --------------------------------------------------------------------------- */
@@ -270,109 +262,6 @@ am79c961_init_for_open(struct net_device *dev)
write_rreg (dev->base_addr, CSR0, CSR0_IENA|CSR0_STRT);
}
-static int
-am79c961_init(struct net_device *dev)
-{
- unsigned long flags;
-
- am79c961_ramtest(dev, 0x66);
- am79c961_ramtest(dev, 0x99);
-
- save_flags_cli (flags);
-
- write_ireg (dev->base_addr, 2, 0x4000); /* autoselect media */
- write_rreg (dev->base_addr, CSR0, CSR0_STOP);
- write_rreg (dev->base_addr, CSR3, CSR3_MASKALL);
-
- restore_flags (flags);
-
- return 0;
-}
-
-/*
- * This is the real probe routine.
- */
-static int
-am79c961_probe1(struct net_device *dev)
-{
- static unsigned version_printed = 0;
- struct dev_priv *priv;
- int i;
-
- if (!dev->priv) {
- dev->priv = kmalloc (sizeof (struct dev_priv), GFP_KERNEL);
- if (!dev->priv)
- return -ENOMEM;
- }
-
- priv = (struct dev_priv *) dev->priv;
- memset (priv, 0, sizeof(struct dev_priv));
-
- /*
- * The PNP initialisation should have been done by the ether bootp loader.
- */
- inb((dev->base_addr + NET_RESET) >> 1); /* reset the device */
-
- udelay (5);
-
- if (inb (dev->base_addr >> 1) != 0x08 ||
- inb ((dev->base_addr >> 1) + 1) != 00 ||
- inb ((dev->base_addr >> 1) + 2) != 0x2b) {
- kfree (dev->priv);
- dev->priv = NULL;
- return -ENODEV;
- }
-
- /*
- * Ok, we've found a valid hw ID
- */
-
- if (net_debug && version_printed++ == 0)
- printk (KERN_INFO "%s", version);
-
- printk(KERN_INFO "%s: am79c961 found [%04lx, %d] ", dev->name, dev->base_addr, dev->irq);
- request_region (dev->base_addr, 0x18, "am79c961");
-
- /* Retrive and print the ethernet address. */
- for (i = 0; i < 6; i++) {
- dev->dev_addr[i] = inb ((dev->base_addr >> 1) + i) & 0xff;
- printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]);
- }
-
- if (am79c961_init(dev)) {
- kfree (dev->priv);
- dev->priv = NULL;
- return -ENODEV;
- }
-
- dev->open = am79c961_open;
- dev->stop = am79c961_close;
- dev->hard_start_xmit = am79c961_sendpacket;
- dev->get_stats = am79c961_getstats;
- dev->set_multicast_list = am79c961_setmulticastlist;
- dev->tx_timeout = am79c961_timeout;
-
- /* Fill in the fields of the device structure with ethernet values. */
- ether_setup(dev);
-
- return 0;
-}
-
-int
-am79c961_probe(struct net_device *dev)
-{
- static int initialised = 0;
-
- if (initialised)
- return -ENODEV;
- initialised = 1;
-
- dev->base_addr = 0x220;
- dev->irq = 3;
-
- return am79c961_probe1(dev);
-}
-
/*
* Open/initialize the board. This is called (in the current kernel)
* sometime after booting when the 'ifconfig' program is run.
@@ -408,9 +297,17 @@ am79c961_open(struct net_device *dev)
static int
am79c961_close(struct net_device *dev)
{
+ unsigned long flags;
+
netif_stop_queue(dev);
- am79c961_init(dev);
+ save_flags_cli (flags);
+
+ write_ireg (dev->base_addr, 2, 0x4000); /* autoselect media */
+ write_rreg (dev->base_addr, CSR0, CSR0_STOP);
+ write_rreg (dev->base_addr, CSR3, CSR3_MASKALL);
+
+ restore_flags (flags);
free_irq (dev->irq, dev);
@@ -709,3 +606,103 @@ am79c961_tx(struct net_device *dev, struct dev_priv *priv)
netif_wake_queue(dev);
}
+
+static int
+am79c961_hw_init(struct net_device *dev)
+{
+ unsigned long flags;
+
+ am79c961_ramtest(dev, 0x66);
+ am79c961_ramtest(dev, 0x99);
+
+ save_flags_cli (flags);
+
+ write_ireg (dev->base_addr, 2, 0x4000); /* autoselect media */
+ write_rreg (dev->base_addr, CSR0, CSR0_STOP);
+ write_rreg (dev->base_addr, CSR3, CSR3_MASKALL);
+
+ restore_flags (flags);
+
+ return 0;
+}
+
+static void __init am79c961_banner(void)
+{
+ static unsigned version_printed = 0;
+
+ if (net_debug && version_printed++ == 0)
+ printk(KERN_INFO "%s", version);
+}
+
+static int __init am79c961_init(void)
+{
+ struct net_device *dev;
+ struct dev_priv *priv;
+ int i, ret;
+
+ dev = init_etherdev(NULL, sizeof(struct dev_priv));
+ ret = -ENOMEM;
+ if (!dev)
+ goto out;
+
+ priv = (struct dev_priv *) dev->priv;
+
+ /*
+ * Fixed address and IRQ lines here.
+ * The PNP initialisation should have been
+ * done by the ether bootp loader.
+ */
+ dev->base_addr = 0x220;
+ dev->irq = IRQ_EBSA110_ETHERNET;
+
+ /*
+ * Reset the device.
+ */
+ inb((dev->base_addr + NET_RESET) >> 1);
+ udelay(5);
+
+ /*
+ * Check the manufacturer part of the
+ * ether address.
+ */
+ ret = -ENODEV;
+ if (inb(dev->base_addr >> 1) != 0x08 ||
+ inb((dev->base_addr >> 1) + 1) != 00 ||
+ inb((dev->base_addr >> 1) + 2) != 0x2b)
+ goto nodev;
+
+ if (!request_region(dev->base_addr, 0x18, dev->name))
+ goto nodev;
+
+ am79c961_banner();
+ printk(KERN_INFO "%s: am79c961 found at %08lx, IRQ%d, ether address ",
+ dev->name, dev->base_addr, dev->irq);
+
+ /* Retrive and print the ethernet address. */
+ for (i = 0; i < 6; i++) {
+ dev->dev_addr[i] = inb((dev->base_addr >> 1) + i) & 0xff;
+ printk (i == 5 ? "%02x\n" : "%02x:", dev->dev_addr[i]);
+ }
+
+ if (am79c961_hw_init(dev))
+ goto release;
+
+ dev->open = am79c961_open;
+ dev->stop = am79c961_close;
+ dev->hard_start_xmit = am79c961_sendpacket;
+ dev->get_stats = am79c961_getstats;
+ dev->set_multicast_list = am79c961_setmulticastlist;
+ dev->tx_timeout = am79c961_timeout;
+
+ return 0;
+
+release:
+ release_region(dev->base_addr, 0x18);
+nodev:
+ unregister_netdev(dev);
+ kfree(dev);
+out:
+ return ret;
+}
+
+module_init(am79c961_init);
diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c
index 02331da24..d36f74aa8 100644
--- a/drivers/net/arcnet/arc-rimi.c
+++ b/drivers/net/arcnet/arc-rimi.c
@@ -345,9 +345,8 @@ static int __init arcrimi_setup(char *s)
s = get_options(s, 8, ints);
if (!ints[0])
return 1;
- dev = alloc_bootmem(sizeof(struct net_device) + 10);
- memset(dev, 0, sizeof(struct net_device) + 10);
- dev->name = (char *) (dev + 1);
+ dev = alloc_bootmem(sizeof(struct net_device));
+ memset(dev, 0, sizeof(struct net_device));
dev->init = arcrimi_probe;
switch (ints[0]) {
diff --git a/drivers/net/arcnet/com20020-isa.c b/drivers/net/arcnet/com20020-isa.c
index 7f8a022bf..936342218 100644
--- a/drivers/net/arcnet/com20020-isa.c
+++ b/drivers/net/arcnet/com20020-isa.c
@@ -194,10 +194,9 @@ static int __init com20020isa_setup(char *s)
s = get_options(s, 8, ints);
if (!ints[0])
return 1;
- dev = alloc_bootmem(sizeof(struct net_device) + sizeof(struct arcnet_local) + 10);
- memset(dev, 0, sizeof(struct net_device) + sizeof(struct arcnet_local) + 10);
+ dev = alloc_bootmem(sizeof(struct net_device) + sizeof(struct arcnet_local));
+ memset(dev, 0, sizeof(struct net_device) + sizeof(struct arcnet_local));
lp = dev->priv = (struct arcnet_local *) (dev + 1);
- dev->name = (char *) (lp + 1);
dev->init = com20020isa_probe;
switch (ints[0]) {
diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index f468f3829..0c92cc4d2 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -139,7 +139,9 @@ static struct pci_device_id com20020pci_id_table[] __devinitdata = {
{0,}
};
-static struct pci_driver com20020pci_driver __devinitdata = {
+MODULE_DEVICE_TABLE(pci, com20020pci_id_table);
+
+static struct pci_driver com20020pci_driver = {
name: "com20020",
id_table: com20020pci_id_table,
probe: com20020pci_probe,
diff --git a/drivers/net/arcnet/com90io.c b/drivers/net/arcnet/com90io.c
index aca9635ae..24ba13ef2 100644
--- a/drivers/net/arcnet/com90io.c
+++ b/drivers/net/arcnet/com90io.c
@@ -428,9 +428,8 @@ static int __init com90io_setup(char *s)
s = get_options(s, 4, ints);
if (!ints[0])
return 0;
- dev = alloc_bootmem(sizeof(struct net_device) + 10);
- memset(dev, 0, sizeof(struct net_device) + 10);
- dev->name = (char *) (dev + 1);
+ dev = alloc_bootmem(sizeof(struct net_device));
+ memset(dev, 0, sizeof(struct net_device));
dev->init = com90io_probe;
switch (ints[0]) {
diff --git a/drivers/net/arcnet/com90xx.c b/drivers/net/arcnet/com90xx.c
index 7293a16f8..97f8d0a41 100644
--- a/drivers/net/arcnet/com90xx.c
+++ b/drivers/net/arcnet/com90xx.c
@@ -677,9 +677,8 @@ static int __init com90xx_setup(char *s)
printk("com90xx: Disabled.\n");
return 1;
}
- dev = alloc_bootmem(sizeof(struct net_device) + 10);
- memset(dev, 0, sizeof(struct net_device) + 10);
- dev->name = (char *) (dev + 1);
+ dev = alloc_bootmem(sizeof(struct net_device));
+ memset(dev, 0, sizeof(struct net_device));
dev->init = com90xx_probe;
switch (ints[0]) {
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index afb6cbfeb..048f7edd1 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -2206,7 +2206,7 @@ static struct pci_device_id eepro100_pci_tbl[] __devinitdata = {
PCI_ANY_ID, PCI_ANY_ID, },
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559ER,
PCI_ANY_ID, PCI_ANY_ID, },
- { 0,},
+ { 0,}
};
MODULE_DEVICE_TABLE(pci, eepro100_pci_tbl);
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index 80a756ae8..6e6af292f 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -189,7 +189,7 @@ static struct pci_device_id epic_pci_tbl[] __devinitdata = {
{ 0x10B8, 0x0005, 0x1092, 0x0AB4, 0, 0, SMSC_83C170_0 },
{ 0x10B8, 0x0005, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SMSC_83C170 },
{ 0x10B8, 0x0006, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SMSC_83C175 },
- { 0,},
+ { 0,}
};
MODULE_DEVICE_TABLE (pci, epic_pci_tbl);
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index 39625e481..443eaffd2 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -3123,11 +3123,11 @@ int hp100_port[5] = { 0, -1, -1, -1, -1 };
MODULE_PARM(hp100_port, "1-5i");
#endif
-#ifndef LINUX_2_1
-static char devname[5][IFNAMSIZ] = { "", "", "", "", "" };
-static char *hp100_name[5] = { devname[0], devname[1],
- devname[2], devname[3],
- devname[4] };
+/* Allocate 5 string of length IFNAMSIZ, one string for each device */
+char hp100_name[5][IFNAMSIZ] = { "", "", "", "", "" };
+#ifdef LINUX_2_1
+/* Allow insmod to write those 5 strings individually */
+MODULE_PARM(hp100_name, "1-5c" __MODULE_STRING(IFNAMSIZ));
#endif
/* List of devices */
@@ -3159,9 +3159,11 @@ int init_module( void )
/* Create device and set basics args */
hp100_devlist[i] = kmalloc(sizeof(struct net_device), GFP_KERNEL);
memset(hp100_devlist[i], 0x00, sizeof(struct net_device));
-#ifndef LINUX_2_1
+#if LINUX_VERSION_CODE >= 0x020362 /* 2.3.99-pre7 */
+ memcpy(hp100_devlist[i]->name, hp100_name[i], IFNAMSIZ); /* Copy name */
+#else
hp100_devlist[i]->name = hp100_name[i];
-#endif
+#endif /* LINUX_VERSION_CODE >= 0x020362 */
hp100_devlist[i]->base_addr = hp100_port[i];
hp100_devlist[i]->init = &hp100_probe;
diff --git a/drivers/net/ncr885e.c b/drivers/net/ncr885e.c
index f91796d31..9a5c65cb4 100644
--- a/drivers/net/ncr885e.c
+++ b/drivers/net/ncr885e.c
@@ -424,7 +424,7 @@ ncr885e_tx( struct net_device *dev )
/* look for any channel status (?) */
if ( xfer ) {
- dev_kfree_skb( sp->tx_skbufs[i] );
+ dev_kfree_skb_irq( sp->tx_skbufs[i] );
if ( txbits & TX_STATUS_TXOK ) {
sp->stats.tx_packets++;
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index c36c76dff..3f40f5aae 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -115,7 +115,7 @@ static struct pci_device_id ne2k_pci_tbl[] __devinitdata = {
{ 0x1050, 0x5a5a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_Winbond_W89C940F },
{ 0x12c3, 0x0058, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_Holtek_HT80232 },
{ 0x12c3, 0x5598, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_Holtek_HT80229 },
- { 0, },
+ { 0, }
};
MODULE_DEVICE_TABLE(pci, ne2k_pci_tbl);
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 7b1f76448..dc580b0fe 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -334,9 +334,11 @@ static struct pci_device_id pcnet32_pci_tbl[] __devinitdata = {
{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_PCNETHOME, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE, 0x1014, 0x2000, 0, 0, 0 },
- { 0, 0, 0, 0, 0, 0, 0 },
+ { 0, }
};
+MODULE_DEVICE_TABLE (pci, pcnet32_pci_tbl);
+
static u16 pcnet32_wio_read_csr (unsigned long addr, int index)
{
outw (index, addr+PCNET32_WIO_RAP);
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c
index d84f05956..5d852dfc6 100644
--- a/drivers/net/ppp_synctty.c
+++ b/drivers/net/ppp_synctty.c
@@ -269,7 +269,7 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
err = -EFAULT;
switch (cmd) {
- case PPPIOCGUNIT:
+ case PPPIOCGCHAN:
err = -ENXIO;
if (ap == 0)
break;
@@ -279,6 +279,16 @@ ppp_synctty_ioctl(struct tty_struct *tty, struct file *file,
err = 0;
break;
+ case PPPIOCGUNIT:
+ err = -ENXIO;
+ if (ap == 0)
+ break;
+ err = -EFAULT;
+ if (put_user(ppp_unit_number(&ap->chan), (int *) arg))
+ break;
+ err = 0;
+ break;
+
case TCGETS:
case TCGETA:
err = n_tty_ioctl(tty, file, cmd, arg);
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 9e772466c..841c0e12c 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -33,6 +33,7 @@
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/init.h>
+#include <linux/if_ether.h>
#include <linux/if_pppox.h>
#include <net/sock.h>
#include <linux/ppp_channel.h>
@@ -46,10 +47,12 @@
static int __attribute__((unused)) pppoe_debug = 7;
-#define PPPOE_HASH_SIZE 16
+#define PPPOE_HASH_BITS 4
+#define PPPOE_HASH_SIZE (1<<PPPOE_HASH_BITS)
int pppoe_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb);
+int __pppoe_xmit(struct sock *sk, struct sk_buff *skb);
struct proto_ops pppoe_ops;
@@ -81,23 +84,18 @@ static inline int cmp_addr(struct pppoe_addr *a, unsigned long sid, char *addr)
static int hash_item(unsigned long sid, unsigned char *addr)
{
- int i = 0;
- union {
- char c[sizeof(unsigned long)];
- unsigned long i;
- } hash;
-
- hash.i = sid;
-
- for (i = 0; i < ETH_ALEN; ++i)
- hash.c[0] = hash.c[0] ^ addr[i];
-
- for (i = 1; i < sizeof(int); ++i)
- hash.c[0] = hash.c[0] ^ hash.c[i];
+ char hash=0;
+ int i,j;
+ for (i = 0; i < ETH_ALEN ; ++i){
+ for (j = 0; j < 8/PPPOE_HASH_BITS ; ++j){
+ hash ^= addr[i] >> ( j * PPPOE_HASH_BITS );
+ }
+ }
- i = (int) (hash.c[0] & (PPPOE_HASH_SIZE - 1));
+ for (i = 0; i < (sizeof(unsigned long)*8) / PPPOE_HASH_BITS ; ++i)
+ hash ^= sid >> (i*PPPOE_HASH_BITS);
- return i;
+ return hash & ( PPPOE_HASH_SIZE - 1 );
}
static struct pppox_opt *item_hash_table[PPPOE_HASH_SIZE] = { 0, };
@@ -105,7 +103,7 @@ static struct pppox_opt *item_hash_table[PPPOE_HASH_SIZE] = { 0, };
/**********************************************************************
*
* Set/get/delete/rehash items (internal versions)
- *
+ *
**********************************************************************/
static struct pppox_opt *__get_item(unsigned long sid, unsigned char *addr)
{
@@ -162,7 +160,7 @@ static struct pppox_opt *__delete_item(unsigned long sid, char *addr)
return ret;
}
-static struct pppox_opt *__find_on_dev(struct net_device *dev,
+static struct pppox_opt *__find_on_dev(struct net_device *dev,
struct pppox_opt *start)
{
struct pppox_opt *po;
@@ -195,9 +193,9 @@ static struct pppox_opt *__find_on_dev(struct net_device *dev,
/**********************************************************************
*
* Set/get/delete/rehash items
- *
+ *
**********************************************************************/
-static inline struct pppox_opt *get_item(unsigned long sid,
+static inline struct pppox_opt *get_item(unsigned long sid,
unsigned char *addr)
{
struct pppox_opt *po;
@@ -239,7 +237,7 @@ static inline struct pppox_opt *delete_item(unsigned long sid, char *addr)
return ret;
}
-static struct pppox_opt *find_on_dev(struct net_device *dev,
+static struct pppox_opt *find_on_dev(struct net_device *dev,
struct pppox_opt *start)
{
struct pppox_opt *po;
@@ -255,7 +253,7 @@ static struct pppox_opt *find_on_dev(struct net_device *dev,
* Certain device events require that sockets be unconnected
*
**************************************************************************/
-static int pppoe_device_event(struct notifier_block *this,
+static int pppoe_device_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
int error = NOTIFY_DONE;
@@ -277,7 +275,7 @@ static int pppoe_device_event(struct notifier_block *this,
if (po->sk->state & PPPOX_CONNECTED)
pppox_unbind_sock(po->sk);
-
+
if (po->sk->state & PPPOX_CONNECTED) {
lock_sock(po->sk);
po->sk->shutdown = RCV_SHUTDOWN&SEND_SHUTDOWN;
@@ -313,7 +311,7 @@ static struct notifier_block pppoe_notifier = {
* Receive a PPPoE Session frame.
*
***********************************************************************/
-static int pppoe_rcv(struct sk_buff *skb,
+static int pppoe_rcv(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt)
@@ -336,6 +334,19 @@ static int pppoe_rcv(struct sk_buff *skb,
skb_pull(skb, sizeof(struct pppoe_hdr));
ppp_input(&po->chan, skb);
+ } else if( sk->state & PPPOX_RELAY ){
+ struct pppox_opt *relay_po;
+
+ relay_po = get_item_by_addr( &po->pppoe_relay );
+
+ if( relay_po == NULL ||
+ !( relay_po->sk->state & PPPOX_CONNECTED ) )
+ goto abort;
+
+ skb_pull(skb, sizeof(struct pppoe_hdr));
+ if( !__pppoe_xmit( relay_po->sk , skb) )
+ goto abort;
+
} else {
sock_queue_rcv_skb(sk, skb);
}
@@ -353,7 +364,7 @@ abort:
* -- This is solely for detection of PADT frames
*
***********************************************************************/
-static int pppoe_disc_rcv(struct sk_buff *skb,
+static int pppoe_disc_rcv(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt)
@@ -539,7 +550,7 @@ int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
dev = dev_get_by_name(sp->sa_addr.pppoe.dev);
- error = -ENODEV;
+ error = -ENODEV;
if (!dev)
goto end;
@@ -768,13 +779,11 @@ end:
/************************************************************************
*
- * xmit function called by generic PPP driver
- * sends PPP frame over PPPoE socket
+ * xmit function for internal use.
*
***********************************************************************/
-int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb)
+int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
{
- struct sock *sk = (struct sock *) chan->private;
struct net_device *dev = sk->protinfo.pppox->pppoe_dev;
struct pppoe_hdr hdr;
struct pppoe_hdr *ph;
@@ -833,6 +842,20 @@ int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb)
return 0;
}
+
+/************************************************************************
+ *
+ * xmit function called by generic PPP driver
+ * sends PPP frame over PPPoE socket
+ *
+ ***********************************************************************/
+int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb)
+{
+ struct sock *sk = (struct sock *) chan->private;
+ return __pppoe_xmit(sk, skb);
+}
+
+
struct ppp_channel_ops pppoe_chan_ops = { pppoe_xmit , NULL };
int pppoe_rcvmsg(struct socket *sock, struct msghdr *m, int total_len, int flags, struct scm_cookie *scm)
diff --git a/drivers/net/setup.c b/drivers/net/setup.c
index 7e01e3f83..b4e5da200 100644
--- a/drivers/net/setup.c
+++ b/drivers/net/setup.c
@@ -12,7 +12,6 @@ extern int mkiss_init_ctrl_dev(void);
extern int slip_init_ctrl_dev(void);
extern int strip_init_ctrl_dev(void);
extern int x25_asy_init_ctrl_dev(void);
-extern int slhc_install(void);
extern int dmascc_init(void);
extern int yam_init(void);
@@ -22,7 +21,7 @@ extern int awc4500_isa_probe(void);
extern int awc4500_pnp_probe(void);
extern int awc4500_365_probe(void);
extern int arcnet_init(void);
-extern int cpm_enet_init(void);
+extern int scc_enet_init(void);
extern int dlci_setup(void);
extern int lapbeth_init(void);
extern int sdla_setup(void);
@@ -34,7 +33,7 @@ extern int abyss_probe(void);
extern int madgemc_probe(void);
extern int tms_pci_probe(void);
-/* Pad device name to IFNAMSIZ=16. F.e. __PAD6 is tring of 9 zeros. */
+/* Pad device name to IFNAMSIZ=16. F.e. __PAD6 is string of 9 zeros. */
#define __PAD6 "\0\0\0\0\0\0\0\0\0"
#define __PAD5 __PAD6 "\0"
#define __PAD4 __PAD5 "\0"
@@ -73,27 +72,17 @@ struct net_probe pci_probes[] __initdata = {
#if defined(CONFIG_ARCNET)
{arcnet_init, 0},
#endif
-#if defined(CONFIG_8xx)
- {cpm_enet_init, 0},
+#if defined(CONFIG_SCC_ENET)
+ {scc_enet_init, 0},
#endif
#if defined(CONFIG_COMX)
{comx_init, 0},
-#endif /*
- * SLHC if present needs attaching so other people see it
- * even if not opened.
- */
+#endif
+
#if defined(CONFIG_LANMEDIA)
{lmc_setup, 0},
#endif
-#ifdef CONFIG_INET
-#if (defined(CONFIG_SLIP) && defined(CONFIG_SLIP_COMPRESSED)) \
- || defined(CONFIG_PPP) \
- || (defined(CONFIG_ISDN) && defined(CONFIG_ISDN_PPP))
- {slhc_install, 0},
-#endif
-#endif
-
/*
*
* Wireless non-HAM
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index b48b726f6..c92e73180 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -79,7 +79,8 @@ static struct pci_device_id sis900_pci_tbl [] __initdata = {
{PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_900,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_900},
{PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_7016,
- PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_7018}
+ PCI_ANY_ID, PCI_ANY_ID, 0, 0, SIS_7018},
+ {0,}
};
MODULE_DEVICE_TABLE (pci, sis900_pci_tbl);
diff --git a/drivers/net/slhc.c b/drivers/net/slhc.c
index ccc8a93d6..10df97225 100644
--- a/drivers/net/slhc.c
+++ b/drivers/net/slhc.c
@@ -77,7 +77,6 @@
#include <linux/timer.h>
#include <asm/system.h>
#include <asm/uaccess.h>
-#include <linux/init.h>
#include <net/checksum.h>
#include <net/slhc_vj.h>
#include <asm/unaligned.h>
@@ -751,12 +750,6 @@ void cleanup_module(void)
return;
}
-#else /* MODULE */
-int __init slhc_install(void)
-{
- return 0;
-}
-
#endif /* MODULE */
#else /* CONFIG_INET */
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 3d59d63c1..b5f70ff16 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -211,7 +211,7 @@ enum chipset {
static struct pci_device_id starfire_pci_tbl[] __devinitdata = {
{ 0x9004, 0x6915, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CH_6915 },
- { 0, },
+ { 0, }
};
MODULE_DEVICE_TABLE(pci, starfire_pci_tbl);
diff --git a/drivers/net/stnic.c b/drivers/net/stnic.c
new file mode 100644
index 000000000..991b21258
--- /dev/null
+++ b/drivers/net/stnic.c
@@ -0,0 +1,302 @@
+/* stnic.c : A SH7750 specific part of driver for NS DP83902A ST-NIC.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1999 kaz Kojima
+ */
+
+#include <linux/module.h>
+
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <linux/ioport.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <asm/system.h>
+#include <asm/io.h>
+#include <asm/hitachi_se.h>
+
+#include "8390.h"
+
+#define byte unsigned char
+#define half unsigned short
+#define word unsigned int
+#define vbyte volatile unsigned char
+#define vhalf volatile unsigned short
+#define vword volatile unsigned int
+
+#define STNIC_RUN 0x01 /* 1 == Run, 0 == reset. */
+
+#define START_PG 0 /* First page of TX buffer */
+#define STOP_PG 128 /* Last page +1 of RX ring */
+
+/* Alias */
+#define STNIC_CR E8390_CMD
+#define PG0_RSAR0 EN0_RSARLO
+#define PG0_RSAR1 EN0_RSARHI
+#define PG0_RBCR0 EN0_RCNTLO
+#define PG0_RBCR1 EN0_RCNTHI
+
+#define CR_RRD E8390_RREAD
+#define CR_RWR E8390_RWRITE
+#define CR_PG0 E8390_PAGE0
+#define CR_STA E8390_START
+#define CR_RDMA E8390_NODMA
+
+/* FIXME! YOU MUST SET YOUR OWN ETHER ADDRESS. */
+static byte stnic_eadr[6] =
+{0x00, 0xc0, 0x6e, 0x00, 0x00, 0x07};
+
+static struct net_device *stnic_dev;
+
+static int stnic_open (struct net_device *dev);
+static int stnic_close (struct net_device *dev);
+static void stnic_reset (struct net_device *dev);
+static void stnic_get_hdr (struct net_device *dev, struct e8390_pkt_hdr *hdr,
+ int ring_page);
+static void stnic_block_input (struct net_device *dev, int count,
+ struct sk_buff *skb , int ring_offset);
+static void stnic_block_output (struct net_device *dev, int count,
+ const unsigned char *buf, int start_page);
+
+static void stnic_init (struct net_device *dev);
+
+/* SH7750 specific read/write io. */
+static inline void
+STNIC_DELAY (void)
+{
+ vword trash;
+ trash = *(vword *) 0xa0000000;
+ trash = *(vword *) 0xa0000000;
+}
+
+static inline byte
+STNIC_READ (int reg)
+{
+ byte val;
+
+ val = (*(vhalf *) (PA_83902 + ((reg) << 1)) >> 8) & 0xff;
+ STNIC_DELAY ();
+ return val;
+}
+
+static inline void
+STNIC_WRITE (int reg, byte val)
+{
+ *(vhalf *) (PA_83902 + ((reg) << 1)) = ((half) (val) << 8);
+ STNIC_DELAY ();
+}
+
+int __init stnic_probe(void)
+{
+ struct net_device tmp, *dev = NULL;
+ int i;
+
+ tmp.base_addr = 0x1000;
+ dev = &tmp;
+
+ if (load_8390_module ("stnic.c"))
+ return -ENOSYS;
+
+ /* New style probing API */
+ dev = init_etherdev (0, 0);
+ stnic_dev = dev;
+
+ /* Allocate dev->priv and fill in 8390 specific dev fields. */
+ if (ethdev_init (dev))
+ {
+ printk ("Unable to get memory for dev->priv.\n");
+ return -ENOMEM;
+ }
+
+ for (i = 0; i < ETHER_ADDR_LEN; i++)
+ dev->dev_addr[i] = stnic_eadr[i];
+
+ /* Set the base address to point to the NIC, not the "real" base! */
+ dev->base_addr = 0x1000;
+ dev->irq = IRQ_STNIC;
+ dev->open = &stnic_open;
+ dev->stop = &stnic_close;
+
+ /* Snarf the interrupt now. There's no point in waiting since we cannot
+ share and the board will usually be enabled. */
+ if (request_irq (dev->irq, ei_interrupt, 0, "DP83902A", dev))
+ {
+ printk (" unable to get IRQ %d.\n", dev->irq);
+ kfree(dev->priv);
+ dev->priv = NULL;
+ return EAGAIN;
+ }
+
+ ei_status.name = "eth0";
+ ei_status.word16 = 1;
+ ei_status.tx_start_page = START_PG;
+ ei_status.rx_start_page = START_PG + TX_PAGES;
+ ei_status.stop_page = STOP_PG;
+
+ ei_status.reset_8390 = &stnic_reset;
+ ei_status.get_8390_hdr = &stnic_get_hdr;
+ ei_status.block_input = &stnic_block_input;
+ ei_status.block_output = &stnic_block_output;
+ stnic_init (dev);
+
+ printk (KERN_INFO "NS ST-NIC 83902A\n");
+
+ return 0;
+}
+
+static int
+stnic_open (struct net_device *dev)
+{
+#if 0
+ printk ("stnic open\n");
+#endif
+ ei_open (dev);
+ MOD_INC_USE_COUNT;
+ return 0;
+}
+
+static int
+stnic_close (struct net_device *dev)
+{
+ ei_close (dev);
+ MOD_DEC_USE_COUNT;
+ return 0;
+}
+
+static void
+stnic_reset (struct net_device *dev)
+{
+ *(vhalf *) PA_83902_RST = 0;
+ udelay (5);
+ if (ei_debug > 1)
+ printk("8390 reset done (%ld).", jiffies);
+ *(vhalf *) PA_83902_RST = ~0;
+ udelay (5);
+}
+
+static void
+stnic_get_hdr (struct net_device *dev, struct e8390_pkt_hdr *hdr,
+ int ring_page)
+{
+ half buf[2];
+
+ STNIC_WRITE (PG0_RSAR0, 0);
+ STNIC_WRITE (PG0_RSAR1, ring_page);
+ STNIC_WRITE (PG0_RBCR0, 4);
+ STNIC_WRITE (PG0_RBCR1, 0);
+ STNIC_WRITE (STNIC_CR, CR_RRD | CR_PG0 | CR_STA);
+
+ buf[0] = *(vhalf *) PA_83902_IF;
+ STNIC_DELAY ();
+ buf[1] = *(vhalf *) PA_83902_IF;
+ STNIC_DELAY ();
+ hdr->next = buf[0] >> 8;
+ hdr->status = buf[0] & 0xff;
+#ifdef __LITTLE_ENDIAN__
+ hdr->count = buf[1];
+#else
+ hdr->count = ((buf[1] >> 8) & 0xff) | (buf[1] << 8);
+#endif
+
+ if (ei_debug > 1)
+ printk ("ring %x status %02x next %02x count %04x.\n",
+ ring_page, hdr->status, hdr->next, hdr->count);
+
+ STNIC_WRITE (STNIC_CR, CR_RDMA | CR_PG0 | CR_STA);
+}
+
+/* Block input and output, similar to the Crynwr packet driver. If you are
+ porting to a new ethercard look at the packet driver source for hints.
+ The HP LAN doesn't use shared memory -- we put the packet
+ out through the "remote DMA" dataport. */
+
+static void
+stnic_block_input (struct net_device *dev, int length, struct sk_buff *skb,
+ int offset)
+{
+ char *buf = skb->data;
+ half val;
+
+ STNIC_WRITE (PG0_RSAR0, offset & 0xff);
+ STNIC_WRITE (PG0_RSAR1, offset >> 8);
+ STNIC_WRITE (PG0_RBCR0, length & 0xff);
+ STNIC_WRITE (PG0_RBCR1, length >> 8);
+ STNIC_WRITE (STNIC_CR, CR_RRD | CR_PG0 | CR_STA);
+
+ if (length & 1)
+ length++;
+
+ while (length > 0)
+ {
+ val = *(vhalf *) PA_83902_IF;
+#ifdef __LITTLE_ENDIAN__
+ *buf++ = val & 0xff;
+ *buf++ = val >> 8;
+#else
+ *buf++ = val >> 8;
+ *buf++ = val & 0xff;
+#endif
+ STNIC_DELAY ();
+ length -= sizeof (half);
+ }
+
+ STNIC_WRITE (STNIC_CR, CR_RDMA | CR_PG0 | CR_STA);
+}
+
+static void
+stnic_block_output (struct net_device *dev, int length,
+ const unsigned char *buf, int output_page)
+{
+
+ STNIC_WRITE (PG0_RBCR0, 1);
+ STNIC_WRITE (STNIC_CR, CR_RRD | CR_PG0 | CR_STA);
+
+ STNIC_WRITE (PG0_RSAR0, 0);
+ STNIC_WRITE (PG0_RSAR1, output_page);
+ STNIC_WRITE (PG0_RBCR0, length & 0xff);
+ STNIC_WRITE (PG0_RBCR1, length >> 8);
+ STNIC_WRITE (STNIC_CR, CR_RWR | CR_PG0 | CR_STA);
+
+ if (length & 1)
+ length++;
+
+ while (length > 0)
+ {
+#ifdef __LITTLE_ENDIAN__
+ *(vhalf *) PA_83902_IF = ((half) buf[1] << 8) | buf[0];
+#else
+ *(vhalf *) PA_83902_IF = ((half) buf[0] << 8) | buf[1];
+#endif
+ STNIC_DELAY ();
+ buf += sizeof (half);
+ length -= sizeof (half);
+ }
+
+ STNIC_WRITE (STNIC_CR, CR_RDMA | CR_PG0 | CR_STA);
+}
+
+/* This function resets the STNIC if something screws up. */
+static void
+stnic_init (struct net_device *dev)
+{
+ stnic_reset (dev);
+ NS8390_init (dev, 0);
+ return;
+}
+
+/* Hardware interrupt handler. */
+extern void ei_interrupt (int irq, void *dev_id, struct pt_regs *regs);
+
+void
+do_stnic_intr (int irq, void *dev_id, struct pt_regs *regs)
+{
+ ei_interrupt (0, stnic_dev, regs);
+}
+
+module_init(stnic_probe);
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
index bc4dec29c..12cee4da5 100644
--- a/drivers/net/tulip/tulip_core.c
+++ b/drivers/net/tulip/tulip_core.c
@@ -168,7 +168,7 @@ static struct pci_device_id tulip_pci_tbl[] __devinitdata = {
{ 0x1282, 0x9100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 },
{ 0x1282, 0x9102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DC21140 },
{ 0x1113, 0x1217, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MX98715 },
- {0},
+ {0, }
};
MODULE_DEVICE_TABLE(pci, tulip_pci_tbl);
diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 77816670f..67db42e97 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -291,7 +291,7 @@ static struct pci_device_id via_rhine_pci_tbl[] __devinitdata =
{
{0x1106, 0x6100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT86C100A},
{0x1106, 0x3043, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VT3043},
- {0,}, /* terminate list */
+ {0,} /* terminate list */
};
MODULE_DEVICE_TABLE(pci, via_rhine_pci_tbl);
diff --git a/drivers/net/wan/comx-hw-comx.c b/drivers/net/wan/comx-hw-comx.c
index 7381dc8a9..23899bde9 100644
--- a/drivers/net/wan/comx-hw-comx.c
+++ b/drivers/net/wan/comx-hw-comx.c
@@ -1031,11 +1031,6 @@ static int comxhw_write_proc(struct file *file, const char *buffer,
char *page;
- if (file->f_dentry->d_inode->i_ino != entry->low_ino) {
- printk(KERN_ERR "comx_write_proc: file <-> data internal error\n");
- return -EIO;
- }
-
if(ch->init_status & HW_OPEN) {
return -EAGAIN;
}
@@ -1234,7 +1229,6 @@ static int COMX_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
new_file->write_proc = &comxhw_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->size = 6;
new_file->nlink = 1;
@@ -1245,7 +1239,6 @@ static int COMX_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
new_file->write_proc = &comxhw_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->size = 5;
new_file->nlink = 1;
@@ -1256,7 +1249,6 @@ static int COMX_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
new_file->write_proc = &comxhw_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->size = 2; // Ezt tudjuk
new_file->nlink = 1;
@@ -1268,7 +1260,6 @@ static int COMX_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
new_file->write_proc = &comxhw_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->size = 9;
new_file->nlink = 1;
}
@@ -1280,7 +1271,6 @@ static int COMX_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
new_file->write_proc = &comxhw_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->size = 8;
new_file->nlink = 1;
@@ -1291,7 +1281,6 @@ static int COMX_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
new_file->write_proc = NULL;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->nlink = 1;
if ((new_file = create_proc_entry(FILENAME_FIRMWARE, S_IFREG | 0644,
@@ -1301,7 +1290,6 @@ static int COMX_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &comxhw_read_proc;
new_file->write_proc = &comxhw_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->nlink = 1;
if (ch->hardware == &comx_hw) {
diff --git a/drivers/net/wan/comx-hw-locomx.c b/drivers/net/wan/comx-hw-locomx.c
index 010f02373..94561e859 100644
--- a/drivers/net/wan/comx-hw-locomx.c
+++ b/drivers/net/wan/comx-hw-locomx.c
@@ -330,11 +330,6 @@ static int locomx_write_proc(struct file *file, const char *buffer,
int val;
char *page;
- if (file->f_dentry->d_inode->i_ino != entry->low_ino) {
- printk(KERN_ERR "hw_write_proc: file <-> data internal error\n");
- return -EIO;
- }
-
if (!(page = (char *)__get_free_page(GFP_KERNEL))) {
return -ENOMEM;
}
@@ -395,7 +390,6 @@ static int LOCOMX_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &locomx_read_proc;
new_file->write_proc = &locomx_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->nlink = 1;
if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644,
@@ -405,7 +399,6 @@ static int LOCOMX_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &locomx_read_proc;
new_file->write_proc = &locomx_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->nlink = 1;
/* No clock yet */
@@ -417,7 +410,6 @@ static int LOCOMX_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &locomx_read_proc;
new_file->write_proc = &locomx_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->nlink = 1;
*/
diff --git a/drivers/net/wan/comx-hw-mixcom.c b/drivers/net/wan/comx-hw-mixcom.c
index 552443f88..3ee2b690b 100644
--- a/drivers/net/wan/comx-hw-mixcom.c
+++ b/drivers/net/wan/comx-hw-mixcom.c
@@ -742,11 +742,6 @@ static int mixcom_write_proc(struct file *file, const char *buffer,
char *page;
int value;
- if (file->f_dentry->d_inode->i_ino != entry->low_ino) {
- printk(KERN_ERR "mixcom_write_proc: file <-> data internal error\n");
- return -EIO;
- }
-
if (!(page = (char *)__get_free_page(GFP_KERNEL))) {
return -ENOMEM;
}
@@ -829,7 +824,6 @@ static int MIXCOM_init(struct net_device *dev) {
new_file->data = (void *)new_file;
new_file->read_proc = &mixcom_read_proc;
new_file->write_proc = &mixcom_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->nlink = 1;
if ((new_file = create_proc_entry(FILENAME_IRQ, S_IFREG | 0644,
@@ -839,7 +833,6 @@ static int MIXCOM_init(struct net_device *dev) {
new_file->data = (void *)new_file;
new_file->read_proc = &mixcom_read_proc;
new_file->write_proc = &mixcom_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->nlink = 1;
#if 0
@@ -850,7 +843,6 @@ static int MIXCOM_init(struct net_device *dev) {
new_file->data = (void *)new_file;
new_file->read_proc = &mixcom_read_proc;
new_file->write_proc = &mixcom_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->nlink = 1;
#endif
@@ -861,7 +853,6 @@ static int MIXCOM_init(struct net_device *dev) {
new_file->data = (void *)new_file;
new_file->read_proc = &mixcom_read_proc;
new_file->write_proc = &mixcom_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->nlink = 1;
if ((new_file = create_proc_entry(FILENAME_TWIN, S_IFREG | 0444,
@@ -871,7 +862,6 @@ static int MIXCOM_init(struct net_device *dev) {
new_file->data = (void *)new_file;
new_file->read_proc = &mixcom_read_proc;
new_file->write_proc = &mixcom_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->nlink = 1;
setup_twin(dev);
diff --git a/drivers/net/wan/comx-proto-fr.c b/drivers/net/wan/comx-proto-fr.c
index ad62e310c..f32c84e76 100644
--- a/drivers/net/wan/comx-proto-fr.c
+++ b/drivers/net/wan/comx-proto-fr.c
@@ -641,11 +641,6 @@ static int fr_write_proc(struct file *file, const char *buffer,
fr = ch->LINE_privdata;
}
- if (file->f_dentry->d_inode->i_ino != entry->low_ino) {
- printk(KERN_ERR "comxfr_write_proc: file <-> data internal error\n");
- return -EIO;
- }
-
if (!(page = (char *)__get_free_page(GFP_KERNEL))) {
return -ENOMEM;
}
@@ -803,7 +798,6 @@ static int fr_master_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &fr_read_proc;
new_file->write_proc = &fr_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->size = 5;
new_file->nlink = 1;
@@ -814,7 +808,6 @@ static int fr_master_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &fr_read_proc;
new_file->write_proc = &fr_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->size = 4;
new_file->nlink = 1;
@@ -860,7 +853,6 @@ static int fr_slave_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &fr_read_proc;
new_file->write_proc = &fr_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->size = 5;
new_file->nlink = 1;
@@ -871,7 +863,6 @@ static int fr_slave_init(struct net_device *dev)
new_file->data = (void *)new_file;
new_file->read_proc = &fr_read_proc;
new_file->write_proc = &fr_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->size = 10;
new_file->nlink = 1;
MOD_INC_USE_COUNT;
diff --git a/drivers/net/wan/comx-proto-lapb.c b/drivers/net/wan/comx-proto-lapb.c
index c0fc0c6bd..abf8977ff 100644
--- a/drivers/net/wan/comx-proto-lapb.c
+++ b/drivers/net/wan/comx-proto-lapb.c
@@ -221,11 +221,6 @@ static int comxlapb_write_proc(struct file *file, const char *buffer,
unsigned long parm;
char *page;
- if (file->f_dentry->d_inode->i_ino != entry->low_ino) {
- printk(KERN_ERR "comxlapb_write_proc: file <-> data internal error\n");
- return -EIO;
- }
-
if (lapb_getparms(dev->priv, &parms)) {
return -ENODEV;
}
@@ -499,7 +494,6 @@ static struct proc_dir_entry *create_comxlapb_proc_entry(char *name, int mode,
new_file->data = (void *)new_file;
new_file->read_proc = &comxlapb_read_proc;
new_file->write_proc = &comxlapb_write_proc;
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->size = size;
new_file->nlink = 1;
}
diff --git a/drivers/net/wan/comx.c b/drivers/net/wan/comx.c
index 4190e2ed4..d8e76deef 100644
--- a/drivers/net/wan/comx.c
+++ b/drivers/net/wan/comx.c
@@ -81,21 +81,18 @@ extern int comx_proto_fr_init(void);
static struct comx_hardware *comx_channels = NULL;
static struct comx_protocol *comx_lines = NULL;
-struct inode_operations comx_normal_inode_ops;
-static struct inode_operations comx_root_inode_ops; // for mkdir
-static struct inode_operations comx_debug_inode_ops; // mas a file_ops
-static struct file_operations comx_normal_file_ops; // with open/relase
-static struct file_operations comx_debug_file_ops; // with lseek+read
+static struct inode_operations comx_root_inode_ops = {
+ lookup: comx_lookup,
+ mkdir: comx_mkdir,
+ rmdir: comx_rmdir,
+};
-static void comx_delete_dentry(struct dentry *dentry);
+static int comx_delete_dentry(struct dentry *dentry);
static struct proc_dir_entry *create_comx_proc_entry(char *name, int mode,
int size, struct proc_dir_entry *dir);
static struct dentry_operations comx_dentry_operations = {
- NULL, /* revalidate */
- NULL, /* d_hash */
- NULL, /* d_compare */
- &comx_delete_dentry /* d_delete */
+ d_delete: comx_delete_dentry,
};
@@ -601,11 +598,6 @@ static int comx_write_proc(struct file *file, const char *buffer, u_long count,
char str[30];
int ret=0;
- if (file->f_dentry->d_inode->i_ino != entry->low_ino) {
- printk(KERN_ERR "comx_write_proc: file <-> data internal error\n");
- return -EIO;
- }
-
if (count > PAGE_SIZE) {
printk(KERN_ERR "count is %lu > %d!!!\n", count, (int)PAGE_SIZE);
return -ENOSPC;
@@ -761,84 +753,12 @@ static int comx_write_proc(struct file *file, const char *buffer, u_long count,
return count;
}
-static loff_t comx_debug_lseek(struct file *file, loff_t offset, int orig)
-{
- switch(orig) {
- case 0:
- file->f_pos = max(0, min(offset,
- file->f_dentry->d_inode->i_size));
- return(file->f_pos);
- case 1:
- file->f_pos = max(0, min(offset + file->f_pos,
- file->f_dentry->d_inode->i_size));
- return(file->f_pos);
- case 2:
- file->f_pos = max(0,
- min(offset + file->f_dentry->d_inode->i_size,
- file->f_dentry->d_inode->i_size));
- return(file->f_pos);
- }
- return(file->f_pos);
-}
-
-static int comx_file_open(struct inode *inode, struct file *file)
-{
-
- if((file->f_mode & FMODE_WRITE) && !(inode->i_mode & 0200)) {
- return -EACCES;
- }
-
- MOD_INC_USE_COUNT;
- return 0;
-}
-
-static int comx_file_release(struct inode *inode, struct file *file)
-{
- MOD_DEC_USE_COUNT;
- return 0;
-}
-
-static ssize_t comx_debug_read(struct file *file, char *buffer, size_t count,
- loff_t *ppos)
-{
- struct proc_dir_entry *de = file->f_dentry->d_inode->u.generic_ip;
- struct net_device *dev = de->parent->data;
- struct comx_channel *ch = dev->priv;
- loff_t copied = 0;
- unsigned long flags;
-
- save_flags(flags); cli(); // We may run into trouble when debug_area is filled
- // from irq inside read. no problem if the buffer is
- // large enough
-
- while (count > 0 && ch->debug_start != ch->debug_end) {
- int len;
-
- len = min( (ch->debug_end - ch->debug_start + ch->debug_size)
- %ch->debug_size, min (ch->debug_size -
- ch->debug_start, count));
-
- if (len) copy_to_user(buffer + copied,
- ch->debug_area + ch->debug_start, len);
- ch->debug_start = (ch->debug_start + len) % ch->debug_size;
-
- de->size -= len;
- count -= len;
- copied += len;
- }
-
- restore_flags(flags);
- return copied;
-}
-
static int comx_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{
struct proc_dir_entry *new_dir, *debug_file;
struct net_device *dev;
struct comx_channel *ch;
- if (dir->i_ino != comx_root_dir->low_ino) return -ENOTDIR;
-
if ((new_dir = create_proc_entry(dentry->d_name.name, mode | S_IFDIR,
comx_root_dir)) == NULL) {
return -EIO;
@@ -867,7 +787,6 @@ static int comx_mkdir(struct inode *dir, struct dentry *dentry, int mode)
S_IFREG | 0644, new_dir)) == NULL) {
return -ENOMEM;
}
- debug_file->proc_iops = &comx_debug_inode_ops;
debug_file->data = (void *)debug_file;
debug_file->read_proc = NULL; // see below
debug_file->write_proc = &comx_write_proc;
@@ -912,9 +831,6 @@ static int comx_rmdir(struct inode *dir, struct dentry *dentry)
struct comx_channel *ch = dev->priv;
int ret;
- /* Egyelore miert ne ? */
- if (dir->i_ino != comx_root_dir->low_ino) return -ENOTDIR;
-
if (dev->flags & IFF_UP) {
printk(KERN_ERR "%s: down interface before removing it\n", dev->name);
return -EBUSY;
@@ -962,10 +878,6 @@ static struct dentry *comx_lookup(struct inode *dir, struct dentry *dentry)
struct proc_dir_entry *de;
struct inode *inode = NULL;
- if (!dir || !S_ISDIR(dir->i_mode)) {
- return ERR_PTR(-ENOTDIR);
- }
-
if ((de = (struct proc_dir_entry *) dir->u.generic_ip) != NULL) {
for (de = de->subdir ; de ; de = de->next) {
if ((de && de->low_ino) &&
@@ -998,9 +910,9 @@ int comx_strcasecmp(const char *cs, const char *ct)
return __res;
}
-static void comx_delete_dentry(struct dentry *dentry)
+static int comx_delete_dentry(struct dentry *dentry)
{
- d_drop(dentry);
+ return 1;
}
static struct proc_dir_entry *create_comx_proc_entry(char *name, int mode,
@@ -1009,7 +921,6 @@ static struct proc_dir_entry *create_comx_proc_entry(char *name, int mode,
struct proc_dir_entry *new_file;
if ((new_file = create_proc_entry(name, S_IFREG | mode, dir)) != NULL) {
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->data = (void *)new_file;
new_file->read_proc = &comx_read_proc;
new_file->write_proc = &comx_write_proc;
@@ -1115,23 +1026,6 @@ int __init comx_init(void)
{
struct proc_dir_entry *new_file;
- comx_root_inode_ops.lookup = &comx_lookup;
- comx_root_inode_ops.mkdir = &comx_mkdir;
- comx_root_inode_ops.rmdir = &comx_rmdir;
-
- comx_normal_inode_ops.lookup = &comx_lookup;
-
- memcpy(&comx_debug_inode_ops, &comx_normal_inode_ops,
- sizeof(struct inode_operations));
-
- comx_normal_file_ops.open = &comx_file_open;
- comx_normal_file_ops.release = &comx_file_release;
-
- memcpy(&comx_debug_file_ops, &comx_normal_file_ops,
- sizeof(struct file_operations));
- comx_debug_file_ops.llseek = &comx_debug_lseek;
- comx_debug_file_ops.read = &comx_debug_read;
-
comx_root_dir = create_proc_entry("comx",
S_IFDIR | S_IWUSR | S_IRUGO | S_IXUGO, &proc_root);
if (!comx_root_dir)
@@ -1143,7 +1037,6 @@ int __init comx_init(void)
return -ENOMEM;
}
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->data = new_file;
new_file->read_proc = &comx_root_read_proc;
new_file->write_proc = NULL;
@@ -1154,7 +1047,6 @@ int __init comx_init(void)
return -ENOMEM;
}
- new_file->proc_iops = &comx_normal_inode_ops;
new_file->data = new_file;
new_file->read_proc = &comx_root_read_proc;
new_file->write_proc = NULL;
@@ -1211,5 +1103,4 @@ EXPORT_SYMBOL(comx_lineup_func);
EXPORT_SYMBOL(comx_status);
EXPORT_SYMBOL(comx_rx);
EXPORT_SYMBOL(comx_strcasecmp);
-EXPORT_SYMBOL(comx_normal_inode_ops);
EXPORT_SYMBOL(comx_root_dir);
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index ebf339d2e..6346873e8 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -112,7 +112,7 @@ int LMC_PKT_BUF_SZ = 1542;
#ifdef MODULE
static struct pci_device_id lmc_pci_tbl[] __devinitdata = {
{ 0x1011, 0x009, 0x1379, PCI_ANY_ID, 0, 0, 0},
- { 0 },
+ { 0, }
};
MODULE_DEVICE_TABLE(pci, lmc_pci_tbl);
diff --git a/drivers/net/wavelan.c b/drivers/net/wavelan.c
index b6be90321..51fc0b9a6 100644
--- a/drivers/net/wavelan.c
+++ b/drivers/net/wavelan.c
@@ -4211,6 +4211,7 @@ int init_module(void)
break;
}
memset(dev, 0x00, sizeof(struct net_device));
+ memcpy(dev->name, name[i], IFNAMSIZ); /* Copy name */
dev->base_addr = io[i];
dev->irq = irq[i];
dev->init = &wavelan_config;
diff --git a/drivers/net/wavelan.p.h b/drivers/net/wavelan.p.h
index 593b5655c..3e20776fb 100644
--- a/drivers/net/wavelan.p.h
+++ b/drivers/net/wavelan.p.h
@@ -695,8 +695,10 @@ static unsigned short iobase[] =
/* Parameters set by insmod */
static int io[4] = { 0, 0, 0, 0 };
static int irq[4] = { 0, 0, 0, 0 };
+static char name[4][IFNAMSIZ] = { "", "", "", "" };
MODULE_PARM(io, "1-4i");
MODULE_PARM(irq, "1-4i");
+MODULE_PARM(name, "1-4c" __MODULE_STRING(IFNAMSIZ));
#endif /* MODULE */
#endif /* WAVELAN_P_H */
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 2be7d5823..4e2d6435e 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -237,7 +237,7 @@ static struct chip_info chip_info[] = {
static struct pci_device_id yellowfin_pci_tbl[] __devinitdata = {
{ 0x1000, 0x0702, PCI_ANY_ID, PCI_ANY_ID, 0, 0, YELLOWFIN_GNIC },
{ 0x1000, 0x0701, PCI_ANY_ID, PCI_ANY_ID, 0, 0, SYM83C885 },
- { 0, },
+ { 0, }
};
MODULE_DEVICE_TABLE (pci, yellowfin_pci_tbl);