[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>
This commit is contained in:
Dominik Brodowski
2006-01-15 09:32:39 +01:00
parent 1de9cedfbd
commit 5f2a71fcb7
43 changed files with 153 additions and 401 deletions

View File

@@ -429,24 +429,7 @@ static void airo_config(dev_link_t *link)
static void airo_release(dev_link_t *link)
{
DEBUG(0, "airo_release(0x%p)\n", link);
/* Unlink the device chain */
link->dev = NULL;
/*
In a normal driver, additional code may be needed to release
other kernel data structures associated with this device.
*/
/* Don't bother checking to see if these succeed or not */
if (link->win)
pcmcia_release_window(link->win);
pcmcia_release_configuration(link->handle);
if (link->io.NumPorts1)
pcmcia_release_io(link->handle, &link->io);
if (link->irq.AssignedIRQ)
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
pcmcia_disable_device(link->handle);
}
static int airo_suspend(struct pcmcia_device *p_dev)

View File

@@ -418,23 +418,14 @@ static void atmel_config(dev_link_t *link)
static void atmel_release(dev_link_t *link)
{
struct net_device *dev = ((local_info_t*)link->priv)->eth_dev;
DEBUG(0, "atmel_release(0x%p)\n", link);
/* Unlink the device chain */
link->dev = NULL;
if (dev)
if (dev)
stop_atmel_card(dev);
((local_info_t*)link->priv)->eth_dev = NULL;
/* Don't bother checking to see if these succeed or not */
pcmcia_release_configuration(link->handle);
if (link->io.NumPorts1)
pcmcia_release_io(link->handle, &link->io);
if (link->irq.AssignedIRQ)
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
((local_info_t*)link->priv)->eth_dev = NULL;
pcmcia_disable_device(link->handle);
}
static int atmel_suspend(struct pcmcia_device *dev)

View File

@@ -804,16 +804,7 @@ static void prism2_release(u_long arg)
iface->local->shutdown = 1;
}
if (link->win)
pcmcia_release_window(link->win);
pcmcia_release_configuration(link->handle);
if (link->io.NumPorts1)
pcmcia_release_io(link->handle, &link->io);
if (link->irq.AssignedIRQ)
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
pcmcia_disable_device(link->handle);
PDEBUG(DEBUG_FLOW, "release - done\n");
}

View File

@@ -869,21 +869,14 @@ failed:
*/
static void netwave_release(dev_link_t *link)
{
struct net_device *dev = link->priv;
netwave_private *priv = netdev_priv(dev);
struct net_device *dev = link->priv;
netwave_private *priv = netdev_priv(dev);
DEBUG(0, "netwave_release(0x%p)\n", link);
DEBUG(0, "netwave_release(0x%p)\n", link);
/* Don't bother checking to see if these succeed or not */
if (link->win) {
iounmap(priv->ramBase);
pcmcia_release_window(link->win);
}
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
pcmcia_disable_device(link->handle);
if (link->win)
iounmap(priv->ramBase);
}
static int netwave_suspend(struct pcmcia_device *p_dev)

View File

@@ -416,13 +416,7 @@ orinoco_cs_release(dev_link_t *link)
priv->hw_unavailable++;
spin_unlock_irqrestore(&priv->lock, flags);
/* Don't bother checking to see if these succeed or not */
pcmcia_release_configuration(link->handle);
if (link->io.NumPorts1)
pcmcia_release_io(link->handle, &link->io);
if (link->irq.AssignedIRQ)
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
pcmcia_disable_device(link->handle);
if (priv->hw.iobase)
ioport_unmap(priv->hw.iobase);
} /* orinoco_cs_release */

View File

@@ -894,13 +894,7 @@ spectrum_cs_release(dev_link_t *link)
priv->hw_unavailable++;
spin_unlock_irqrestore(&priv->lock, flags);
/* Don't bother checking to see if these succeed or not */
pcmcia_release_configuration(link->handle);
if (link->io.NumPorts1)
pcmcia_release_io(link->handle, &link->io);
if (link->irq.AssignedIRQ)
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
pcmcia_disable_device(link->handle);
if (priv->hw.iobase)
ioport_unmap(priv->hw.iobase);
} /* spectrum_cs_release */

View File

@@ -4098,24 +4098,18 @@ wv_pcmcia_config(dev_link_t * link)
static void
wv_pcmcia_release(dev_link_t *link)
{
struct net_device * dev = (struct net_device *) link->priv;
net_local * lp = netdev_priv(dev);
struct net_device * dev = (struct net_device *) link->priv;
net_local * lp = netdev_priv(dev);
#ifdef DEBUG_CONFIG_TRACE
printk(KERN_DEBUG "%s: -> wv_pcmcia_release(0x%p)\n", dev->name, link);
printk(KERN_DEBUG "%s: -> wv_pcmcia_release(0x%p)\n", dev->name, link);
#endif
/* Don't bother checking to see if these succeed or not */
iounmap(lp->mem);
pcmcia_release_window(link->win);
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
iounmap(lp->mem);
pcmcia_disable_device(link->handle);
#ifdef DEBUG_CONFIG_TRACE
printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name);
printk(KERN_DEBUG "%s: <- wv_pcmcia_release()\n", dev->name);
#endif
}

View File

@@ -2149,16 +2149,10 @@ static void wl3501_release(dev_link_t *link)
struct net_device *dev = link->priv;
/* Unlink the device chain */
if (link->dev) {
if (link->dev)
unregister_netdev(dev);
link->dev = NULL;
}
/* Don't bother checking to see if these succeed or not */
pcmcia_release_configuration(link->handle);
pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
pcmcia_disable_device(link->handle);
}
static int wl3501_suspend(struct pcmcia_device *p_dev)