/proc/ioports and /proc/iomem and rmmod of drivers - newbie

From: john (qwejohn_at_hotmail.com)
Date: 07/26/04


Date: 26 Jul 2004 09:03:07 -0700

I looked at 2 drivers in the linux kernel:

the NIC driver (rtl8139too.c) and usb-ohci.c (my host contyroller).

usb-ohci calls ioremap_nocache
rtl8139too calls ioremap

I see that under /proc/iomem there are 2 entries for usb-ohci
and there is also one entry for rtl8139.

Now , if I run
"rmmod usb-ohci"
then the command completes, there are no usb-ohci entries
under /proc/iomem.

On the other hand, if I run , after ifdown eth0 ,
"rmmod rtl8139too" , the entry for rtl8139too /proc/iomem stays.

Why is that?

As I probed in the code, I saw that in usb-ohci.c
we reach the iounmap () call in hc_release_ohci();
The iounmap () calls vfree().

Does this call frees the entry under /proc/iomem ?

But also in rtl8139too.c , there is a call to
iounmap () in __rtl8139_cleanup_dev() (There are 2 possibilities with
rtl8139too; one is mmio, the second is pio; it seems to me by default we use
mmio and this is the case here).

and another thing which I do not understand: from where are the entries
under /proc/ports?
there is an entry for rtl8139too under /proc/ioports which stays there
also after rmmod rtl8139too; but there is no entry fro usb-ohci, for example.

I am using 2.4.20-8 kernel on x86.

regards,
John