Commit dc36ad08 authored by Russell King's avatar Russell King Committed by Russell King

[PATCH] Wireless pcmcia netdev patches

On Mon, Nov 17, 2003 at 02:57:44PM -0800, Jean Tourrilhes wrote:
> On Sun, Nov 16, 2003 at 11:33:01PM +0000, Russell King wrote:
> > Jean,
> >
> > Could you please arrange for this patch to be tested?  It covers all
> > the PCMCIA wireless drivers in 2.6.0-test9; I haven't been able to
> > test.
>
> 	Dual P500, kernel 2.6.0-test9 + your patch.
> -------------------------------------------------
>...
> 	Few comments :
> 	o Yanked the cards out of the socket, cardmgr did ifconfig
> down and removal of module automatically.
> 	o I did not see any patch for the Orinoco driver, but I did
> not check if it needs one. Did not look at HostAP either...
> 	o wl3501_cs : ask Arnaldo.
> 	o With 2.6.0-test9, I had instances of "can't read CIS". I
> actually had to reboot to perform the test.
> 	o The kobject Oops is something I think I saw before. I never
> remove my Aironet card because I don't want to reboot :-( This time,
> it seems to have survived better, so I see that as progress ;-)

This patch seems to have been forgotten about, so here it is again,
this time against 2.6.4-rc1.  This really needs to be send upstream,
though I don't know where we got to with this one.  Maybe we should
put it in akpm's tree for a while?

