]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: kill gb_operation_wait()
authorAlex Elder <elder@linaro.org>
Sat, 22 Nov 2014 01:29:19 +0000 (19:29 -0600)
committerGreg Kroah-Hartman <greg@kroah.com>
Sat, 22 Nov 2014 03:39:12 +0000 (19:39 -0800)
When a caller wants an operation to complete synchronously, there is
generally no need for any other threads to wait for the operation's
completion.  So here's no need for gb_operation_wait() to be
available for synchronous requests.  At the moment, all operations
are done synchronously.

Knowing that, get rid of the public gb_operation_wait() function,
and open-code it in gb_operation_request_send().  The public wait
function can be re-implemented when it's really needed.

With that function gone, the only waiter for the completion of an
operation is the submitter itself, and only then if it's
synchronous.  So rather than complete_all(), we can simply use
complete() to signal the submitter.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/operation.c

index f4d984f680554849a1aa8aef5e05b3a70a976d09..032973cf27a9d84aca0ad10d8894d317b9a5f31d 100644 (file)
@@ -156,25 +156,10 @@ static void gb_operation_complete(struct gb_operation *operation)
        if (operation->callback)
                operation->callback(operation);
        else
-               complete_all(&operation->completion);
+               complete(&operation->completion);
        gb_operation_put(operation);
 }
 
-/*
- * Wait for a submitted operation to complete.  Returns the result
- * of the operation; this will be -EINTR if the wait was interrupted.
- */
-static int gb_operation_wait(struct gb_operation *operation)
-{
-       int ret;
-
-       ret = wait_for_completion_interruptible(&operation->completion);
-       if (ret < 0)
-               gb_operation_cancel(operation, -EINTR);
-
-       return operation->errno;
-}
-
 #if 0
 static void gb_operation_request_handle(struct gb_operation *operation)
 {
@@ -478,7 +463,12 @@ int gb_operation_request_send(struct gb_operation *operation,
        if (ret || callback)
                return ret;
 
-       return gb_operation_wait(operation);
+       /* Cancel the operation if interrupted */
+       ret = wait_for_completion_interruptible(&operation->completion);
+       if (ret < 0)
+               gb_operation_cancel(operation, -EINTR);
+
+       return operation->errno;
 }
 
 /*