diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-01-15 03:32:39 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:15:50 -0500 |
commit | 5f2a71fcb7995633b335a1e380ac63a968e61320 (patch) | |
tree | d47f4227d314fc9f298b75c217fa78440004e6e7 /drivers/net/wireless | |
parent | 1de9cedfbdff1d8adb662cd3afc5bda66e393351 (diff) |
[PATCH] pcmcia: add pcmcia_disable_device
pcmcia_disable_device(struct pcmcia_device *p_dev) performs the necessary
cleanups upon device or driver removal: it calls the appropriate
pcmcia_release_* functions, and can replace (most) of the current drivers'
_release() functions.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/airo_cs.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/atmel_cs.c | 21 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/netwave_cs.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco_cs.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/spectrum_cs.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/wavelan_cs.c | 18 | ||||
-rw-r--r-- | drivers/net/wireless/wl3501_cs.c | 10 |
8 files changed, 24 insertions, 90 deletions
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index a496460ce224..489ef7f3d950 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -429,24 +429,7 @@ static void airo_config(dev_link_t *link) | |||
429 | static void airo_release(dev_link_t *link) | 429 | static void airo_release(dev_link_t *link) |
430 | { | 430 | { |
431 | DEBUG(0, "airo_release(0x%p)\n", link); | 431 | DEBUG(0, "airo_release(0x%p)\n", link); |
432 | 432 | pcmcia_disable_device(link->handle); | |
433 | /* Unlink the device chain */ | ||
434 | link->dev = NULL; | ||
435 | |||
436 | /* | ||
437 | In a normal driver, additional code may be needed to release | ||
438 | other kernel data structures associated with this device. | ||
439 | */ | ||
440 | |||
441 | /* Don't bother checking to see if these succeed or not */ | ||
442 | if (link->win) | ||
443 | pcmcia_release_window(link->win); | ||
444 | pcmcia_release_configuration(link->handle); | ||
445 | if (link->io.NumPorts1) | ||
446 | pcmcia_release_io(link->handle, &link->io); | ||
447 | if (link->irq.AssignedIRQ) | ||
448 | pcmcia_release_irq(link->handle, &link->irq); | ||
449 | link->state &= ~DEV_CONFIG; | ||
450 | } | 433 | } |
451 | 434 | ||
452 | static int airo_suspend(struct pcmcia_device *p_dev) | 435 | static int airo_suspend(struct pcmcia_device *p_dev) |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index d6f4a5a3e55a..1da8e6197ffb 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -418,23 +418,14 @@ static void atmel_config(dev_link_t *link) | |||
418 | static void atmel_release(dev_link_t *link) | 418 | static void atmel_release(dev_link_t *link) |
419 | { | 419 | { |
420 | struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; | 420 | struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; |
421 | 421 | ||
422 | DEBUG(0, "atmel_release(0x%p)\n", link); | 422 | DEBUG(0, "atmel_release(0x%p)\n", link); |
423 | 423 | ||
424 | /* Unlink the device chain */ | 424 | if (dev) |
425 | link->dev = NULL; | ||
426 | |||
427 | if (dev) | ||
428 | stop_atmel_card(dev); | 425 | stop_atmel_card(dev); |
429 | ((local_info_t*)link->priv)->eth_dev = NULL; | 426 | ((local_info_t*)link->priv)->eth_dev = NULL; |
430 | 427 | ||
431 | /* Don't bother checking to see if these succeed or not */ | 428 | pcmcia_disable_device(link->handle); |
432 | pcmcia_release_configuration(link->handle); | ||
433 | if (link->io.NumPorts1) | ||
434 | pcmcia_release_io(link->handle, &link->io); | ||
435 | if (link->irq.AssignedIRQ) | ||
436 | pcmcia_release_irq(link->handle, &link->irq); | ||
437 | link->state &= ~DEV_CONFIG; | ||
438 | } | 429 | } |
439 | 430 | ||
440 | static int atmel_suspend(struct pcmcia_device *dev) | 431 | static int atmel_suspend(struct pcmcia_device *dev) |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index d335b250923a..7a1023f3875b 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -804,16 +804,7 @@ static void prism2_release(u_long arg) | |||
804 | iface->local->shutdown = 1; | 804 | iface->local->shutdown = 1; |
805 | } | 805 | } |
806 | 806 | ||
807 | if (link->win) | 807 | pcmcia_disable_device(link->handle); |
808 | pcmcia_release_window(link->win); | ||
809 | pcmcia_release_configuration(link->handle); | ||
810 | if (link->io.NumPorts1) | ||
811 | pcmcia_release_io(link->handle, &link->io); | ||
812 | if (link->irq.AssignedIRQ) | ||
813 | pcmcia_release_irq(link->handle, &link->irq); | ||
814 | |||
815 | link->state &= ~DEV_CONFIG; | ||
816 | |||
817 | PDEBUG(DEBUG_FLOW, "release - done\n"); | 808 | PDEBUG(DEBUG_FLOW, "release - done\n"); |
818 | } | 809 | } |
819 | 810 | ||
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 75ce6ddb0cf5..dfb47ac9da50 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -869,21 +869,14 @@ failed: | |||
869 | */ | 869 | */ |
870 | static void netwave_release(dev_link_t *link) | 870 | static void netwave_release(dev_link_t *link) |
871 | { | 871 | { |
872 | struct net_device *dev = link->priv; | 872 | struct net_device *dev = link->priv; |
873 | netwave_private *priv = netdev_priv(dev); | 873 | netwave_private *priv = netdev_priv(dev); |
874 | |||
875 | DEBUG(0, "netwave_release(0x%p)\n", link); | ||
876 | 874 | ||
877 | /* Don't bother checking to see if these succeed or not */ | 875 | DEBUG(0, "netwave_release(0x%p)\n", link); |
878 | if (link->win) { | ||
879 | iounmap(priv->ramBase); | ||
880 | pcmcia_release_window(link->win); | ||
881 | } | ||
882 | pcmcia_release_configuration(link->handle); | ||
883 | pcmcia_release_io(link->handle, &link->io); | ||
884 | pcmcia_release_irq(link->handle, &link->irq); | ||
885 | 876 | ||
886 | link->state &= ~DEV_CONFIG; | 877 | pcmcia_disable_device(link->handle); |
878 | if (link->win) | ||
879 | iounmap(priv->ramBase); | ||
887 | } | 880 | } |
888 | 881 | ||
889 | static int netwave_suspend(struct pcmcia_device *p_dev) | 882 | static int netwave_suspend(struct pcmcia_device *p_dev) |
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index ec6f2a48895b..7fdc4ff55107 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -416,13 +416,7 @@ orinoco_cs_release(dev_link_t *link) | |||
416 | priv->hw_unavailable++; | 416 | priv->hw_unavailable++; |
417 | spin_unlock_irqrestore(&priv->lock, flags); | 417 | spin_unlock_irqrestore(&priv->lock, flags); |
418 | 418 | ||
419 | /* Don't bother checking to see if these succeed or not */ | 419 | pcmcia_disable_device(link->handle); |
420 | pcmcia_release_configuration(link->handle); | ||
421 | if (link->io.NumPorts1) | ||
422 | pcmcia_release_io(link->handle, &link->io); | ||
423 | if (link->irq.AssignedIRQ) | ||
424 | pcmcia_release_irq(link->handle, &link->irq); | ||
425 | link->state &= ~DEV_CONFIG; | ||
426 | if (priv->hw.iobase) | 420 | if (priv->hw.iobase) |
427 | ioport_unmap(priv->hw.iobase); | 421 | ioport_unmap(priv->hw.iobase); |
428 | } /* orinoco_cs_release */ | 422 | } /* orinoco_cs_release */ |
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 5fa6fbe35bb9..78320c1a1c15 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -894,13 +894,7 @@ spectrum_cs_release(dev_link_t *link) | |||
894 | priv->hw_unavailable++; | 894 | priv->hw_unavailable++; |
895 | spin_unlock_irqrestore(&priv->lock, flags); | 895 | spin_unlock_irqrestore(&priv->lock, flags); |
896 | 896 | ||
897 | /* Don't bother checking to see if these succeed or not */ | 897 | pcmcia_disable_device(link->handle); |
898 | pcmcia_release_configuration(link->handle); | ||
899 | if (link->io.NumPorts1) | ||
900 | pcmcia_release_io(link->handle, &link->io); | ||
901 | if (link->irq.AssignedIRQ) | ||
902 | pcmcia_release_irq(link->handle, &link->irq); | ||
903 | link->state &= ~DEV_CONFIG; | ||
904 | if (priv->hw.iobase) | 898 | if (priv->hw.iobase) |
905 | ioport_unmap(priv->hw.iobase); | 899 | ioport_unmap(priv->hw.iobase); |
906 | } /* spectrum_cs_release */ | 900 | } /* spectrum_cs_release */ |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 98122f3a4bc2..696aeb9d8f52 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -4098,24 +4098,18 @@ wv_pcmcia_config(dev_link_t * link) | |||
4098 | static void | 4098 | static void |
4099 | wv_pcmcia_release(dev_link_t *link) | 4099 | wv_pcmcia_release(dev_link_t *link) |
4100 | { | 4100 | { |
4101 | struct net_device * dev = (struct net_device *) link->priv; | 4101 | struct net_device * dev = (struct net_device *) link->priv; |
4102 | net_local * lp = netdev_priv(dev); | 4102 | net_local * lp = netdev_priv(dev); |
4103 | 4103 | ||
4104 | #ifdef DEBUG_CONFIG_TRACE | 4104 | #ifdef DEBUG_CONFIG_TRACE |
4105 | printk(KERN_DEBUG "%s: -> wv_pcmcia_release(0x%p)\n", dev->name, link); | 4105 | printk(KERN_DEBUG "%s: -> wv_pcmcia_release(0x%p)\n", dev->name, link); |
4106 | #endif | 4106 | #endif |
4107 | 4107 | ||
4108 | /* Don't bother checking to see if these succeed or not */ | 4108 | iounmap(lp->mem); |
4109 | iounmap(lp->mem); | 4109 | pcmcia_disable_device(link->handle); |
4110 | pcmcia_release_window(link->win); | ||
4111 | pcmcia_release_configuration(link->handle); | ||
4112 | pcmcia_release_io(link->handle, &link->io); | ||
4113 | pcmcia_release_irq(link->handle, &link->irq); | ||
4114 | |||
4115 | link->state &= ~DEV_CONFIG; | ||
4116 | 4110 | ||
4117 | #ifdef DEBUG_CONFIG_TRACE | 4111 | #ifdef DEBUG_CONFIG_TRACE |
4118 | printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name); | 4112 | printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name); |
4119 | #endif | 4113 | #endif |
4120 | } | 4114 | } |
4121 | 4115 | ||
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 48e10b0c7e74..0c81b3e7d7ff 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -2149,16 +2149,10 @@ static void wl3501_release(dev_link_t *link) | |||
2149 | struct net_device *dev = link->priv; | 2149 | struct net_device *dev = link->priv; |
2150 | 2150 | ||
2151 | /* Unlink the device chain */ | 2151 | /* Unlink the device chain */ |
2152 | if (link->dev) { | 2152 | if (link->dev) |
2153 | unregister_netdev(dev); | 2153 | unregister_netdev(dev); |
2154 | link->dev = NULL; | ||
2155 | } | ||
2156 | 2154 | ||
2157 | /* Don't bother checking to see if these succeed or not */ | 2155 | pcmcia_disable_device(link->handle); |
2158 | pcmcia_release_configuration(link->handle); | ||
2159 | pcmcia_release_io(link->handle, &link->io); | ||
2160 | pcmcia_release_irq(link->handle, &link->irq); | ||
2161 | link->state &= ~DEV_CONFIG; | ||
2162 | } | 2156 | } |
2163 | 2157 | ||
2164 | static int wl3501_suspend(struct pcmcia_device *p_dev) | 2158 | static int wl3501_suspend(struct pcmcia_device *p_dev) |