lkml.org 
[lkml]   [2018]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 40/45] C++: Fix sema_init()
From
Date
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@redhat.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);
}

\
 
 \ /
  Last update: 2018-04-01 22:45    [W:0.487 / U:1.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site