aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wavelan_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2006-03-05 04:45:09 -0500
committerDominik Brodowski <linux@dominikbrodowski.net>2006-03-31 10:15:57 -0500
commitfd238232cd0ff4840ae6946bb338502154096d88 (patch)
treed20e8f5871f7cff9d0867a84f6ba088fbffcbe28 /drivers/net/wireless/wavelan_cs.c
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/wireless/wavelan_cs.c')
-rw-r--r--drivers/net/wireless/wavelan_cs.c46
1 files changed, 16 insertions, 30 deletions
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index daa17dc34320..baa1011e70e0 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -4081,7 +4081,7 @@ wv_pcmcia_config(dev_link_t * link)
4081 } 4081 }
4082 4082
4083 strcpy(((net_local *) netdev_priv(dev))->node.dev_name, dev->name); 4083 strcpy(((net_local *) netdev_priv(dev))->node.dev_name, dev->name);
4084 link->dev = &((net_local *) netdev_priv(dev))->node; 4084 link->dev_node = &((net_local *) netdev_priv(dev))->node;
4085 4085
4086#ifdef DEBUG_CONFIG_TRACE 4086#ifdef DEBUG_CONFIG_TRACE
4087 printk(KERN_DEBUG "<-wv_pcmcia_config()\n"); 4087 printk(KERN_DEBUG "<-wv_pcmcia_config()\n");
@@ -4583,7 +4583,6 @@ wavelan_close(struct net_device * dev)
4583static int 4583static int
4584wavelan_attach(struct pcmcia_device *p_dev) 4584wavelan_attach(struct pcmcia_device *p_dev)
4585{ 4585{
4586 dev_link_t * link; /* Info for cardmgr */
4587 struct net_device * dev; /* Interface generic data */ 4586 struct net_device * dev; /* Interface generic data */
4588 net_local * lp; /* Interface specific data */ 4587 net_local * lp; /* Interface specific data */
4589 4588
@@ -4591,34 +4590,26 @@ wavelan_attach(struct pcmcia_device *p_dev)
4591 printk(KERN_DEBUG "-> wavelan_attach()\n"); 4590 printk(KERN_DEBUG "-> wavelan_attach()\n");
4592#endif 4591#endif
4593 4592
4594 /* Initialize the dev_link_t structure */
4595 link = kzalloc(sizeof(struct dev_link_t), GFP_KERNEL);
4596 if (!link) return -ENOMEM;
4597
4598 /* The io structure describes IO port mapping */ 4593 /* The io structure describes IO port mapping */
4599 link->io.NumPorts1 = 8; 4594 p_dev->io.NumPorts1 = 8;
4600 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 4595 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
4601 link->io.IOAddrLines = 3; 4596 p_dev->io.IOAddrLines = 3;
4602 4597
4603 /* Interrupt setup */ 4598 /* Interrupt setup */
4604 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; 4599 p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
4605 link->irq.IRQInfo1 = IRQ_LEVEL_ID; 4600 p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID;
4606 link->irq.Handler = wavelan_interrupt; 4601 p_dev->irq.Handler = wavelan_interrupt;
4607 4602
4608 /* General socket configuration */ 4603 /* General socket configuration */
4609 link->conf.Attributes = CONF_ENABLE_IRQ; 4604 p_dev->conf.Attributes = CONF_ENABLE_IRQ;
4610 link->conf.IntType = INT_MEMORY_AND_IO; 4605 p_dev->conf.IntType = INT_MEMORY_AND_IO;
4611
4612 /* Chain drivers */
4613 link->next = NULL;
4614 4606
4615 /* Allocate the generic data structure */ 4607 /* Allocate the generic data structure */
4616 dev = alloc_etherdev(sizeof(net_local)); 4608 dev = alloc_etherdev(sizeof(net_local));
4617 if (!dev) { 4609 if (!dev)
4618 kfree(link);
4619 return -ENOMEM; 4610 return -ENOMEM;
4620 } 4611
4621 link->priv = link->irq.Instance = dev; 4612 p_dev->priv = p_dev->irq.Instance = dev;
4622 4613
4623 lp = netdev_priv(dev); 4614 lp = netdev_priv(dev);
4624 4615
@@ -4635,7 +4626,6 @@ wavelan_attach(struct pcmcia_device *p_dev)
4635 spin_lock_init(&lp->spinlock); 4626 spin_lock_init(&lp->spinlock);
4636 4627
4637 /* back links */ 4628 /* back links */
4638 lp->link = link;
4639 lp->dev = dev; 4629 lp->dev = dev;
4640 4630
4641 /* wavelan NET3 callbacks */ 4631 /* wavelan NET3 callbacks */
@@ -4661,11 +4651,8 @@ wavelan_attach(struct pcmcia_device *p_dev)
4661 /* Other specific data */ 4651 /* Other specific data */
4662 dev->mtu = WAVELAN_MTU; 4652 dev->mtu = WAVELAN_MTU;
4663 4653
4664 link->handle = p_dev; 4654 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
4665 p_dev->instance = link; 4655 if(wv_pcmcia_config(p_dev) &&
4666
4667 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
4668 if(wv_pcmcia_config(link) &&
4669 wv_hw_config(dev)) 4656 wv_hw_config(dev))
4670 wv_init_info(dev); 4657 wv_init_info(dev);
4671 else 4658 else
@@ -4713,14 +4700,13 @@ wavelan_detach(struct pcmcia_device *p_dev)
4713 4700
4714 /* Remove ourselves from the kernel list of ethernet devices */ 4701 /* Remove ourselves from the kernel list of ethernet devices */
4715 /* Warning : can't be called from interrupt, timer or wavelan_close() */ 4702 /* Warning : can't be called from interrupt, timer or wavelan_close() */
4716 if (link->dev) 4703 if (link->dev_node)
4717 unregister_netdev(dev); 4704 unregister_netdev(dev);
4718 link->dev = NULL; 4705 link->dev_node = NULL;
4719 ((net_local *)netdev_priv(dev))->link = NULL; 4706 ((net_local *)netdev_priv(dev))->link = NULL;
4720 ((net_local *)netdev_priv(dev))->dev = NULL; 4707 ((net_local *)netdev_priv(dev))->dev = NULL;
4721 free_netdev(dev); 4708 free_netdev(dev);
4722 } 4709 }
4723 kfree(link);
4724 4710
4725#ifdef DEBUG_CALLBACK_TRACE 4711#ifdef DEBUG_CALLBACK_TRACE
4726 printk(KERN_DEBUG "<- wavelan_detach()\n"); 4712 printk(KERN_DEBUG "<- wavelan_detach()\n");