Commit dc71eccc authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Martin K. Petersen

scsi: aacraid: change wait_sem to a completion

The wait_sem member is used like a completion, so we should
use the respective API. The behavior is unchanged.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarDave Carroll <david.carroll@microsemi.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 719162bd
...@@ -1241,7 +1241,7 @@ struct aac_fib_context { ...@@ -1241,7 +1241,7 @@ struct aac_fib_context {
u32 unique; // unique value representing this context u32 unique; // unique value representing this context
ulong jiffies; // used for cleanup - dmb changed to ulong ulong jiffies; // used for cleanup - dmb changed to ulong
struct list_head next; // used to link context's into a linked list struct list_head next; // used to link context's into a linked list
struct semaphore wait_sem; // this is used to wait for the next fib to arrive. struct completion completion; // this is used to wait for the next fib to arrive.
int wait; // Set to true when thread is in WaitForSingleObject int wait; // Set to true when thread is in WaitForSingleObject
unsigned long count; // total number of FIBs on FibList unsigned long count; // total number of FIBs on FibList
struct list_head fib_list; // this holds fibs and their attachd hw_fibs struct list_head fib_list; // this holds fibs and their attachd hw_fibs
......
...@@ -203,7 +203,7 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg) ...@@ -203,7 +203,7 @@ static int open_getadapter_fib(struct aac_dev * dev, void __user *arg)
/* /*
* Initialize the mutex used to wait for the next AIF. * Initialize the mutex used to wait for the next AIF.
*/ */
sema_init(&fibctx->wait_sem, 0); init_completion(&fibctx->completion);
fibctx->wait = 0; fibctx->wait = 0;
/* /*
* Initialize the fibs and set the count of fibs on * Initialize the fibs and set the count of fibs on
...@@ -335,7 +335,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg) ...@@ -335,7 +335,7 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg)
ssleep(1); ssleep(1);
} }
if (f.wait) { if (f.wait) {
if(down_interruptible(&fibctx->wait_sem) < 0) { if (wait_for_completion_interruptible(&fibctx->completion) < 0) {
status = -ERESTARTSYS; status = -ERESTARTSYS;
} else { } else {
/* Lock again and retry */ /* Lock again and retry */
......
...@@ -1828,7 +1828,7 @@ int aac_check_health(struct aac_dev * aac) ...@@ -1828,7 +1828,7 @@ int aac_check_health(struct aac_dev * aac)
* Set the event to wake up the * Set the event to wake up the
* thread that will waiting. * thread that will waiting.
*/ */
up(&fibctx->wait_sem); complete(&fibctx->completion);
} else { } else {
printk(KERN_WARNING "aifd: didn't allocate NewFib.\n"); printk(KERN_WARNING "aifd: didn't allocate NewFib.\n");
kfree(fib); kfree(fib);
...@@ -2165,7 +2165,7 @@ static void wakeup_fibctx_threads(struct aac_dev *dev, ...@@ -2165,7 +2165,7 @@ static void wakeup_fibctx_threads(struct aac_dev *dev,
* Set the event to wake up the * Set the event to wake up the
* thread that is waiting. * thread that is waiting.
*/ */
up(&fibctx->wait_sem); complete(&fibctx->completion);
entry = entry->next; entry = entry->next;
} }
......
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