summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/operation.h
diff options
context:
space:
mode:
authorJohan Hovold <johan@hovoldconsulting.com>2015-07-14 15:43:36 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2015-07-15 12:39:13 -0700
commit4f2c08aba792d4c778774e90e47865718eb1b7f8 (patch)
tree2914b6557e54819140cd4e8c4068b27f91dcc87a /drivers/staging/greybus/operation.h
parent5a3be769e92ea993f8a8c27b89571c276d874733 (diff)
downloadlinux-stable-4f2c08aba792d4c778774e90e47865718eb1b7f8.tar.gz
linux-stable-4f2c08aba792d4c778774e90e47865718eb1b7f8.tar.bz2
linux-stable-4f2c08aba792d4c778774e90e47865718eb1b7f8.zip
greybus: operation: allow drivers to define custom timeouts
Add new interface gb_operation_request_send_sync_timeout, which allows drivers to define a custom operation timeout instead of the default one-second timeout. The timeout is expected to depend on protocol and operation and therefore needs to be configurable. Note that that a timeout of zero is used to wait indefinitely. 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.h')
-rw-r--r--drivers/staging/greybus/operation.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/staging/greybus/operation.h b/drivers/staging/greybus/operation.h
index d7e59a3f4b47..f06dd11e0afb 100644
--- a/drivers/staging/greybus/operation.h
+++ b/drivers/staging/greybus/operation.h
@@ -14,6 +14,9 @@
struct gb_operation;
+/* The default amount of time a request is given to complete */
+#define GB_OPERATION_TIMEOUT_DEFAULT 1000 /* milliseconds */
+
/*
* No protocol may define an operation that has numeric value 0x00.
* It is reserved as an explicitly invalid value.
@@ -168,7 +171,14 @@ bool gb_operation_response_alloc(struct gb_operation *operation,
int gb_operation_request_send(struct gb_operation *operation,
gb_operation_callback callback,
gfp_t gfp);
-int gb_operation_request_send_sync(struct gb_operation *operation);
+int gb_operation_request_send_sync_timeout(struct gb_operation *operation,
+ unsigned int timeout);
+static inline int
+gb_operation_request_send_sync(struct gb_operation *operation)
+{
+ return gb_operation_request_send_sync_timeout(operation,
+ GB_OPERATION_TIMEOUT_DEFAULT);
+}
void gb_operation_cancel(struct gb_operation *operation, int errno);
void gb_operation_cancel_incoming(struct gb_operation *operation, int errno);