summaryrefslogtreecommitdiff
path: root/kernel/printk
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2023-03-29 13:14:42 +0300
committerLuis Chamberlain <mcgrof@kernel.org>2023-04-18 21:15:24 +0300
commit48380368dec14859723b9e3fbd43e042638d9a76 (patch)
tree9101bd4621e4516b4f84e9c7dda87cb71487ba7a /kernel/printk
parent430bb0d1c3376c988982f14bcbe71f917c89e1ab (diff)
downloadlinux-48380368dec14859723b9e3fbd43e042638d9a76.tar.xz
Change DEFINE_SEMAPHORE() to take a number argument
Fundamentally semaphores are a counted primitive, but DEFINE_SEMAPHORE() does not expose this and explicitly creates a binary semaphore. Change DEFINE_SEMAPHORE() to take a number argument and use that in the few places that open-coded it using __SEMAPHORE_INITIALIZER(). Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> [mcgrof: add some tribal knowledge about why some folks prefer binary sempahores over mutexes] Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Diffstat (limited to 'kernel/printk')
-rw-r--r--kernel/printk/printk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index fd0c9f913940..76987aaa5a45 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -89,7 +89,7 @@ static DEFINE_MUTEX(console_mutex);
* console_sem protects updates to console->seq and console_suspended,
* and also provides serialization for console printing.
*/
-static DEFINE_SEMAPHORE(console_sem);
+static DEFINE_SEMAPHORE(console_sem, 1);
HLIST_HEAD(console_list);
EXPORT_SYMBOL_GPL(console_list);
DEFINE_STATIC_SRCU(console_srcu);