Commit 24879a8e authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Linus Torvalds

aoe: convert emsgs_sema into a completion

ATA over Ethernet: The semaphore emsgs_sema is used for signalling an
event, convert it in a completion.
Signed-off-by: default avatarMatthias Kaehlcke <matthias@kaehlcke.net>
Cc: "Ed L. Cashin" <ecashin@coraid.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent dbda0de5
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/hdreg.h> #include <linux/hdreg.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/completion.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include "aoe.h" #include "aoe.h"
...@@ -36,7 +37,7 @@ struct ErrMsg { ...@@ -36,7 +37,7 @@ struct ErrMsg {
static struct ErrMsg emsgs[NMSG]; static struct ErrMsg emsgs[NMSG];
static int emsgs_head_idx, emsgs_tail_idx; static int emsgs_head_idx, emsgs_tail_idx;
static struct semaphore emsgs_sema; static struct completion emsgs_comp;
static spinlock_t emsgs_lock; static spinlock_t emsgs_lock;
static int nblocked_emsgs_readers; static int nblocked_emsgs_readers;
static struct class *aoe_class; static struct class *aoe_class;
...@@ -141,7 +142,7 @@ bail: spin_unlock_irqrestore(&emsgs_lock, flags); ...@@ -141,7 +142,7 @@ bail: spin_unlock_irqrestore(&emsgs_lock, flags);
spin_unlock_irqrestore(&emsgs_lock, flags); spin_unlock_irqrestore(&emsgs_lock, flags);
if (nblocked_emsgs_readers) if (nblocked_emsgs_readers)
up(&emsgs_sema); complete(&emsgs_comp);
} }
static ssize_t static ssize_t
...@@ -221,7 +222,7 @@ aoechr_read(struct file *filp, char __user *buf, size_t cnt, loff_t *off) ...@@ -221,7 +222,7 @@ aoechr_read(struct file *filp, char __user *buf, size_t cnt, loff_t *off)
spin_unlock_irqrestore(&emsgs_lock, flags); spin_unlock_irqrestore(&emsgs_lock, flags);
n = down_interruptible(&emsgs_sema); n = wait_for_completion_interruptible(&emsgs_comp);
spin_lock_irqsave(&emsgs_lock, flags); spin_lock_irqsave(&emsgs_lock, flags);
...@@ -269,7 +270,7 @@ aoechr_init(void) ...@@ -269,7 +270,7 @@ aoechr_init(void)
printk(KERN_ERR "aoe: can't register char device\n"); printk(KERN_ERR "aoe: can't register char device\n");
return n; return n;
} }
sema_init(&emsgs_sema, 0); init_completion(&emsgs_comp);
spin_lock_init(&emsgs_lock); spin_lock_init(&emsgs_lock);
aoe_class = class_create(THIS_MODULE, "aoe"); aoe_class = class_create(THIS_MODULE, "aoe");
if (IS_ERR(aoe_class)) { if (IS_ERR(aoe_class)) {
......
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