diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2016-05-27 17:26:36 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-05-27 12:24:17 -0700 |
commit | 3de5acfafb3c610bc6f7013a1583852cbc2747f1 (patch) | |
tree | 754df49b802847c5a4889cbbe43906df33200fb8 /drivers/staging/greybus/operation.c | |
parent | 18079ece816b3b272b114b770e636f4e5567b028 (diff) |
greybus: connection: implement proper connection closure
Implement proper connection closure, which includes sending ping
requests on the connection being tore down while coordinating with the
remote interface as well as the SVC.
This specifically implements the new ping operation, which in case of
offloaded connections is handled by the host-device driver in an
implementation-defined manner through a new callback.
Note that the normal connection tear-down procedure is executed in case
of failed connection establishment due to failed connected operation.
Specifically, the disconnecting request is sent also in case the
connected operation never succeeded. This is needed since the interface
may have enabled FCT flow upon receiving the connected request.
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 | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/greybus/operation.c b/drivers/staging/greybus/operation.c index fb4a29e2c09f..7906a95899e5 100644 --- a/drivers/staging/greybus/operation.c +++ b/drivers/staging/greybus/operation.c @@ -46,7 +46,6 @@ static int gb_operation_get_active(struct gb_operation *operation) unsigned long flags; spin_lock_irqsave(&connection->lock, flags); - switch (connection->state) { case GB_CONNECTION_STATE_ENABLED: break; @@ -54,6 +53,10 @@ static int gb_operation_get_active(struct gb_operation *operation) if (gb_operation_is_incoming(operation)) goto err_unlock; break; + case GB_CONNECTION_STATE_DISCONNECTING: + if (!gb_operation_is_core(operation)) + goto err_unlock; + break; default: goto err_unlock; } |