From: Alex Elder Date: Sat, 22 Nov 2014 01:29:18 +0000 (-0600) Subject: greybus: cancel whole operation on interrupt X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1830 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7035833f081cefc3953a6a72a61767967f59a59e;p=karo-tx-linux.git greybus: cancel whole operation on interrupt Cancel the operation--not just the request message--if waiting for a synchronous operation to complete is interrupted. Return the operation result (which in that case will be -EINTR). The cancelation will result in the normal operation completion path being taken before returning. Make gb_operation_wait() private, since it's only ever used for for synchronous operations. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index dc12e6df043d..f4d984f68055 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -161,21 +161,18 @@ static void gb_operation_complete(struct gb_operation *operation) } /* - * Wait for a submitted operation to complete. Returns -RESTARTSYS - * if the wait was interrupted. Otherwise returns the result of the - * operation. + * Wait for a submitted operation to complete. Returns the result + * of the operation; this will be -EINTR if the wait was interrupted. */ -int gb_operation_wait(struct gb_operation *operation) +static int gb_operation_wait(struct gb_operation *operation) { int ret; ret = wait_for_completion_interruptible(&operation->completion); - /* If interrupted, cancel the in-flight buffer */ if (ret < 0) - gb_message_cancel(operation->request); - else - ret = operation->errno; - return ret; + gb_operation_cancel(operation, -EINTR); + + return operation->errno; } #if 0 diff --git a/drivers/staging/greybus/operation.h b/drivers/staging/greybus/operation.h index d24e5e0d18f0..c391b28a4ca7 100644 --- a/drivers/staging/greybus/operation.h +++ b/drivers/staging/greybus/operation.h @@ -99,7 +99,6 @@ int gb_operation_request_send(struct gb_operation *operation, int gb_operation_response_send(struct gb_operation *operation); void gb_operation_cancel(struct gb_operation *operation, int errno); -int gb_operation_wait(struct gb_operation *operation); int gb_operation_status_map(u8 status);