tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Define static kmutex_t



manu%netbsd.org@localhost (Emmanuel Dreyfus) wrote:
> Another DAHDI porting caveat. They use stuff like this to define a
> static kmutex_t outside any function:
> 
>     static DEFINE_SPINLOCK(pseudo_free_list_lock);
> 
> NetBSD needs to do this in order to initialize a mutex:
> 
>     static kmutex_t pseudo_free_list_lock;
>     mutex_init(&pseudo_free_list_lock, MUTEX_SPIN, IPL_NET)
> 
> There is no way to make this fit together, right? As I understand I need
> to run a driver initilization hook to call mutex_init for all mutexes
> that are defined this way in the drivers (I cound 12 occurences).

Right.  Use MUTEX_DEFAULT (instead of MUTEX_SPIN or other), though.
One also needs to mutex_destroy(9) the lock on driver detach/unload.

-- 
Mindaugas


Home | Main Index | Thread Index | Old Index