following up on my earlier post, i'm summarizing the current use of semaphores in the kernel and quite a lot of docs are going to have to cleanse themselves of now-obsolete references to all of DECLARE_MUTEX[_LOCKED] and init_MUTEX[_LOCKED], since the current API consists simply of: * DEFINE_SEMAPHORE() * sema_init() but a quick grep for the former produces only: $ grep -rw DEFINE_SEMAPHORE * drivers/macintosh/adb.c:static DEFINE_SEMAPHORE(adb_probe_mutex); drivers/staging/comedi/drivers/usbduxfast.c:static DEFINE_SEMAPHORE(start_stop_sem); drivers/staging/comedi/drivers/usbduxsigma.c:static DEFINE_SEMAPHORE(start_stop_sem); drivers/staging/comedi/drivers/dt9812.c:static DEFINE_SEMAPHORE(dt9812_mutex); drivers/staging/comedi/drivers/usbdux.c:static DEFINE_SEMAPHORE(start_stop_sem); drivers/staging/csr/drv.c:DEFINE_SEMAPHORE(udi_mutex); drivers/staging/csr/io.c:DEFINE_SEMAPHORE(Unifi_instance_mutex); drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:static DEFINE_SEMAPHORE(bnx2x_prev_sem); include/linux/semaphore.h:#define DEFINE_SEMAPHORE(name) \ kernel/printk.c:static DEFINE_SEMAPHORE(console_sem); $ ignoring what's under drivers/staging/ (which is generally a bit of a mess at the best of times), the above shows that there is almost *no* usage of DEFINE_SEMAPHORE(), which surprised me somewhat, but i can imagine a couple reasons. first, a lot of semaphores have been replaced by the newer and simpler mutex. also, rather than semaphores being created standalone, they're normally defined as part of a structure, and when an instance of that structure is declared, it's naturally initialized with sema_init() in the appropriate initialization code. so i'm not surprised that the usage of DEFINE_SEMAPHORE() is dropping, i'm just surprised that it's almost non-existent. thoughts? rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ======================================================================== _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies