[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <152261545562.30503.15516261440506735873.stgit@warthog.procyon.org.uk>
Date: Sun, 01 Apr 2018 21:44:15 +0100
From: David Howells <dhowells@...hat.com>
To: linux-kernel@...r.kernel.org
Subject: [PATCH 40/45] C++: Fix sema_init()
Fix sema_init() to manually initialise the semaphore rather than using
__SEMAPHORE_INITIALIZER() as that doesn't seem to work on C++.
Signed-off-by: David Howells <dhowells@...hat.com>
---
include/linux/semaphore.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/linux/semaphore.h b/include/linux/semaphore.h
index 11c86fbfeb98..364fb4721db5 100644
--- a/include/linux/semaphore.h
+++ b/include/linux/semaphore.h
@@ -32,7 +32,10 @@ struct semaphore {
static inline void sema_init(struct semaphore *sem, int val)
{
static struct lock_class_key __key;
- *sem = (struct semaphore) __SEMAPHORE_INITIALIZER(*sem, val);
+
+ sem->count = val;
+ INIT_LIST_HEAD(&sem->wait_list);
+ raw_spin_lock_init(&sem->lock);
lockdep_init_map(&sem->lock.dep_map, "semaphore->lock", &__key, 0);
}
Powered by blists - more mailing lists