removing modules afetr ejecting a card?

Steven Scholz steven.scholz at imc-berlin.de
Mon Jul 25 03:30:48 EDT 2005


Dominik,

>>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.

Why is that? On an embedded system with only a few megs of RAM it would be a 
completly waste on resources if I had IDE, serial, orinoco and whatever driver 
loaded all the time although I have only one CF socket, thus can only use one at 
a time!

>>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.
How?
Is there a better way then
	basename `readlink /sys/bus/pcmcia/devices/0.0/driver/module`
?

--
Steven



More information about the linux-pcmcia mailing list