[PATCH] beginning of 8390 fixes - generic and arm/etherh

etherh and a handful of other odd drivers use different macros when building
8390.c.  Since we generate a single 8390.o and then link with it, in any
config with both oddball and normal 8390-based driver we will end up with
breakage in at least one of them.  Solution: take most of 8390.c into
lib8390.c and have 8390.c, etherh.c and the rest of oddballs #include it.
Helper macros are taken from 8390.h to whoever includes lib8390.c.  That
way odd drivers get separate instances of compiled 8390 stuff and stop
stepping on each other's toes.  8390.h gets cleaned up - we don't have
the cascade of ifdefs in there and are left with the stuff that can be
used by any 8390-based driver.  Current problems are exactly because of
that cascade - we attempt to choose the set of helpers by looking at config
and that, of course, doesn't work well when we have several sets needed
by various drivers in our config.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
Al Viro 2006-10-10 00:19:36 +01:00 committed by Jeff Garzik
parent 865f3b2b6a
commit 6c3561b0c1
5 changed files with 1136 additions and 1100 deletions

File diff suppressed because it is too large Load Diff

View File

@ -116,26 +116,23 @@ struct ei_device {
#undef outb #undef outb
#undef outb_p #undef outb_p
#define inb(port) in_8(port) #define ei_inb(port) in_8(port)
#define outb(val,port) out_8(port,val) #define ei_outb(val,port) out_8(port,val)
#define inb_p(port) in_8(port) #define ei_inb_p(port) in_8(port)
#define outb_p(val,port) out_8(port,val) #define ei_outb_p(val,port) out_8(port,val)
#elif defined(CONFIG_ARM_ETHERH) || defined(CONFIG_ARM_ETHERH_MODULE)
#define EI_SHIFT(x) (ei_local->reg_offset[x])
#undef inb
#undef inb_p
#undef outb
#undef outb_p
#define inb(_p) readb(_p)
#define outb(_v,_p) writeb(_v,_p)
#define inb_p(_p) inb(_p)
#define outb_p(_v,_p) outb(_v,_p)
#elif defined(CONFIG_NE_H8300) || defined(CONFIG_NE_H8300_MODULE) #elif defined(CONFIG_NE_H8300) || defined(CONFIG_NE_H8300_MODULE)
#define EI_SHIFT(x) (ei_local->reg_offset[x]) #define EI_SHIFT(x) (ei_local->reg_offset[x])
#else #endif
#ifndef ei_inb
#define ei_inb(_p) inb(_p)
#define ei_outb(_v,_p) outb(_v,_p)
#define ei_inb_p(_p) inb_p(_p)
#define ei_outb_p(_v,_p) outb_p(_v,_p)
#endif
#ifndef EI_SHIFT
#define EI_SHIFT(x) (x) #define EI_SHIFT(x) (x)
#endif #endif

View File

@ -90,7 +90,6 @@ obj-$(CONFIG_HP100) += hp100.o
obj-$(CONFIG_SMC9194) += smc9194.o obj-$(CONFIG_SMC9194) += smc9194.o
obj-$(CONFIG_FEC) += fec.o obj-$(CONFIG_FEC) += fec.o
obj-$(CONFIG_68360_ENET) += 68360enet.o obj-$(CONFIG_68360_ENET) += 68360enet.o
obj-$(CONFIG_ARM_ETHERH) += 8390.o
obj-$(CONFIG_WD80x3) += wd.o 8390.o obj-$(CONFIG_WD80x3) += wd.o 8390.o
obj-$(CONFIG_EL2) += 3c503.o 8390.o obj-$(CONFIG_EL2) += 3c503.o 8390.o
obj-$(CONFIG_NE2000) += ne.o 8390.o obj-$(CONFIG_NE2000) += ne.o 8390.o

View File

@ -52,7 +52,12 @@
#include <asm/ecard.h> #include <asm/ecard.h>
#include <asm/io.h> #include <asm/io.h>
#include "../8390.h" #define EI_SHIFT(x) (ei_local->reg_offset[x])
#define ei_inb(_p) readb(_p)
#define ei_outb(_v,_p) writeb(_v,_p)
#define ei_inb_p(_p) readb(_p)
#define ei_outb_p(_v,_p) writeb(_v,_p)
#define NET_DEBUG 0 #define NET_DEBUG 0
#define DEBUG_INIT 2 #define DEBUG_INIT 2
@ -60,6 +65,11 @@
#define DRV_NAME "etherh" #define DRV_NAME "etherh"
#define DRV_VERSION "1.11" #define DRV_VERSION "1.11"
static char version[] __initdata =
"EtherH/EtherM Driver (c) 2002-2004 Russell King " DRV_VERSION "\n";
#include "../lib8390.c"
static unsigned int net_debug = NET_DEBUG; static unsigned int net_debug = NET_DEBUG;
struct etherh_priv { struct etherh_priv {
@ -87,9 +97,6 @@ MODULE_AUTHOR("Russell King");
MODULE_DESCRIPTION("EtherH/EtherM driver"); MODULE_DESCRIPTION("EtherH/EtherM driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static char version[] __initdata =
"EtherH/EtherM Driver (c) 2002-2004 Russell King " DRV_VERSION "\n";
#define ETHERH500_DATAPORT 0x800 /* MEMC */ #define ETHERH500_DATAPORT 0x800 /* MEMC */
#define ETHERH500_NS8390 0x000 /* MEMC */ #define ETHERH500_NS8390 0x000 /* MEMC */
#define ETHERH500_CTRLPORT 0x800 /* IOC */ #define ETHERH500_CTRLPORT 0x800 /* IOC */
@ -360,7 +367,7 @@ etherh_block_output (struct net_device *dev, int count, const unsigned char *buf
printk(KERN_ERR "%s: timeout waiting for TX RDC\n", printk(KERN_ERR "%s: timeout waiting for TX RDC\n",
dev->name); dev->name);
etherh_reset (dev); etherh_reset (dev);
NS8390_init (dev, 1); __NS8390_init (dev, 1);
break; break;
} }
@ -465,7 +472,7 @@ etherh_open(struct net_device *dev)
return -EINVAL; return -EINVAL;
} }
if (request_irq(dev->irq, ei_interrupt, 0, dev->name, dev)) if (request_irq(dev->irq, __ei_interrupt, 0, dev->name, dev))
return -EAGAIN; return -EAGAIN;
/* /*
@ -491,7 +498,7 @@ etherh_open(struct net_device *dev)
etherh_setif(dev); etherh_setif(dev);
etherh_reset(dev); etherh_reset(dev);
ei_open(dev); __ei_open(dev);
return 0; return 0;
} }
@ -502,7 +509,7 @@ etherh_open(struct net_device *dev)
static int static int
etherh_close(struct net_device *dev) etherh_close(struct net_device *dev)
{ {
ei_close (dev); __ei_close (dev);
free_irq (dev->irq, dev); free_irq (dev->irq, dev);
return 0; return 0;
} }
@ -650,7 +657,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
if (ret) if (ret)
goto out; goto out;
dev = __alloc_ei_netdev(sizeof(struct etherh_priv)); dev = ____alloc_ei_netdev(sizeof(struct etherh_priv));
if (!dev) { if (!dev) {
ret = -ENOMEM; ret = -ENOMEM;
goto release; goto release;
@ -736,7 +743,7 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
ei_local->interface_num = 0; ei_local->interface_num = 0;
etherh_reset(dev); etherh_reset(dev);
NS8390_init(dev, 0); __NS8390_init(dev, 0);
ret = register_netdev(dev); ret = register_netdev(dev);
if (ret) if (ret)

1097
drivers/net/lib8390.c Normal file

File diff suppressed because it is too large Load Diff