int mutex_owned(kmutex_t *mp);
A significant portion of driver development involves properly handling multiple threads. Comments should always be used when a mutex is acquired; they are even more useful when an apparently necessary mutex is not acquired. To determine if a mutex is held by a thread, use mutex_owned(9F) within ASSERT(9F):
void helper(void)
{
/* this routine should always be called with xsp's mutex held */
ASSERT(mutex_owned(&xsp->mu));
...
}
mutex_owned(9F) is only valid within ASSERT(9F) macros. Under no circumstances should you use it to control the behavior of a driver.