diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2015-07-14 15:43:37 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-07-15 12:39:13 -0700 |
commit | 129a06f541d3ff4228589b4b9f0a4681dafb0042 (patch) | |
tree | d5c785b467b770707899a8fbf3e76443337379ae /drivers/staging/greybus/operation.c | |
parent | 4f2c08aba792d4c778774e90e47865718eb1b7f8 (diff) |
greybus: operation: add gb_operation_sync_timeout helper
Add gb_operation_sync_timeout convenience function, which allows drivers
to configure the operation timeout.
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/operation.c')
-rw-r--r-- | drivers/staging/greybus/operation.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index 63c4a5b8b0f1..a99505cc21fa 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -978,6 +978,7 @@ void gb_operation_cancel_incoming(struct gb_operation *operation, int errno) * @request_size: size of @request * @response: pointer to a memory buffer to copy the response to * @response_size: the size of @response. + * @timeout: operation timeout in milliseconds * * This function implements a simple synchronous Greybus operation. It sends * the provided operation request and waits (sleeps) until the corresponding @@ -992,9 +993,10 @@ void gb_operation_cancel_incoming(struct gb_operation *operation, int errno) * * If there is an error, the response buffer is left alone. */ -int gb_operation_sync(struct gb_connection *connection, int type, - void *request, int request_size, - void *response, int response_size) +int gb_operation_sync_timeout(struct gb_connection *connection, int type, + void *request, int request_size, + void *response, int response_size, + unsigned int timeout) { struct gb_operation *operation; int ret; @@ -1012,7 +1014,7 @@ int gb_operation_sync(struct gb_connection *connection, int type, if (request_size) memcpy(operation->request->payload, request, request_size); - ret = gb_operation_request_send_sync(operation); + ret = gb_operation_request_send_sync_timeout(operation, timeout); if (ret) { dev_err(&connection->dev, "synchronous operation failed: %d\n", ret); @@ -1026,7 +1028,7 @@ int gb_operation_sync(struct gb_connection *connection, int type, return ret; } -EXPORT_SYMBOL_GPL(gb_operation_sync); +EXPORT_SYMBOL_GPL(gb_operation_sync_timeout); int __init gb_operation_init(void) { |