summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/control.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-05-30 13:05:09 +0530
committerGreg Kroah-Hartman <gregkh@google.com>2016-06-02 11:15:49 -0700
commit7ff6e0128a7da5d5a8b51abb09fafeb7b8944792 (patch)
treef4c2f97cdd1d46b753444f4527da2a871443e82e /drivers/staging/greybus/control.c
parentc92c1d026b1e13f20fee3350975a4986608ff84a (diff)
greybus: control: Mode-switch is a 'core' operation
The operation layer allows only the 'core' operations on a connection, which is in its 'disconnecting' state. Mode switch is sent at the very end of interface-disable sequence, and the control connection is already in its 'disconnecting' state at that time. And so gb_operation_get_active() always fail with error -ENOTCONN. The operation core already has support for such 'core' operations, just that we were missing the needed flag while creating the mode switch operation. Fix that. Tested on EVT 1.5 with gpbridge-test module. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Tested-by: Karthik Ravi Shankar <karthikrs@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/control.c')
-rw-r--r--drivers/staging/greybus/control.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/staging/greybus/control.c b/drivers/staging/greybus/control.c
index d772c27a01df..88e5718965d6 100644
--- a/drivers/staging/greybus/control.c
+++ b/drivers/staging/greybus/control.c
@@ -163,18 +163,24 @@ int gb_control_disconnecting_operation(struct gb_control *control,
int gb_control_mode_switch_operation(struct gb_control *control)
{
+ struct gb_operation *operation;
int ret;
- ret = gb_operation_unidirectional(control->connection,
- GB_CONTROL_TYPE_MODE_SWITCH,
- NULL, 0);
+ operation = gb_operation_create_core(control->connection,
+ GB_CONTROL_TYPE_MODE_SWITCH,
+ 0, 0, GB_OPERATION_FLAG_UNIDIRECTIONAL,
+ GFP_KERNEL);
+ if (!operation)
+ return -ENOMEM;
+
+ ret = gb_operation_request_send_sync(operation);
if (ret) {
- dev_err(&control->dev, "failed to send mode switch: %d\n",
- ret);
- return ret;
+ dev_err(&control->dev, "failed to send mode switch: %d\n", ret);
}
- return 0;
+ gb_operation_put(operation);
+
+ return ret;
}
int gb_control_timesync_enable(struct gb_control *control, u8 count,