question on cdevsw_add mask/match

Chuck Tuffli chuck_tuffli at agilent.com
Fri Mar 18 15:00:56 PST 2005


I'm a little confused as how to correctly specify mask and match for
cdevsw_add() and cdevsw_remove(). There are a number of drivers that
specify mask and match similar to the following

cdevsw_add(&isp_cdevsw, -1, device_get_unit(isp->isp_dev));

(not to single out the QLogic driver ;^) ). The problem with this
specification is on a kldunload, the kernel will spit out the
following

svd(202)[ffffffff/00000000]: Warning: cdevsw_remove() called while 1 device refs still exist!

because destroy_all_dev() uses the mask (0xffffffff) on dev->si_udev
and compares it to the match value (0) which won't match because
si_udev is a combination of the major and minor numbers (0xca00 in the
above case) and not the unit number.

The question is what is the correct way to specify mask/match? In my
case, 0/0 "works" but I wasn't sure if that specification is correct.

-- 
Chuck Tuffli
Agilent Technologies





More information about the Kernel mailing list