It's essentially more of the "don't deadlock if you pull out a
PCMCIA network card and it's currently configured up" patch which
went in recently for PCMCIA NIC cards.
parent 980a33b0
...@@ -264,11 +264,8 @@ static void airo_detach(dev_link_t *link) ...@@ -264,11 +264,8 @@ static void airo_detach(dev_link_t *link)
if (*linkp == NULL) if (*linkp == NULL)
return; return;
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG)
airo_release(link); airo_release(link);
if (link->state & DEV_STALE_CONFIG)
return;
}
if ( ((local_info_t*)link->priv)->eth_dev ) { if ( ((local_info_t*)link->priv)->eth_dev ) {
stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 ); stop_airo_card( ((local_info_t*)link->priv)->eth_dev, 0 );
...@@ -504,18 +501,6 @@ static void airo_release(dev_link_t *link) ...@@ -504,18 +501,6 @@ static void airo_release(dev_link_t *link)
{ {
DEBUG(0, "airo_release(0x%p)\n", link); DEBUG(0, "airo_release(0x%p)\n", link);
/*
If the device is currently in use, we won't release until it
is actually closed, because until then, we can't be sure that
no one will try to access the device or its data structures.
*/
if (link->open) {
DEBUG(1, "airo_cs: release postponed, '%s' still open\n",
link->dev->dev_name);
link->state |= DEV_STALE_CONFIG;
return;
}
/* Unlink the device chain */ /* Unlink the device chain */
link->dev = NULL; link->dev = NULL;
...@@ -533,9 +518,6 @@ static void airo_release(dev_link_t *link) ...@@ -533,9 +518,6 @@ static void airo_release(dev_link_t *link)
if (link->irq.AssignedIRQ) if (link->irq.AssignedIRQ)
pcmcia_release_irq(link->handle, &link->irq); pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
if (link->state & DEV_STALE_CONFIG)
airo_detach(link);
} }
/*====================================================================== /*======================================================================
......
...@@ -544,14 +544,8 @@ static void netwave_detach(dev_link_t *link) ...@@ -544,14 +544,8 @@ static void netwave_detach(dev_link_t *link)
the release() function is called, that will trigger a proper the release() function is called, that will trigger a proper
detach(). detach().
*/ */
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG)
netwave_release(link); netwave_release(link);
if (link->state & DEV_STALE_CONFIG) {
DEBUG(1, "netwave_cs: detach postponed, '%s' still "
"locked\n", link->dev->dev_name);
return;
}
}
/* Break the link with Card Services */ /* Break the link with Card Services */
if (link->handle) if (link->handle)
...@@ -1130,17 +1124,6 @@ static void netwave_release(dev_link_t *link) ...@@ -1130,17 +1124,6 @@ static void netwave_release(dev_link_t *link)
DEBUG(0, "netwave_release(0x%p)\n", link); DEBUG(0, "netwave_release(0x%p)\n", link);
/*
If the device is currently in use, we won't release until it
is actually closed.
*/
if (link->open) {
printk(KERN_DEBUG "netwave_cs: release postponed, '%s' still open\n",
link->dev->dev_name);
link->state |= DEV_STALE_CONFIG;
return;
}
/* Don't bother checking to see if these succeed or not */ /* Don't bother checking to see if these succeed or not */
if (link->win) { if (link->win) {
iounmap(priv->ramBase); iounmap(priv->ramBase);
...@@ -1151,9 +1134,6 @@ static void netwave_release(dev_link_t *link) ...@@ -1151,9 +1134,6 @@ static void netwave_release(dev_link_t *link)
pcmcia_release_irq(link->handle, &link->irq); pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
if (link->state & DEV_STALE_CONFIG)
netwave_detach(link);
} }
/* /*
...@@ -1703,8 +1683,7 @@ static int netwave_close(struct net_device *dev) { ...@@ -1703,8 +1683,7 @@ static int netwave_close(struct net_device *dev) {
link->open--; link->open--;
netif_stop_queue(dev); netif_stop_queue(dev);
if (link->state & DEV_STALE_CONFIG)
netwave_release(link);
return 0; return 0;
} }
......
...@@ -454,11 +454,8 @@ static void ray_detach(dev_link_t *link) ...@@ -454,11 +454,8 @@ static void ray_detach(dev_link_t *link)
the release() function is called, that will trigger a proper the release() function is called, that will trigger a proper
detach(). detach().
*/ */
if (link->state & DEV_CONFIG) { if (link->state & DEV_CONFIG)
ray_release(link); ray_release(link);
if(link->state & DEV_STALE_CONFIG)
return;
}
/* Break the link with Card Services */ /* Break the link with Card Services */
if (link->handle) if (link->handle)
...@@ -872,15 +869,7 @@ static void ray_release(dev_link_t *link) ...@@ -872,15 +869,7 @@ static void ray_release(dev_link_t *link)
int i; int i;
DEBUG(1, "ray_release(0x%p)\n", link); DEBUG(1, "ray_release(0x%p)\n", link);
/* If the device is currently in use, we won't release until it
is actually closed.
*/
if (link->open) {
DEBUG(1, "ray_cs: release postponed, '%s' still open\n",
link->dev->dev_name);
link->state |= DEV_STALE_CONFIG;
return;
}
del_timer(&local->timer); del_timer(&local->timer);
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
...@@ -900,9 +889,6 @@ static void ray_release(dev_link_t *link) ...@@ -900,9 +889,6 @@ static void ray_release(dev_link_t *link)
if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseIRQ ret = %x\n",i); if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseIRQ ret = %x\n",i);
DEBUG(2,"ray_release ending\n"); DEBUG(2,"ray_release ending\n");
if (link->state & DEV_STALE_CONFIG)
ray_detach(link);
} }
/*============================================================================= /*=============================================================================
...@@ -1724,8 +1710,6 @@ static int ray_dev_close(struct net_device *dev) ...@@ -1724,8 +1710,6 @@ static int ray_dev_close(struct net_device *dev)
link->open--; link->open--;
netif_stop_queue(dev); netif_stop_queue(dev);
if (link->state & DEV_STALE_CONFIG)
ray_release(link);
/* In here, we should stop the hardware (stop card from beeing active) /* In here, we should stop the hardware (stop card from beeing active)
* and set local->card_status to CARD_AWAITING_PARAM, so that while the * and set local->card_status to CARD_AWAITING_PARAM, so that while the
......
...@@ -4155,18 +4155,6 @@ wv_pcmcia_release(dev_link_t *link) ...@@ -4155,18 +4155,6 @@ wv_pcmcia_release(dev_link_t *link)
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 #endif
/* If the device is currently in use, we won't release until it is
* actually closed. */
if(link->open)
{
#ifdef DEBUG_CONFIG_INFO
printk(KERN_DEBUG "%s: wv_pcmcia_release: release postponed, device still open\n",
dev->name);
#endif
link->state |= DEV_STALE_CONFIG;
return;
}
/* Don't bother checking to see if these succeed or not */ /* Don't bother checking to see if these succeed or not */
iounmap((u_char *)dev->mem_start); iounmap((u_char *)dev->mem_start);
pcmcia_release_window(link->win); pcmcia_release_window(link->win);
...@@ -4179,9 +4167,6 @@ wv_pcmcia_release(dev_link_t *link) ...@@ -4179,9 +4167,6 @@ wv_pcmcia_release(dev_link_t *link)
#ifdef DEBUG_CONFIG_TRACE #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 #endif
if (link->state & DEV_STALE_CONFIG)
wavelan_detach(link);
} }
/************************ INTERRUPT HANDLING ************************/ /************************ INTERRUPT HANDLING ************************/
...@@ -4634,10 +4619,6 @@ wavelan_close(struct net_device * dev) ...@@ -4634,10 +4619,6 @@ wavelan_close(struct net_device * dev)
/* Power down the module */ /* Power down the module */
hacr_write(base, HACR_DEFAULT & (~HACR_PWR_STAT)); hacr_write(base, HACR_DEFAULT & (~HACR_PWR_STAT));
} }
else
/* The card is no more there (flag is activated in wv_pcmcia_release) */
if(link->state & DEV_STALE_CONFIG)
wv_pcmcia_release(link);
#ifdef DEBUG_CALLBACK_TRACE #ifdef DEBUG_CALLBACK_TRACE
printk(KERN_DEBUG "%s: <-wavelan_close()\n", dev->name); printk(KERN_DEBUG "%s: <-wavelan_close()\n", dev->name);
...@@ -4802,14 +4783,6 @@ wavelan_detach(dev_link_t * link) ...@@ -4802,14 +4783,6 @@ wavelan_detach(dev_link_t * link)
{ {
/* Some others haven't done their job : give them another chance */ /* Some others haven't done their job : give them another chance */
wv_pcmcia_release(link); wv_pcmcia_release(link);
if(link->state & DEV_STALE_CONFIG)
{
#ifdef DEBUG_CONFIG_INFO
printk(KERN_DEBUG "wavelan_detach: detach postponed,"
" '%s' still locked\n", link->dev->dev_name);
#endif
return;
}
} }
/* Break the link with Card Services */ /* Break the link with Card Services */
......
...@@ -1306,10 +1306,6 @@ static int wl3501_close(struct net_device *dev) ...@@ -1306,10 +1306,6 @@ static int wl3501_close(struct net_device *dev)
/* Mask interrupts from the SUTRO */ /* Mask interrupts from the SUTRO */
wl3501_block_interrupt(this); wl3501_block_interrupt(this);
if (link->state & DEV_STALE_CONFIG) {
link->state |= DEV_RELEASE_PENDING;
wl3501_release(link);
}
rc = 0; rc = 0;
printk(KERN_INFO "%s: WL3501 closed\n", dev->name); printk(KERN_INFO "%s: WL3501 closed\n", dev->name);
out: out:
...@@ -2220,15 +2216,6 @@ static void wl3501_release(dev_link_t *link) ...@@ -2220,15 +2216,6 @@ static void wl3501_release(dev_link_t *link)
{ {
struct net_device *dev = link->priv; struct net_device *dev = link->priv;
/* If the device is currently in use, we won't release until it is
* actually closed. */
if (link->open) {
dprintk(1, "release postponed, '%s' still open",
link->dev->dev_name);
link->state |= DEV_STALE_CONFIG;
goto out;
}
/* Unlink the device chain */ /* Unlink the device chain */
if (link->dev) { if (link->dev) {
unregister_netdev(dev); unregister_netdev(dev);
...@@ -2240,11 +2227,6 @@ static void wl3501_release(dev_link_t *link) ...@@ -2240,11 +2227,6 @@ static void wl3501_release(dev_link_t *link)
pcmcia_release_io(link->handle, &link->io); pcmcia_release_io(link->handle, &link->io);
pcmcia_release_irq(link->handle, &link->irq); pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG; link->state &= ~DEV_CONFIG;
if (link->state & DEV_STALE_CONFIG)
wl3501_detach(link);
out:
return;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment