Commit 6b711861 authored by Jeff Garzik's avatar Jeff Garzik

[netdrvr sk_mca] remove ancient-kernel compat code; fix bugs

* removed ancient-kernel compat code from sk_mca.h.  I leave
  it to janitors to remove the now-useless SKMCA_xxx wrappers.
* removed ancient-kernel compat code from sk_mca.c.
* s/SKMCA_NETDEV/net_device/
* fixed static net_device initialization (this will go away
  when dynamic-alloc patches land)
parent 7775d66f
...@@ -124,7 +124,7 @@ static unsigned char poly[] = ...@@ -124,7 +124,7 @@ static unsigned char poly[] =
/* dump parts of shared memory - only needed during debugging */ /* dump parts of shared memory - only needed during debugging */
#ifdef DEBUG #ifdef DEBUG
static void dumpmem(struct SKMCA_NETDEV *dev, u32 start, u32 len) static void dumpmem(struct net_device *dev, u32 start, u32 len)
{ {
int z; int z;
...@@ -217,7 +217,7 @@ static int __init dofind(int *junior, int firstslot) ...@@ -217,7 +217,7 @@ static int __init dofind(int *junior, int firstslot)
/* reset the whole board */ /* reset the whole board */
static void ResetBoard(struct SKMCA_NETDEV *dev) static void ResetBoard(struct net_device *dev)
{ {
skmca_priv *priv = (skmca_priv *) dev->priv; skmca_priv *priv = (skmca_priv *) dev->priv;
...@@ -228,7 +228,7 @@ static void ResetBoard(struct SKMCA_NETDEV *dev) ...@@ -228,7 +228,7 @@ static void ResetBoard(struct SKMCA_NETDEV *dev)
/* wait for LANCE interface to become not busy */ /* wait for LANCE interface to become not busy */
static int WaitLANCE(struct SKMCA_NETDEV *dev) static int WaitLANCE(struct net_device *dev)
{ {
skmca_priv *priv = (skmca_priv *) dev->priv; skmca_priv *priv = (skmca_priv *) dev->priv;
int t = 0; int t = 0;
...@@ -247,7 +247,7 @@ static int WaitLANCE(struct SKMCA_NETDEV *dev) ...@@ -247,7 +247,7 @@ static int WaitLANCE(struct SKMCA_NETDEV *dev)
/* set LANCE register - must be atomic */ /* set LANCE register - must be atomic */
static void SetLANCE(struct SKMCA_NETDEV *dev, u16 addr, u16 value) static void SetLANCE(struct net_device *dev, u16 addr, u16 value)
{ {
skmca_priv *priv = (skmca_priv *) dev->priv; skmca_priv *priv = (skmca_priv *) dev->priv;
unsigned long flags; unsigned long flags;
...@@ -285,7 +285,7 @@ static void SetLANCE(struct SKMCA_NETDEV *dev, u16 addr, u16 value) ...@@ -285,7 +285,7 @@ static void SetLANCE(struct SKMCA_NETDEV *dev, u16 addr, u16 value)
/* get LANCE register */ /* get LANCE register */
static u16 GetLANCE(struct SKMCA_NETDEV *dev, u16 addr) static u16 GetLANCE(struct net_device *dev, u16 addr)
{ {
skmca_priv *priv = (skmca_priv *) dev->priv; skmca_priv *priv = (skmca_priv *) dev->priv;
unsigned long flags; unsigned long flags;
...@@ -326,7 +326,7 @@ static u16 GetLANCE(struct SKMCA_NETDEV *dev, u16 addr) ...@@ -326,7 +326,7 @@ static u16 GetLANCE(struct SKMCA_NETDEV *dev, u16 addr)
/* build up descriptors in shared RAM */ /* build up descriptors in shared RAM */
static void InitDscrs(struct SKMCA_NETDEV *dev) static void InitDscrs(struct net_device *dev)
{ {
u32 bufaddr; u32 bufaddr;
...@@ -422,7 +422,7 @@ static unsigned int GetHash(char *address) ...@@ -422,7 +422,7 @@ static unsigned int GetHash(char *address)
/* feed ready-built initialization block into LANCE */ /* feed ready-built initialization block into LANCE */
static void InitLANCE(struct SKMCA_NETDEV *dev) static void InitLANCE(struct net_device *dev)
{ {
skmca_priv *priv = (skmca_priv *) dev->priv; skmca_priv *priv = (skmca_priv *) dev->priv;
...@@ -452,11 +452,7 @@ static void InitLANCE(struct SKMCA_NETDEV *dev) ...@@ -452,11 +452,7 @@ static void InitLANCE(struct SKMCA_NETDEV *dev)
/* we don't get ready until the LANCE has read the init block */ /* we don't get ready until the LANCE has read the init block */
#if (LINUX_VERSION_CODE >= 0x02032a)
netif_stop_queue(dev); netif_stop_queue(dev);
#else
dev->tbusy = 1;
#endif
/* let LANCE read the initialization block. LANCE is ready /* let LANCE read the initialization block. LANCE is ready
when we receive the corresponding interrupt. */ when we receive the corresponding interrupt. */
...@@ -466,15 +462,11 @@ static void InitLANCE(struct SKMCA_NETDEV *dev) ...@@ -466,15 +462,11 @@ static void InitLANCE(struct SKMCA_NETDEV *dev)
/* stop the LANCE so we can reinitialize it */ /* stop the LANCE so we can reinitialize it */
static void StopLANCE(struct SKMCA_NETDEV *dev) static void StopLANCE(struct net_device *dev)
{ {
/* can't take frames any more */ /* can't take frames any more */
#if (LINUX_VERSION_CODE >= 0x02032a)
netif_stop_queue(dev); netif_stop_queue(dev);
#else
dev->tbusy = 1;
#endif
/* disable interrupts, stop it */ /* disable interrupts, stop it */
...@@ -483,7 +475,7 @@ static void StopLANCE(struct SKMCA_NETDEV *dev) ...@@ -483,7 +475,7 @@ static void StopLANCE(struct SKMCA_NETDEV *dev)
/* initialize card and LANCE for proper operation */ /* initialize card and LANCE for proper operation */
static void InitBoard(struct SKMCA_NETDEV *dev) static void InitBoard(struct net_device *dev)
{ {
LANCE_InitBlock block; LANCE_InitBlock block;
...@@ -508,7 +500,7 @@ static void InitBoard(struct SKMCA_NETDEV *dev) ...@@ -508,7 +500,7 @@ static void InitBoard(struct SKMCA_NETDEV *dev)
/* deinitialize card and LANCE */ /* deinitialize card and LANCE */
static void DeinitBoard(struct SKMCA_NETDEV *dev) static void DeinitBoard(struct net_device *dev)
{ {
/* stop LANCE */ /* stop LANCE */
...@@ -521,7 +513,7 @@ static void DeinitBoard(struct SKMCA_NETDEV *dev) ...@@ -521,7 +513,7 @@ static void DeinitBoard(struct SKMCA_NETDEV *dev)
/* probe for device's irq */ /* probe for device's irq */
static int __init ProbeIRQ(struct SKMCA_NETDEV *dev) static int __init ProbeIRQ(struct net_device *dev)
{ {
unsigned long imaskval, njiffies, irq; unsigned long imaskval, njiffies, irq;
u16 csr0val; u16 csr0val;
...@@ -563,15 +555,11 @@ static int __init ProbeIRQ(struct SKMCA_NETDEV *dev) ...@@ -563,15 +555,11 @@ static int __init ProbeIRQ(struct SKMCA_NETDEV *dev)
/* LANCE has read initialization block -> start it */ /* LANCE has read initialization block -> start it */
static u16 irqstart_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0) static u16 irqstart_handler(struct net_device *dev, u16 oldcsr0)
{ {
/* now we're ready to transmit */ /* now we're ready to transmit */
#if (LINUX_VERSION_CODE >= 0x02032a)
netif_wake_queue(dev); netif_wake_queue(dev);
#else
dev->tbusy = 0;
#endif
/* reset IDON bit, start LANCE */ /* reset IDON bit, start LANCE */
...@@ -581,7 +569,7 @@ static u16 irqstart_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0) ...@@ -581,7 +569,7 @@ static u16 irqstart_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
/* did we lose blocks due to a FIFO overrun ? */ /* did we lose blocks due to a FIFO overrun ? */
static u16 irqmiss_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0) static u16 irqmiss_handler(struct net_device *dev, u16 oldcsr0)
{ {
skmca_priv *priv = (skmca_priv *) dev->priv; skmca_priv *priv = (skmca_priv *) dev->priv;
...@@ -597,7 +585,7 @@ static u16 irqmiss_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0) ...@@ -597,7 +585,7 @@ static u16 irqmiss_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
/* receive interrupt */ /* receive interrupt */
static u16 irqrx_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0) static u16 irqrx_handler(struct net_device *dev, u16 oldcsr0)
{ {
skmca_priv *priv = (skmca_priv *) dev->priv; skmca_priv *priv = (skmca_priv *) dev->priv;
LANCE_RxDescr descr; LANCE_RxDescr descr;
...@@ -678,7 +666,7 @@ static u16 irqrx_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0) ...@@ -678,7 +666,7 @@ static u16 irqrx_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
/* transmit interrupt */ /* transmit interrupt */
static u16 irqtx_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0) static u16 irqtx_handler(struct net_device *dev, u16 oldcsr0)
{ {
skmca_priv *priv = (skmca_priv *) dev->priv; skmca_priv *priv = (skmca_priv *) dev->priv;
LANCE_TxDescr descr; LANCE_TxDescr descr;
...@@ -740,12 +728,7 @@ static u16 irqtx_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0) ...@@ -740,12 +728,7 @@ static u16 irqtx_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
a new one */ a new one */
/* inform upper layers we're in business again */ /* inform upper layers we're in business again */
#if (LINUX_VERSION_CODE >= 0x02032a)
netif_wake_queue(dev); netif_wake_queue(dev);
#else
dev->tbusy = 0;
mark_bh(NET_BH);
#endif
return oldcsr0; return oldcsr0;
} }
...@@ -754,7 +737,7 @@ static u16 irqtx_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0) ...@@ -754,7 +737,7 @@ static u16 irqtx_handler(struct SKMCA_NETDEV *dev, u16 oldcsr0)
static irqreturn_t irq_handler(int irq, void *device, struct pt_regs *regs) static irqreturn_t irq_handler(int irq, void *device, struct pt_regs *regs)
{ {
struct SKMCA_NETDEV *dev = (struct SKMCA_NETDEV *) device; struct net_device *dev = (struct net_device *) device;
u16 csr0val; u16 csr0val;
/* read CSR0 to get interrupt cause */ /* read CSR0 to get interrupt cause */
...@@ -766,13 +749,9 @@ static irqreturn_t irq_handler(int irq, void *device, struct pt_regs *regs) ...@@ -766,13 +749,9 @@ static irqreturn_t irq_handler(int irq, void *device, struct pt_regs *regs)
if ((csr0val & CSR0_INTR) == 0) if ((csr0val & CSR0_INTR) == 0)
return IRQ_NONE; return IRQ_NONE;
#if (LINUX_VERSION_CODE >= 0x02032a)
#if 0 #if 0
set_bit(LINK_STATE_RXSEM, &dev->state); set_bit(LINK_STATE_RXSEM, &dev->state);
#endif #endif
#else
dev->interrupt = 1;
#endif
/* loop through the interrupt bits until everything is clear */ /* loop through the interrupt bits until everything is clear */
...@@ -796,12 +775,8 @@ static irqreturn_t irq_handler(int irq, void *device, struct pt_regs *regs) ...@@ -796,12 +775,8 @@ static irqreturn_t irq_handler(int irq, void *device, struct pt_regs *regs)
} }
while ((csr0val & CSR0_INTR) != 0); while ((csr0val & CSR0_INTR) != 0);
#if (LINUX_VERSION_CODE >= 0x02032a)
#if 0 #if 0
clear_bit(LINK_STATE_RXSEM, &dev->state); clear_bit(LINK_STATE_RXSEM, &dev->state);
#endif
#else
dev->interrupt = 0;
#endif #endif
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -815,7 +790,7 @@ static irqreturn_t irq_handler(int irq, void *device, struct pt_regs *regs) ...@@ -815,7 +790,7 @@ static irqreturn_t irq_handler(int irq, void *device, struct pt_regs *regs)
static int skmca_getinfo(char *buf, int slot, void *d) static int skmca_getinfo(char *buf, int slot, void *d)
{ {
int len = 0, i; int len = 0, i;
struct SKMCA_NETDEV *dev = (struct SKMCA_NETDEV *) d; struct net_device *dev = (struct net_device *) d;
skmca_priv *priv; skmca_priv *priv;
/* can't say anything about an uninitialized device... */ /* can't say anything about an uninitialized device... */
...@@ -846,7 +821,7 @@ static int skmca_getinfo(char *buf, int slot, void *d) ...@@ -846,7 +821,7 @@ static int skmca_getinfo(char *buf, int slot, void *d)
/* open driver. Means also initialization and start of LANCE */ /* open driver. Means also initialization and start of LANCE */
static int skmca_open(struct SKMCA_NETDEV *dev) static int skmca_open(struct net_device *dev)
{ {
int result; int result;
skmca_priv *priv = (skmca_priv *) dev->priv; skmca_priv *priv = (skmca_priv *) dev->priv;
...@@ -868,21 +843,14 @@ static int skmca_open(struct SKMCA_NETDEV *dev) ...@@ -868,21 +843,14 @@ static int skmca_open(struct SKMCA_NETDEV *dev)
/* set up flags */ /* set up flags */
#if (LINUX_VERSION_CODE >= 0x02032a)
netif_start_queue(dev); netif_start_queue(dev);
#else
dev->interrupt = 0;
dev->tbusy = 0;
dev->start = 0;
MOD_INC_USE_COUNT;
#endif
return 0; return 0;
} }
/* close driver. Shut down board and free allocated resources */ /* close driver. Shut down board and free allocated resources */
static int skmca_close(struct SKMCA_NETDEV *dev) static int skmca_close(struct net_device *dev)
{ {
/* turn off board */ /* turn off board */
DeinitBoard(dev); DeinitBoard(dev);
...@@ -892,16 +860,12 @@ static int skmca_close(struct SKMCA_NETDEV *dev) ...@@ -892,16 +860,12 @@ static int skmca_close(struct SKMCA_NETDEV *dev)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
dev->irq = 0; dev->irq = 0;
#if (LINUX_VERSION_CODE < 0x02032a)
MOD_DEC_USE_COUNT;
#endif
return 0; return 0;
} }
/* transmit a block. */ /* transmit a block. */
static int skmca_tx(struct sk_buff *skb, struct SKMCA_NETDEV *dev) static int skmca_tx(struct sk_buff *skb, struct net_device *dev)
{ {
skmca_priv *priv = (skmca_priv *) dev->priv; skmca_priv *priv = (skmca_priv *) dev->priv;
LANCE_TxDescr descr; LANCE_TxDescr descr;
...@@ -977,11 +941,7 @@ static int skmca_tx(struct sk_buff *skb, struct SKMCA_NETDEV *dev) ...@@ -977,11 +941,7 @@ static int skmca_tx(struct sk_buff *skb, struct SKMCA_NETDEV *dev)
/* are we saturated ? */ /* are we saturated ? */
if (priv->txbusy >= TXCOUNT) if (priv->txbusy >= TXCOUNT)
#if (LINUX_VERSION_CODE >= 0x02032a)
netif_stop_queue(dev); netif_stop_queue(dev);
#else
dev->tbusy = 1;
#endif
/* write descriptor back to RAM */ /* write descriptor back to RAM */
SKMCA_TOIO(dev->mem_start + address, &descr, SKMCA_TOIO(dev->mem_start + address, &descr,
...@@ -1004,7 +964,7 @@ static int skmca_tx(struct sk_buff *skb, struct SKMCA_NETDEV *dev) ...@@ -1004,7 +964,7 @@ static int skmca_tx(struct sk_buff *skb, struct SKMCA_NETDEV *dev)
/* return pointer to Ethernet statistics */ /* return pointer to Ethernet statistics */
static struct net_device_stats *skmca_stats(struct SKMCA_NETDEV *dev) static struct net_device_stats *skmca_stats(struct net_device *dev)
{ {
skmca_priv *priv = (skmca_priv *) dev->priv; skmca_priv *priv = (skmca_priv *) dev->priv;
...@@ -1014,7 +974,7 @@ static struct net_device_stats *skmca_stats(struct SKMCA_NETDEV *dev) ...@@ -1014,7 +974,7 @@ static struct net_device_stats *skmca_stats(struct SKMCA_NETDEV *dev)
/* we don't support runtime reconfiguration, since an MCA card can /* we don't support runtime reconfiguration, since an MCA card can
be unambigously identified by its POS registers. */ be unambigously identified by its POS registers. */
static int skmca_config(struct SKMCA_NETDEV *dev, struct ifmap *map) static int skmca_config(struct net_device *dev, struct ifmap *map)
{ {
return 0; return 0;
} }
...@@ -1022,7 +982,7 @@ static int skmca_config(struct SKMCA_NETDEV *dev, struct ifmap *map) ...@@ -1022,7 +982,7 @@ static int skmca_config(struct SKMCA_NETDEV *dev, struct ifmap *map)
/* switch receiver mode. We use the LANCE's multicast filter to prefilter /* switch receiver mode. We use the LANCE's multicast filter to prefilter
multicast addresses. */ multicast addresses. */
static void skmca_set_multicast_list(struct SKMCA_NETDEV *dev) static void skmca_set_multicast_list(struct net_device *dev)
{ {
LANCE_InitBlock block; LANCE_InitBlock block;
...@@ -1062,7 +1022,7 @@ static void skmca_set_multicast_list(struct SKMCA_NETDEV *dev) ...@@ -1062,7 +1022,7 @@ static void skmca_set_multicast_list(struct SKMCA_NETDEV *dev)
static int startslot; /* counts through slots when probing multiple devices */ static int startslot; /* counts through slots when probing multiple devices */
int __init skmca_probe(struct SKMCA_NETDEV *dev) int __init skmca_probe(struct net_device *dev)
{ {
int force_detect = 0; int force_detect = 0;
int junior, slot, i; int junior, slot, i;
...@@ -1095,14 +1055,12 @@ int __init skmca_probe(struct SKMCA_NETDEV *dev) ...@@ -1095,14 +1055,12 @@ int __init skmca_probe(struct SKMCA_NETDEV *dev)
getaddrs(slot, junior, &base, &irq, &medium); getaddrs(slot, junior, &base, &irq, &medium);
#if LINUX_VERSION_CODE >= 0x020300
/* slot already in use ? */ /* slot already in use ? */
if (mca_is_adapter_used(slot)) { if (mca_is_adapter_used(slot)) {
slot = dofind(&junior, slot + 1); slot = dofind(&junior, slot + 1);
continue; continue;
} }
#endif
/* were we looking for something different ? */ /* were we looking for something different ? */
...@@ -1221,24 +1179,13 @@ MODULE_LICENSE("GPL"); ...@@ -1221,24 +1179,13 @@ MODULE_LICENSE("GPL");
#define DEVMAX 5 #define DEVMAX 5
#if (LINUX_VERSION_CODE >= 0x020369) static struct net_device moddevs[DEVMAX] = {
static struct SKMCA_NETDEV moddevs[DEVMAX] = { .name = " ", .init = skmca_probe },
{ {" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe}, { .name = " ", .init = skmca_probe },
{" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe}, { .name = " ", .init = skmca_probe },
{" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe}, { .name = " ", .init = skmca_probe },
{" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe}, { .name = " ", .init = skmca_probe }
{" ", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe}
};
#else
static char NameSpace[8 * DEVMAX];
static struct SKMCA_NETDEV moddevs[DEVMAX] =
{ {NameSpace + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
{NameSpace + 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
{NameSpace + 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
{NameSpace + 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe},
{NameSpace + 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, skmca_probe}
}; };
#endif
int irq; int irq;
int io; int io;
...@@ -1260,7 +1207,7 @@ int init_module(void) ...@@ -1260,7 +1207,7 @@ int init_module(void)
void cleanup_module(void) void cleanup_module(void)
{ {
struct SKMCA_NETDEV *dev; struct net_device *dev;
skmca_priv *priv; skmca_priv *priv;
int z; int z;
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
/* version-dependent functions/structures */ /* version-dependent functions/structures */
#if LINUX_VERSION_CODE >= 0x020318
#define SKMCA_READB(addr) isa_readb(addr) #define SKMCA_READB(addr) isa_readb(addr)
#define SKMCA_READW(addr) isa_readw(addr) #define SKMCA_READW(addr) isa_readw(addr)
#define SKMCA_WRITEB(data, addr) isa_writeb(data, addr) #define SKMCA_WRITEB(data, addr) isa_writeb(data, addr)
...@@ -13,17 +12,6 @@ ...@@ -13,17 +12,6 @@
#define SKMCA_TOIO(dest, src, len) isa_memcpy_toio(dest, src, len) #define SKMCA_TOIO(dest, src, len) isa_memcpy_toio(dest, src, len)
#define SKMCA_FROMIO(dest, src, len) isa_memcpy_fromio(dest, src, len) #define SKMCA_FROMIO(dest, src, len) isa_memcpy_fromio(dest, src, len)
#define SKMCA_SETIO(dest, val, len) isa_memset_io(dest, val, len) #define SKMCA_SETIO(dest, val, len) isa_memset_io(dest, val, len)
#define SKMCA_NETDEV net_device
#else
#define SKMCA_READB(addr) readb(addr)
#define SKMCA_READW(addr) readw(addr)
#define SKMCA_WRITEB(data, addr) writeb(data, addr)
#define SKMCA_WRITEW(data, addr) writew(data, addr)
#define SKMCA_TOIO(dest, src, len) memcpy_toio(dest, src, len)
#define SKMCA_FROMIO(dest, src, len) memcpy_fromio(dest, src, len)
#define SKMCA_SETIO(dest, val, len) memset_io(dest, val, len)
#define SKMCA_NETDEV device
#endif
/* Adapter ID's */ /* Adapter ID's */
#define SKNET_MCA_ID 0x6afd #define SKNET_MCA_ID 0x6afd
...@@ -188,7 +176,7 @@ typedef struct { /* LANCE Rx descriptor */ ...@@ -188,7 +176,7 @@ typedef struct { /* LANCE Rx descriptor */
#endif /* _SK_MCA_DRIVER_ */ #endif /* _SK_MCA_DRIVER_ */
extern int skmca_probe(struct SKMCA_NETDEV *); extern int skmca_probe(struct net_device *);
#endif /* _SK_MCA_INCLUDE_ */ #endif /* _SK_MCA_INCLUDE_ */
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