Subject: Re: LKMs and pci_mapreg_map
To: None <ben@eitzen.org>
From: Klaus Klein <kleink@reziprozitaet.de>
List: tech-kern
Date: 05/13/2002 23:35:31
ben@eitzen.org writes:

> I have an LKM that I'm working on for a pci card. It works fine, except
> for if I load the lkm, unload it, then load it again, pci_mapreg_map
> fails the second time around. It will only work again after a reboot,
> which defeats the purpose of the LKM.
> 
> Is there something I need to do to clean up after pci_mapreg_map?

The kernel keeps track of your mappings; thus when you attempt to map
the same BAR again it finds that particular region already in use and
will fail.  Using bus_space_unmap() at unload time to release it
should help you here.


- Klaus