Driver not unset properly after kldunload

Iasen Kostov tbyte at otel.net
Thu Dec 7 08:00:27 PST 2006


On Wed, 2006-12-06 at 11:35 -0500, John Baldwin wrote:
...
> I don't see why this patch changes things.  devclass_delete_device() only 
> clears dev->unit, dev->devclass, and dev->nameunit.  device_set_driver() 
> doesn't check or clear any of those.  In fact, your change does make 
> device_set_driver() not work at all since the device state will still be 
> DS_ATTACHED when you call device_set_driver() now.  So, I guess your patch 
> actually makes the device _not_ be detached from the driver.
> 
	Forgive me for being so lazy :). I've analized the problem as I should
have done the first time and I hope I found the solution. First time I
was missleaded by sys/dev/pci/pci_user.c and the way it sets pd_name[]
in pci_devinfo struct (You actualy need to use pciconf atleast once
after loading the driver) ... It's only set when you use PCIOCGETCONF
ioctl on /dev/pci and it only sets it once (which is not very clever)
and never unset it. But one can unload the current driver and load
another (as in if_nfe, if_nve case) or just unload the driver and
pd_name[] will always show the first driver attached on that device.
	So I hope this new patch is better one.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: pci_user.c.diff
Type: text/x-patch
Size: 861 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20061207/dc071100/pci_user.c.bin


More information about the freebsd-hackers mailing list