Commit 2fea82db authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Michael Ellerman

powerpc: eeh_event: convert semaphore to completion

For this use case, completions and semaphores are equivalent,
but semaphores are an awkward interface that should generally
be avoided, so use the completion instead.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent d1f75a96
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
*/ */
static DEFINE_SPINLOCK(eeh_eventlist_lock); static DEFINE_SPINLOCK(eeh_eventlist_lock);
static struct semaphore eeh_eventlist_sem; static DECLARE_COMPLETION(eeh_eventlist_event);
static LIST_HEAD(eeh_eventlist); static LIST_HEAD(eeh_eventlist);
/** /**
...@@ -55,7 +55,7 @@ static int eeh_event_handler(void * dummy) ...@@ -55,7 +55,7 @@ static int eeh_event_handler(void * dummy)
struct eeh_pe *pe; struct eeh_pe *pe;
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
if (down_interruptible(&eeh_eventlist_sem)) if (wait_for_completion_interruptible(&eeh_eventlist_event))
break; break;
/* Fetch EEH event from the queue */ /* Fetch EEH event from the queue */
...@@ -102,9 +102,6 @@ int eeh_event_init(void) ...@@ -102,9 +102,6 @@ int eeh_event_init(void)
struct task_struct *t; struct task_struct *t;
int ret = 0; int ret = 0;
/* Initialize semaphore */
sema_init(&eeh_eventlist_sem, 0);
t = kthread_run(eeh_event_handler, NULL, "eehd"); t = kthread_run(eeh_event_handler, NULL, "eehd");
if (IS_ERR(t)) { if (IS_ERR(t)) {
ret = PTR_ERR(t); ret = PTR_ERR(t);
...@@ -142,7 +139,7 @@ int eeh_send_failure_event(struct eeh_pe *pe) ...@@ -142,7 +139,7 @@ int eeh_send_failure_event(struct eeh_pe *pe)
spin_unlock_irqrestore(&eeh_eventlist_lock, flags); spin_unlock_irqrestore(&eeh_eventlist_lock, flags);
/* For EEH deamon to knick in */ /* For EEH deamon to knick in */
up(&eeh_eventlist_sem); complete(&eeh_eventlist_event);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment