removing modules afetr ejecting a card?

Dominik Brodowski linux at dominikbrodowski.net
Sat Jul 23 15:29:39 EDT 2005


On Wed, Jul 20, 2005 at 01:34:18PM +0200, Steven Scholz wrote:
> Hi,
> 
> /etc/hotplug/pcmcia.agent is loading the approriate modules with
> 
> 	modprobe $MODALIAS
> 
> (and MODALIAS would be something like 
> pcmcia:m0045c0401f04fn00pfn00pa7A954BD9pb91844B1CpcAAC4295Bpd00000000)
> 
> But I noticed that the modules (like ide_cs etc.) are _not_ unloaded when 
> the card is removed. Thus when I am inserting and removing several cards 
> then the modules stay loaded just wasting precious recources...

Removing modules is considered to be a bad practice, in general. Especially
PCMCIA modules still need some work until I consider it safe to remove them.

> How could I unload these modules when the card is removed?
> 
> I tried to add a
> 
> 	modprobe -r $MODALIAS
> 
> in the "stop" sections of /etc/hotplug/pcmcia.agent. But since ide-cs.ko 
> depends on pcmcia.ko (according to /etc/modules.dep) the pcmcia.ko module 
> is removed as well! (Same goes for other drivers like orinoco_cs)
> But removing pcmcia.ko means that pcmcia is not working anymore. No more 
> card insertions/removals are detected.
>
> How could I work around this problem?

Untested:
x "Save" the driver module name in /etc/hotplug/pcmcia.agent upon startup by
  reading out where the symlink from /sys/bus/pcmcia/devices/1.0/driver/module/
  goes to.
x rmmod (not modprobe -r) that one on stop.

> Is it possible to install pcmcia.ko a system boot there a way that it will 
> not be removed later?

Well, you can always build it into the kernel.

	Dominik



More information about the linux-pcmcia mailing list