All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] using "mutexes" in place of semaphores
@ 2007-02-17 12:48 Robert P. J. Day
  2007-02-17 13:56 ` Arnd Bergmann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Robert P. J. Day @ 2007-02-17 12:48 UTC (permalink / raw)
  To: kernel-janitors


  another possible aesthetic cleanup is to replace the use of general
semaphores that are initialized to 1 with the simpler reference to an
actual "mutex" (since, after all, that's what mutexes are there for).

  there's a small number of semaphore initializations of the form
"sema_init(&sem, 1)" that could be rewritten as the simpler
"init_MUTEX(&sem)".  in some places, the name of the semaphore itself
makes it clear that it's a mutex anyway, such as:

  drivers/scsi/megaraid/megaraid_sas.c: sema_init(&instance->aen_mutex, 1);

a quick count shows that there's only a couple dozen instances of
calling sema_init() with a count of 1, while there are many more calls
of init_MUTEX() in the tree, suggesting that init_MUTEX() really is
the preferred standard.

  thoughts?  is this worth it?

rday

--
====================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
====================================
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-02-17 18:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-17 12:48 [KJ] using "mutexes" in place of semaphores Robert P. J. Day
2007-02-17 13:56 ` Arnd Bergmann
2007-02-17 13:58 ` Robert P. J. Day
2007-02-17 16:39 ` Robert P. J. Day
2007-02-17 18:48 ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.