How to cleanly unload libertas module

Dan Williams dcbw at redhat.com
Mon Jul 7 12:51:28 EDT 2008


On Fri, 2008-07-04 at 09:42 +0200, Holger Schurig wrote:
> > When I do an ifdown to unregister the wlan interface, and I
> > try to unload the libertas_cs and libertas modules, it does't
> > work because rmmod says me that the module is busy.
> 
> Works for me (with compact flash):
> 
> ifdown eth1
> pccardctl eject
> rmmod libertas_cs
> rmmod libertas

Yeah, because I think you can disconnect the device itself (pccardctl
eject) and then libertas cleans up and frees stuff.  If the card is
soldered on or otherwise not removable, this probably won't work.

> Note that, because the CF driver registered itself with the 
> PCMCIA subsystem, just doing "ifdown eth1" doesn't set the usage 
> count to 0. After all, you can still access the card when the 
> interface is down. Maybe the same is true for SDIO. You must do 
> your SDIO-equivalent of "pccardctl eject", so that the driver 
> get's de-registered. In the SDIO case, you must trigger that the 
> SDIO subsystem calls your if_sdio_remove() function.

ifdown just stops the queues (lbs_eth_stop).  ifup starts them again.
You'd have to rmmod the driver to close the device and disconnect it
completely.  The current architecture loads the firmware and grabs the
device on probe.  We should try to track down where the module reference
is coming from though, just to understand whether it _should_ be there
or not.  Ideally you can rmmod the module at any time and it cleans up
after itself.

What you probably really want is the ability to power down the
transmitter, which would be "iwconfig ethX txpower off".  Or is that not
sufficient?

Dan




More information about the libertas-dev mailing list