aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/aoe
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias@kaehlcke.net>2008-07-25 04:48:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:45 -0400
commit24879a8e3e68f146d4d85528cc0b5dea712b77c5 (patch)
tree9e8021f713225c2ec5642770351aeeb59af39fb5 /drivers/block/aoe
parentdbda0de52618d13d1b927c7ba7bb839cfddc4e8c (diff)
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: Matthias Kaehlcke <matthias@kaehlcke.net> Cc: "Ed L. Cashin" <ecashin@coraid.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/aoe')
-rw-r--r--drivers/block/aoe/aoechr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
index c04440cd6a32..181ebb85f0be 100644
--- a/drivers/block/aoe/aoechr.c
+++ b/drivers/block/aoe/aoechr.c
@@ -6,6 +6,7 @@
6 6
7#include <linux/hdreg.h> 7#include <linux/hdreg.h>
8#include <linux/blkdev.h> 8#include <linux/blkdev.h>
9#include <linux/completion.h>
9#include <linux/delay.h> 10#include <linux/delay.h>
10#include <linux/smp_lock.h> 11#include <linux/smp_lock.h>
11#include "aoe.h" 12#include "aoe.h"
@@ -36,7 +37,7 @@ struct ErrMsg {
36 37
37static struct ErrMsg emsgs[NMSG]; 38static struct ErrMsg emsgs[NMSG];
38static int emsgs_head_idx, emsgs_tail_idx; 39static int emsgs_head_idx, emsgs_tail_idx;
39static struct semaphore emsgs_sema; 40static struct completion emsgs_comp;
40static spinlock_t emsgs_lock; 41static spinlock_t emsgs_lock;
41static int nblocked_emsgs_readers; 42static int nblocked_emsgs_readers;
42static struct class *aoe_class; 43static struct class *aoe_class;
@@ -141,7 +142,7 @@ bail: spin_unlock_irqrestore(&emsgs_lock, flags);
141 spin_unlock_irqrestore(&emsgs_lock, flags); 142 spin_unlock_irqrestore(&emsgs_lock, flags);
142 143
143 if (nblocked_emsgs_readers) 144 if (nblocked_emsgs_readers)
144 up(&emsgs_sema); 145 complete(&emsgs_comp);
145} 146}
146 147
147static ssize_t 148static ssize_t
@@ -221,7 +222,7 @@ aoechr_read(struct file *filp, char __user *buf, size_t cnt, loff_t *off)
221 222
222 spin_unlock_irqrestore(&emsgs_lock, flags); 223 spin_unlock_irqrestore(&emsgs_lock, flags);
223 224
224 n = down_interruptible(&emsgs_sema); 225 n = wait_for_completion_interruptible(&emsgs_comp);
225 226
226 spin_lock_irqsave(&emsgs_lock, flags); 227 spin_lock_irqsave(&emsgs_lock, flags);
227 228
@@ -269,7 +270,7 @@ aoechr_init(void)
269 printk(KERN_ERR "aoe: can't register char device\n"); 270 printk(KERN_ERR "aoe: can't register char device\n");
270 return n; 271 return n;
271 } 272 }
272 sema_init(&emsgs_sema, 0); 273 init_completion(&emsgs_comp);
273 spin_lock_init(&emsgs_lock); 274 spin_lock_init(&emsgs_lock);
274 aoe_class = class_create(THIS_MODULE, "aoe"); 275 aoe_class = class_create(THIS_MODULE, "aoe");
275 if (IS_ERR(aoe_class)) { 276 if (IS_ERR(aoe_class)) {