mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 05:48:40 +00:00
greybus: move timeout out of gb_operation_insert()
Currently, gb_operation_insert() arranges to time out a request if it takes too long. Move this out of that function and into gb_operation_request_send(), so we know it's getting set up after the request has actually be sent. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
10520528fe
commit
8350e7a011
1 changed files with 5 additions and 5 deletions
|
@ -64,7 +64,6 @@ static void gb_operation_insert(struct gb_operation *operation)
|
|||
struct rb_node **link = &root->rb_node;
|
||||
struct rb_node *above = NULL;
|
||||
struct gb_operation_msg_hdr *header;
|
||||
unsigned long timeout;
|
||||
|
||||
/* Assign the operation's id, and store it in the header of
|
||||
* the request message header.
|
||||
|
@ -89,10 +88,6 @@ static void gb_operation_insert(struct gb_operation *operation)
|
|||
rb_link_node(node, above, link);
|
||||
rb_insert_color(node, root);
|
||||
spin_unlock_irq(&gb_operations_lock);
|
||||
|
||||
/* We impose a time limit for requests to complete. */
|
||||
timeout = msecs_to_jiffies(OPERATION_TIMEOUT_DEFAULT);
|
||||
schedule_delayed_work(&operation->timeout_work, timeout);
|
||||
}
|
||||
|
||||
static void gb_operation_remove(struct gb_operation *operation)
|
||||
|
@ -397,6 +392,7 @@ void gb_operation_destroy(struct gb_operation *operation)
|
|||
int gb_operation_request_send(struct gb_operation *operation,
|
||||
gb_operation_callback callback)
|
||||
{
|
||||
unsigned long timeout;
|
||||
int ret;
|
||||
|
||||
if (operation->connection->state != GB_CONNECTION_STATE_ENABLED)
|
||||
|
@ -413,6 +409,10 @@ int gb_operation_request_send(struct gb_operation *operation,
|
|||
ret = greybus_submit_gbuf(operation->request, GFP_KERNEL);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* We impose a time limit for requests to complete. */
|
||||
timeout = msecs_to_jiffies(OPERATION_TIMEOUT_DEFAULT);
|
||||
schedule_delayed_work(&operation->timeout_work, timeout);
|
||||
if (!callback)
|
||||
ret = gb_operation_wait(operation);
|
||||
|
||||
|
|
Loading…
Reference in a new issue