summaryrefslogtreecommitdiff
path: root/drivers/net/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-05 10:45:09 +0100
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 17:15:57 +0200
commitfd238232cd0ff4840ae6946bb338502154096d88 (patch)
treed20e8f5871f7cff9d0867a84f6ba088fbffcbe28 /drivers/net/pcmcia
parenta78f4dd331a4f6a396eb5849656a4a72a70a56d7 (diff)
[PATCH] pcmcia: embed dev_link_t into struct pcmcia_device
Embed dev_link_t into struct pcmcia_device(), as they basically address the same entity. The actual contents of dev_link_t will be cleaned up step by step. This patch includes a bugfix from and signed-off-by Andrew Morton. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/pcmcia')
-rw-r--r--drivers/net/pcmcia/3c574_cs.c19
-rw-r--r--drivers/net/pcmcia/3c589_cs.c23
-rw-r--r--drivers/net/pcmcia/axnet_cs.c19
-rw-r--r--drivers/net/pcmcia/com20020_cs.c39
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c19
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c17
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c21
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c21
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c19
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c19
10 files changed, 90 insertions, 126 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 179c9b7ad044..b65758d3c6c5 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -204,7 +204,7 @@ enum Window4 { /* Window 4: Xcvr/media bits. */
#define MEDIA_TP 0x00C0 /* Enable link beat and jabber for 10baseT. */
struct el3_private {
- dev_link_t link;
+ struct pcmcia_device *p_dev;
dev_node_t node;
struct net_device_stats stats;
u16 advertising, partner; /* NWay media advertisement */
@@ -259,8 +259,8 @@ static void tc574_detach(struct pcmcia_device *p_dev);
static int tc574_attach(struct pcmcia_device *p_dev)
{
struct el3_private *lp;
- dev_link_t *link;
struct net_device *dev;
+ dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "3c574_attach()\n");
@@ -269,8 +269,8 @@ static int tc574_attach(struct pcmcia_device *p_dev)
if (!dev)
return -ENOMEM;
lp = netdev_priv(dev);
- link = &lp->link;
link->priv = dev;
+ lp->p_dev = p_dev;
spin_lock_init(&lp->window_lock);
link->io.NumPorts1 = 32;
@@ -297,9 +297,6 @@ static int tc574_attach(struct pcmcia_device *p_dev)
dev->watchdog_timeo = TX_TIMEOUT;
#endif
- link->handle = p_dev;
- p_dev->instance = link;
-
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
tc574_config(link);
@@ -322,7 +319,7 @@ static void tc574_detach(struct pcmcia_device *p_dev)
DEBUG(0, "3c574_detach(0x%p)\n", link);
- if (link->dev)
+ if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
@@ -473,12 +470,12 @@ static void tc574_config(dev_link_t *link)
}
link->state &= ~DEV_CONFIG_PENDING;
- link->dev = &lp->node;
+ link->dev_node = &lp->node;
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
if (register_netdev(dev) != 0) {
printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n");
- link->dev = NULL;
+ link->dev_node = NULL;
goto failed;
}
@@ -742,7 +739,7 @@ static void tc574_reset(struct net_device *dev)
static int el3_open(struct net_device *dev)
{
struct el3_private *lp = netdev_priv(dev);
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
if (!DEV_OK(link))
return -ENODEV;
@@ -1188,7 +1185,7 @@ static int el3_close(struct net_device *dev)
{
kio_addr_t ioaddr = dev->base_addr;
struct el3_private *lp = netdev_priv(dev);
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
DEBUG(2, "%s: shutting down ethercard.\n", dev->name);
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index 7e8036f2e19e..4faf1fa08254 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -105,7 +105,7 @@ enum RxFilter {
#define TX_TIMEOUT ((400*HZ)/1000)
struct el3_private {
- dev_link_t link;
+ struct pcmcia_device *p_dev;
dev_node_t node;
struct net_device_stats stats;
/* For transceiver monitoring */
@@ -173,8 +173,8 @@ static void tc589_detach(struct pcmcia_device *p_dev);
static int tc589_attach(struct pcmcia_device *p_dev)
{
struct el3_private *lp;
- dev_link_t *link;
struct net_device *dev;
+ dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "3c589_attach()\n");
@@ -183,8 +183,8 @@ static int tc589_attach(struct pcmcia_device *p_dev)
if (!dev)
return -ENOMEM;
lp = netdev_priv(dev);
- link = &lp->link;
link->priv = dev;
+ lp->p_dev = p_dev;
spin_lock_init(&lp->lock);
link->io.NumPorts1 = 16;
@@ -212,9 +212,6 @@ static int tc589_attach(struct pcmcia_device *p_dev)
#endif
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
- link->handle = p_dev;
- p_dev->instance = link;
-
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
tc589_config(link);
@@ -237,7 +234,7 @@ static void tc589_detach(struct pcmcia_device *p_dev)
DEBUG(0, "3c589_detach(0x%p)\n", link);
- if (link->dev)
+ if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
@@ -345,13 +342,13 @@ static void tc589_config(dev_link_t *link)
else
printk(KERN_ERR "3c589_cs: invalid if_port requested\n");
- link->dev = &lp->node;
+ link->dev_node = &lp->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
if (register_netdev(dev) != 0) {
printk(KERN_ERR "3c589_cs: register_netdev() failed\n");
- link->dev = NULL;
+ link->dev_node = NULL;
goto failed;
}
@@ -572,7 +569,7 @@ static int el3_config(struct net_device *dev, struct ifmap *map)
static int el3_open(struct net_device *dev)
{
struct el3_private *lp = netdev_priv(dev);
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
if (!DEV_OK(link))
return -ENODEV;
@@ -833,7 +830,7 @@ static struct net_device_stats *el3_get_stats(struct net_device *dev)
{
struct el3_private *lp = netdev_priv(dev);
unsigned long flags;
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
if (DEV_OK(link)) {
spin_lock_irqsave(&lp->lock, flags);
@@ -935,7 +932,7 @@ static int el3_rx(struct net_device *dev)
static void set_multicast_list(struct net_device *dev)
{
struct el3_private *lp = netdev_priv(dev);
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
kio_addr_t ioaddr = dev->base_addr;
u16 opts = SetRxFilter | RxStation | RxBroadcast;
@@ -950,7 +947,7 @@ static void set_multicast_list(struct net_device *dev)
static int el3_close(struct net_device *dev)
{
struct el3_private *lp = netdev_priv(dev);
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
kio_addr_t ioaddr = dev->base_addr;
DEBUG(1, "%s: shutting down ethercard.\n", dev->name);
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 5ca0d5718583..58dc7c3835f4 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -117,7 +117,7 @@ static irqreturn_t ax_interrupt(int irq, void *dev_id, struct pt_regs *regs);
/*====================================================================*/
typedef struct axnet_dev_t {
- dev_link_t link;
+ struct pcmcia_device *p_dev;
dev_node_t node;
caddr_t base;
struct timer_list watchdog;
@@ -145,8 +145,8 @@ static inline axnet_dev_t *PRIV(struct net_device *dev)
static int axnet_attach(struct pcmcia_device *p_dev)
{
axnet_dev_t *info;
- dev_link_t *link;
struct net_device *dev;
+ dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "axnet_attach()\n");
@@ -157,7 +157,7 @@ static int axnet_attach(struct pcmcia_device *p_dev)
return -ENOMEM;
info = PRIV(dev);
- link = &info->link;
+ info->p_dev = p_dev;
link->priv = dev;
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
link->irq.IRQInfo1 = IRQ_LEVEL_ID;
@@ -169,9 +169,6 @@ static int axnet_attach(struct pcmcia_device *p_dev)
dev->do_ioctl = &axnet_ioctl;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
- link->handle = p_dev;
- p_dev->instance = link;
-
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
axnet_config(link);
@@ -194,7 +191,7 @@ static void axnet_detach(struct pcmcia_device *p_dev)
DEBUG(0, "axnet_detach(0x%p)\n", link);
- if (link->dev)
+ if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
@@ -409,13 +406,13 @@ static void axnet_config(dev_link_t *link)
}
info->phy_id = (i < 32) ? i : -1;
- link->dev = &info->node;
+ link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
if (register_netdev(dev) != 0) {
printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n");
- link->dev = NULL;
+ link->dev_node = NULL;
goto failed;
}
@@ -543,7 +540,7 @@ static void mdio_write(kio_addr_t addr, int phy_id, int loc, int value)
static int axnet_open(struct net_device *dev)
{
axnet_dev_t *info = PRIV(dev);
- dev_link_t *link = &info->link;
+ dev_link_t *link = info->p_dev;
DEBUG(2, "axnet_open('%s')\n", dev->name);
@@ -569,7 +566,7 @@ static int axnet_open(struct net_device *dev)
static int axnet_close(struct net_device *dev)
{
axnet_dev_t *info = PRIV(dev);
- dev_link_t *link = &info->link;
+ dev_link_t *link = info->p_dev;
DEBUG(2, "axnet_close('%s')\n", dev->name);
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index e14d3d18b97d..44da01cdd26f 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -140,7 +140,6 @@ typedef struct com20020_dev_t {
static int com20020_attach(struct pcmcia_device *p_dev)
{
- dev_link_t *link;
com20020_dev_t *info;
struct net_device *dev;
struct arcnet_local *lp;
@@ -148,10 +147,6 @@ static int com20020_attach(struct pcmcia_device *p_dev)
DEBUG(0, "com20020_attach()\n");
/* Create new network device */
- link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
- if (!link)
- return -ENOMEM;
-
info = kmalloc(sizeof(struct com20020_dev_t), GFP_KERNEL);
if (!info)
goto fail_alloc_info;
@@ -161,7 +156,6 @@ static int com20020_attach(struct pcmcia_device *p_dev)
goto fail_alloc_dev;
memset(info, 0, sizeof(struct com20020_dev_t));
- memset(link, 0, sizeof(struct dev_link_t));
lp = dev->priv;
lp->timeout = timeout;
lp->backplane = backplane;
@@ -172,27 +166,26 @@ static int com20020_attach(struct pcmcia_device *p_dev)
/* fill in our module parameters as defaults */
dev->dev_addr[0] = node;
- link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
- link->io.NumPorts1 = 16;
- link->io.IOAddrLines = 16;
- link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
- link->irq.IRQInfo1 = IRQ_LEVEL_ID;
- link->conf.Attributes = CONF_ENABLE_IRQ;
- link->conf.IntType = INT_MEMORY_AND_IO;
- link->conf.Present = PRESENT_OPTION;
+ p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
+ p_dev->io.NumPorts1 = 16;
+ p_dev->io.IOAddrLines = 16;
+ p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
+ p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
+ p_dev->conf.Attributes = CONF_ENABLE_IRQ;
+ p_dev->conf.IntType = INT_MEMORY_AND_IO;
+ p_dev->conf.Present = PRESENT_OPTION;
- link->irq.Instance = info->dev = dev;
- link->priv = info;
+ p_dev->irq.Instance = info->dev = dev;
+ p_dev->priv = info;
- link->state |= DEV_PRESENT;
- com20020_config(link);
+ p_dev->state |= DEV_PRESENT;
+ com20020_config(p_dev);
return 0;
fail_alloc_dev:
kfree(info);
fail_alloc_info:
- kfree(link);
return -ENOMEM;
} /* com20020_attach */
@@ -215,7 +208,7 @@ static void com20020_detach(struct pcmcia_device *p_dev)
DEBUG(0, "com20020_detach(0x%p)\n", link);
- if (link->dev) {
+ if (link->dev_node) {
DEBUG(1,"unregister...\n");
unregister_netdev(dev);
@@ -244,8 +237,6 @@ static void com20020_detach(struct pcmcia_device *p_dev)
DEBUG(1,"kfree2...\n");
kfree(info);
}
- DEBUG(1,"kfree3...\n");
- kfree(link);
} /* com20020_detach */
@@ -341,7 +332,7 @@ static void com20020_config(dev_link_t *link)
lp->card_name = "PCMCIA COM20020";
lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */
- link->dev = &info->node;
+ link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
@@ -349,7 +340,7 @@ static void com20020_config(dev_link_t *link)
if (i != 0) {
DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n");
- link->dev = NULL;
+ link->dev_node = NULL;
goto failed;
}
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 34bf963b1296..3f0ace4ed732 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -116,7 +116,7 @@ typedef enum { MBH10302, MBH10304, TDK, CONTEC, LA501, UNGERMANN,
driver specific data structure
*/
typedef struct local_info_t {
- dev_link_t link;
+ struct pcmcia_device *p_dev;
dev_node_t node;
struct net_device_stats stats;
long open_time;
@@ -231,8 +231,8 @@ typedef struct local_info_t {
static int fmvj18x_attach(struct pcmcia_device *p_dev)
{
local_info_t *lp;
- dev_link_t *link;
struct net_device *dev;
+ dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "fmvj18x_attach()\n");
@@ -241,8 +241,8 @@ static int fmvj18x_attach(struct pcmcia_device *p_dev)
if (!dev)
return -ENOMEM;
lp = netdev_priv(dev);
- link = &lp->link;
link->priv = dev;
+ lp->p_dev = p_dev;
/* The io structure describes IO port mapping */
link->io.NumPorts1 = 32;
@@ -273,9 +273,6 @@ static int fmvj18x_attach(struct pcmcia_device *p_dev)
#endif
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
- link->handle = p_dev;
- p_dev->instance = link;
-
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
fmvj18x_config(link);
@@ -291,7 +288,7 @@ static void fmvj18x_detach(struct pcmcia_device *p_dev)
DEBUG(0, "fmvj18x_detach(0x%p)\n", link);
- if (link->dev)
+ if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
@@ -539,13 +536,13 @@ static void fmvj18x_config(dev_link_t *link)
}
lp->cardtype = cardtype;
- link->dev = &lp->node;
+ link->dev_node = &lp->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
if (register_netdev(dev) != 0) {
printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n");
- link->dev = NULL;
+ link->dev_node = NULL;
goto failed;
}
@@ -1125,7 +1122,7 @@ static int fjn_config(struct net_device *dev, struct ifmap *map){
static int fjn_open(struct net_device *dev)
{
struct local_info_t *lp = netdev_priv(dev);
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
DEBUG(4, "fjn_open('%s').\n", dev->name);
@@ -1150,7 +1147,7 @@ static int fjn_open(struct net_device *dev)
static int fjn_close(struct net_device *dev)
{
struct local_info_t *lp = netdev_priv(dev);
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
kio_addr_t ioaddr = dev->base_addr;
DEBUG(4, "fjn_close('%s').\n", dev->name);
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 904c5cb04e71..f4c3dd870aca 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -113,7 +113,7 @@ static void ibmtr_detach(struct pcmcia_device *p_dev);
/*====================================================================*/
typedef struct ibmtr_dev_t {
- dev_link_t link;
+ struct pcmcia_device *p_dev;
struct net_device *dev;
dev_node_t node;
window_handle_t sram_win_handle;
@@ -141,8 +141,8 @@ static struct ethtool_ops netdev_ethtool_ops = {
static int ibmtr_attach(struct pcmcia_device *p_dev)
{
ibmtr_dev_t *info;
- dev_link_t *link;
struct net_device *dev;
+ dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "ibmtr_attach()\n");
@@ -156,7 +156,7 @@ static int ibmtr_attach(struct pcmcia_device *p_dev)
return -ENOMEM;
}
- link = &info->link;
+ info->p_dev = p_dev;
link->priv = info;
info->ti = netdev_priv(dev);
@@ -171,11 +171,8 @@ static int ibmtr_attach(struct pcmcia_device *p_dev)
link->conf.Present = PRESENT_OPTION;
link->irq.Instance = info->dev = dev;
-
- SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
- link->handle = p_dev;
- p_dev->instance = link;
+ SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
link->state |= DEV_PRESENT;
ibmtr_config(link);
@@ -200,7 +197,7 @@ static void ibmtr_detach(struct pcmcia_device *p_dev)
DEBUG(0, "ibmtr_detach(0x%p)\n", link);
- if (link->dev)
+ if (link->dev_node)
unregister_netdev(dev);
{
@@ -308,14 +305,14 @@ static void ibmtr_config(dev_link_t *link)
Adapters Technical Reference" SC30-3585 for this info. */
ibmtr_hw_setup(dev, mmiobase);
- link->dev = &info->node;
+ link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
i = ibmtr_probe_card(dev);
if (i != 0) {
printk(KERN_NOTICE "ibmtr_cs: register_netdev() failed\n");
- link->dev = NULL;
+ link->dev_node = NULL;
goto failed;
}
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index c25d9451d574..0ccca12d9d6e 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -362,7 +362,7 @@ typedef struct _mace_statistics {
} mace_statistics;
typedef struct _mace_private {
- dev_link_t link;
+ struct pcmcia_device *p_dev;
dev_node_t node;
struct net_device_stats linux_stats; /* Linux statistics counters */
mace_statistics mace_stats; /* MACE chip statistics counters */
@@ -446,8 +446,8 @@ nmclan_attach
static int nmclan_attach(struct pcmcia_device *p_dev)
{
mace_private *lp;
- dev_link_t *link;
struct net_device *dev;
+ dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "nmclan_attach()\n");
DEBUG(1, "%s\n", rcsid);
@@ -457,7 +457,7 @@ static int nmclan_attach(struct pcmcia_device *p_dev)
if (!dev)
return -ENOMEM;
lp = netdev_priv(dev);
- link = &lp->link;
+ lp->p_dev = p_dev;
link->priv = dev;
spin_lock_init(&lp->bank_lock);
@@ -488,9 +488,6 @@ static int nmclan_attach(struct pcmcia_device *p_dev)
dev->watchdog_timeo = TX_TIMEOUT;
#endif
- link->handle = p_dev;
- p_dev->instance = link;
-
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
nmclan_config(link);
@@ -512,7 +509,7 @@ static void nmclan_detach(struct pcmcia_device *p_dev)
DEBUG(0, "nmclan_detach(0x%p)\n", link);
- if (link->dev)
+ if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
@@ -729,14 +726,14 @@ static void nmclan_config(dev_link_t *link)
else
printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n");
- link->dev = &lp->node;
+ link->dev_node = &lp->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
i = register_netdev(dev);
if (i != 0) {
printk(KERN_NOTICE "nmclan_cs: register_netdev() failed\n");
- link->dev = NULL;
+ link->dev_node = NULL;
goto failed;
}
@@ -869,7 +866,7 @@ static int mace_open(struct net_device *dev)
{
kio_addr_t ioaddr = dev->base_addr;
mace_private *lp = netdev_priv(dev);
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
if (!DEV_OK(link))
return -ENODEV;
@@ -892,7 +889,7 @@ static int mace_close(struct net_device *dev)
{
kio_addr_t ioaddr = dev->base_addr;
mace_private *lp = netdev_priv(dev);
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
DEBUG(2, "%s: shutting down ethercard.\n", dev->name);
@@ -947,7 +944,7 @@ mace_start_xmit
static void mace_tx_timeout(struct net_device *dev)
{
mace_private *lp = netdev_priv(dev);
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name);
#if RESET_ON_TIMEOUT
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 5a7e58af0b3b..8ed6a410ea10 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -214,7 +214,7 @@ static hw_info_t dl10019_info = { 0, 0, 0, 0, IS_DL10019|HAS_MII };
static hw_info_t dl10022_info = { 0, 0, 0, 0, IS_DL10022|HAS_MII };
typedef struct pcnet_dev_t {
- dev_link_t link;
+ struct pcmcia_device *p_dev;
dev_node_t node;
u_int flags;
void __iomem *base;
@@ -243,8 +243,8 @@ static inline pcnet_dev_t *PRIV(struct net_device *dev)
static int pcnet_probe(struct pcmcia_device *p_dev)
{
pcnet_dev_t *info;
- dev_link_t *link;
struct net_device *dev;
+ dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "pcnet_attach()\n");
@@ -252,7 +252,7 @@ static int pcnet_probe(struct pcmcia_device *p_dev)
dev = __alloc_ei_netdev(sizeof(pcnet_dev_t));
if (!dev) return -ENOMEM;
info = PRIV(dev);
- link = &info->link;
+ info->p_dev = p_dev;
link->priv = dev;
link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;
@@ -265,9 +265,6 @@ static int pcnet_probe(struct pcmcia_device *p_dev)
dev->stop = &pcnet_close;
dev->set_config = &set_config;
- link->handle = p_dev;
- p_dev->instance = link;
-
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
pcnet_config(link);
@@ -290,7 +287,7 @@ static void pcnet_detach(struct pcmcia_device *p_dev)
DEBUG(0, "pcnet_detach(0x%p)\n", link);
- if (link->dev)
+ if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
@@ -674,7 +671,7 @@ static void pcnet_config(dev_link_t *link)
info->eth_phy = 0;
}
- link->dev = &info->node;
+ link->dev_node = &info->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
@@ -684,7 +681,7 @@ static void pcnet_config(dev_link_t *link)
if (register_netdev(dev) != 0) {
printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n");
- link->dev = NULL;
+ link->dev_node = NULL;
goto failed;
}
@@ -1005,8 +1002,8 @@ static void mii_phy_probe(struct net_device *dev)
static int pcnet_open(struct net_device *dev)
{
pcnet_dev_t *info = PRIV(dev);
- dev_link_t *link = &info->link;
-
+ dev_link_t *link = info->p_dev;
+
DEBUG(2, "pcnet_open('%s')\n", dev->name);
if (!DEV_OK(link))
@@ -1033,7 +1030,7 @@ static int pcnet_open(struct net_device *dev)
static int pcnet_close(struct net_device *dev)
{
pcnet_dev_t *info = PRIV(dev);
- dev_link_t *link = &info->link;
+ dev_link_t *link = info->p_dev;
DEBUG(2, "pcnet_close('%s')\n", dev->name);
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index b46b7e148390..a18b02a9a687 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -104,7 +104,7 @@ static const char *version =
#define MEMORY_WAIT_TIME 8
struct smc_private {
- dev_link_t link;
+ struct pcmcia_device *p_dev;
spinlock_t lock;
u_short manfid;
u_short cardid;
@@ -312,8 +312,8 @@ static struct ethtool_ops ethtool_ops;
static int smc91c92_attach(struct pcmcia_device *p_dev)
{
struct smc_private *smc;
- dev_link_t *link;
struct net_device *dev;
+ dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "smc91c92_attach()\n");
@@ -322,7 +322,7 @@ static int smc91c92_attach(struct pcmcia_device *p_dev)
if (!dev)
return -ENOMEM;
smc = netdev_priv(dev);
- link = &smc->link;
+ smc->p_dev = p_dev;
link->priv = dev;
spin_lock_init(&smc->lock);
@@ -357,9 +357,6 @@ static int smc91c92_attach(struct pcmcia_device *p_dev)
smc->mii_if.phy_id_mask = 0x1f;
smc->mii_if.reg_num_mask = 0x1f;
- link->handle = p_dev;
- p_dev->instance = link;
-
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
smc91c92_config(link);
@@ -382,7 +379,7 @@ static void smc91c92_detach(struct pcmcia_device *p_dev)
DEBUG(0, "smc91c92_detach(0x%p)\n", link);
- if (link->dev)
+ if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
@@ -1120,13 +1117,13 @@ static void smc91c92_config(dev_link_t *link)
SMC_SELECT_BANK(0);
}
- link->dev = &smc->node;
+ link->dev_node = &smc->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
if (register_netdev(dev) != 0) {
printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n");
- link->dev = NULL;
+ link->dev_node = NULL;
goto config_undo;
}
@@ -1272,7 +1269,7 @@ static void smc_dump(struct net_device *dev)
static int smc_open(struct net_device *dev)
{
struct smc_private *smc = netdev_priv(dev);
- dev_link_t *link = &smc->link;
+ dev_link_t *link = smc->p_dev;
#ifdef PCMCIA_DEBUG
DEBUG(0, "%s: smc_open(%p), ID/Window %4.4x.\n",
@@ -1309,7 +1306,7 @@ static int smc_open(struct net_device *dev)
static int smc_close(struct net_device *dev)
{
struct smc_private *smc = netdev_priv(dev);
- dev_link_t *link = &smc->link;
+ dev_link_t *link = smc->p_dev;
kio_addr_t ioaddr = dev->base_addr;
DEBUG(0, "%s: smc_close(), status %4.4x.\n",
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index f5fa86d046d4..94a1e644abdc 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -332,7 +332,7 @@ static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id, struct pt_regs *regs
*/
typedef struct local_info_t {
- dev_link_t link;
+ struct pcmcia_device *p_dev;
dev_node_t node;
struct net_device_stats stats;
int card_type;
@@ -555,9 +555,9 @@ mii_wr(kio_addr_t ioaddr, u_char phyaddr, u_char phyreg, unsigned data, int len)
static int
xirc2ps_attach(struct pcmcia_device *p_dev)
{
- dev_link_t *link;
struct net_device *dev;
local_info_t *local;
+ dev_link_t *link = dev_to_instance(p_dev);
DEBUG(0, "attach()\n");
@@ -566,7 +566,7 @@ xirc2ps_attach(struct pcmcia_device *p_dev)
if (!dev)
return -ENOMEM;
local = netdev_priv(dev);
- link = &local->link;
+ local->p_dev = p_dev;
link->priv = dev;
/* General socket configuration */
@@ -592,9 +592,6 @@ xirc2ps_attach(struct pcmcia_device *p_dev)
dev->watchdog_timeo = TX_TIMEOUT;
#endif
- link->handle = p_dev;
- p_dev->instance = link;
-
link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
xirc2ps_config(link);
@@ -616,7 +613,7 @@ xirc2ps_detach(struct pcmcia_device *p_dev)
DEBUG(0, "detach(0x%p)\n", link);
- if (link->dev)
+ if (link->dev_node)
unregister_netdev(dev);
if (link->state & DEV_CONFIG)
@@ -1049,13 +1046,13 @@ xirc2ps_config(dev_link_t * link)
if (local->dingo)
do_reset(dev, 1); /* a kludge to make the cem56 work */
- link->dev = &local->node;
+ link->dev_node = &local->node;
link->state &= ~DEV_CONFIG_PENDING;
SET_NETDEV_DEV(dev, &handle_to_dev(handle));
if ((err=register_netdev(dev))) {
printk(KNOT_XIRC "register_netdev() failed\n");
- link->dev = NULL;
+ link->dev_node = NULL;
goto config_error;
}
@@ -1537,7 +1534,7 @@ static int
do_open(struct net_device *dev)
{
local_info_t *lp = netdev_priv(dev);
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
DEBUG(0, "do_open(%p)\n", dev);
@@ -1867,7 +1864,7 @@ do_stop(struct net_device *dev)
{
kio_addr_t ioaddr = dev->base_addr;
local_info_t *lp = netdev_priv(dev);
- dev_link_t *link = &lp->link;
+ dev_link_t *link = lp->p_dev;
DEBUG(0, "do_stop(%p)\n", dev);