diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2016-08-10 12:58:46 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-08-11 14:13:07 +0200 |
commit | 9f77b80fdfeb72bdecf7855bb526ef14b6ed2ba8 (patch) | |
tree | a8edd6226a70724eb182d30971f4d4bd550550a3 | |
parent | 8f71a975d4150abf8ab1fbea65b51e73ff9936d6 (diff) | |
download | op-kernel-dev-9f77b80fdfeb72bdecf7855bb526ef14b6ed2ba8.zip op-kernel-dev-9f77b80fdfeb72bdecf7855bb526ef14b6ed2ba8.tar.gz |
greybus: control: make disconnecting a core operation
Make the control-protocol disconnecting operation a "core" operation.
This is needed to be able to use the operation in the new connection
tear-down sequence of control connections, which moves disconnecting
after the flush barrier.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Sandeep Patil <sspatil@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
-rw-r--r-- | drivers/staging/greybus/control.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/staging/greybus/control.c b/drivers/staging/greybus/control.c index 658f8a6..4716190 100644 --- a/drivers/staging/greybus/control.c +++ b/drivers/staging/greybus/control.c @@ -152,13 +152,29 @@ int gb_control_disconnected_operation(struct gb_control *control, u16 cport_id) int gb_control_disconnecting_operation(struct gb_control *control, u16 cport_id) { - struct gb_control_disconnecting_request request; + struct gb_control_disconnecting_request *request; + struct gb_operation *operation; + int ret; - request.cport_id = cpu_to_le16(cport_id); + operation = gb_operation_create_core(control->connection, + GB_CONTROL_TYPE_DISCONNECTING, + sizeof(*request), 0, 0, + GFP_KERNEL); + if (!operation) + return -ENOMEM; - return gb_operation_sync(control->connection, - GB_CONTROL_TYPE_DISCONNECTING, &request, - sizeof(request), NULL, 0); + request = operation->request->payload; + request->cport_id = cpu_to_le16(cport_id); + + ret = gb_operation_request_send_sync(operation); + if (ret) { + dev_err(&control->dev, "failed to send disconnecting: %d\n", + ret); + } + + gb_operation_put(operation); + + return ret; } int gb_control_mode_switch_operation(struct gb_control *control) |