diff options
author | Peter Zijlstra <peterz@infradead.org> | 2023-03-29 12:14:42 +0200 |
---|---|---|
committer | Luis Chamberlain <mcgrof@kernel.org> | 2023-04-18 11:15:24 -0700 |
commit | 48380368dec14859723b9e3fbd43e042638d9a76 (patch) | |
tree | 9101bd4621e4516b4f84e9c7dda87cb71487ba7a /net | |
parent | 430bb0d1c3376c988982f14bcbe71f917c89e1ab (diff) | |
download | linux-stable-48380368dec14859723b9e3fbd43e042638d9a76.tar.gz linux-stable-48380368dec14859723b9e3fbd43e042638d9a76.tar.bz2 linux-stable-48380368dec14859723b9e3fbd43e042638d9a76.zip |
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 'net')
-rw-r--r-- | net/rxrpc/call_object.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c index e9f1f49d18c2..3e5cc70884dd 100644 --- a/net/rxrpc/call_object.c +++ b/net/rxrpc/call_object.c @@ -40,10 +40,8 @@ const char *const rxrpc_call_completions[NR__RXRPC_CALL_COMPLETIONS] = { struct kmem_cache *rxrpc_call_jar; -static struct semaphore rxrpc_call_limiter = - __SEMAPHORE_INITIALIZER(rxrpc_call_limiter, 1000); -static struct semaphore rxrpc_kernel_call_limiter = - __SEMAPHORE_INITIALIZER(rxrpc_kernel_call_limiter, 1000); +static DEFINE_SEMAPHORE(rxrpc_call_limiter, 1000); +static DEFINE_SEMAPHORE(rxrpc_kernel_call_limiter, 1000); void rxrpc_poke_call(struct rxrpc_call *call, enum rxrpc_call_poke_trace what) { |