greybus: control: implement disconnecting operation
authorJohan Hovold <johan@hovoldconsulting.com>
Fri, 27 May 2016 15:26:26 +0000 (17:26 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 27 May 2016 19:19:29 +0000 (12:19 -0700)
Implement the new disconnecting control operation needed for proper
connection tear down.

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/control.c
drivers/staging/greybus/control.h
drivers/staging/greybus/greybus_protocols.h

index a5effcf..c5cdf3c 100644 (file)
@@ -149,6 +149,18 @@ int gb_control_disconnected_operation(struct gb_control *control, u16 cport_id)
                                 sizeof(request), NULL, 0);
 }
 
                                 sizeof(request), NULL, 0);
 }
 
+int gb_control_disconnecting_operation(struct gb_control *control,
+                                       u16 cport_id)
+{
+       struct gb_control_disconnecting_request request;
+
+       request.cport_id = cpu_to_le16(cport_id);
+
+       return gb_operation_sync(control->connection,
+                                GB_CONTROL_TYPE_DISCONNECTING, &request,
+                                sizeof(request), NULL, 0);
+}
+
 int gb_control_mode_switch_operation(struct gb_control *control)
 {
        return gb_operation_unidirectional(control->connection,
 int gb_control_mode_switch_operation(struct gb_control *control)
 {
        return gb_operation_unidirectional(control->connection,
index 33e7e27..9891fbd 100644 (file)
@@ -36,6 +36,8 @@ void gb_control_put(struct gb_control *control);
 int gb_control_get_bundle_versions(struct gb_control *control);
 int gb_control_connected_operation(struct gb_control *control, u16 cport_id);
 int gb_control_disconnected_operation(struct gb_control *control, u16 cport_id);
 int gb_control_get_bundle_versions(struct gb_control *control);
 int gb_control_connected_operation(struct gb_control *control, u16 cport_id);
 int gb_control_disconnected_operation(struct gb_control *control, u16 cport_id);
+int gb_control_disconnecting_operation(struct gb_control *control,
+                                       u16 cport_id);
 int gb_control_mode_switch_operation(struct gb_control *control);
 int gb_control_get_manifest_size_operation(struct gb_interface *intf);
 int gb_control_get_manifest_operation(struct gb_interface *intf, void *manifest,
 int gb_control_mode_switch_operation(struct gb_control *control);
 int gb_control_get_manifest_size_operation(struct gb_interface *intf);
 int gb_control_get_manifest_operation(struct gb_interface *intf, void *manifest,
index b98f02c..216a1d1 100644 (file)
@@ -123,6 +123,7 @@ struct gb_protocol_version_response {
 #define GB_CONTROL_TYPE_TIMESYNC_AUTHORITATIVE 0x09
 /*     Unused                                  0x0a */
 #define GB_CONTROL_TYPE_BUNDLE_VERSION         0x0b
 #define GB_CONTROL_TYPE_TIMESYNC_AUTHORITATIVE 0x09
 /*     Unused                                  0x0a */
 #define GB_CONTROL_TYPE_BUNDLE_VERSION         0x0b
+#define GB_CONTROL_TYPE_DISCONNECTING          0x0c
 #define GB_CONTROL_TYPE_TIMESYNC_GET_LAST_EVENT        0x0d
 #define GB_CONTROL_TYPE_MODE_SWITCH            0x0e
 
 #define GB_CONTROL_TYPE_TIMESYNC_GET_LAST_EVENT        0x0d
 #define GB_CONTROL_TYPE_MODE_SWITCH            0x0e
 
@@ -160,6 +161,11 @@ struct gb_control_connected_request {
        __le16                  cport_id;
 } __packed;
 
        __le16                  cport_id;
 } __packed;
 
+struct gb_control_disconnecting_request {
+       __le16                  cport_id;
+} __packed;
+/* disconnecting response has no payload */
+
 struct gb_control_disconnected_request {
        __le16                  cport_id;
 } __packed;
 struct gb_control_disconnected_request {
        __le16                  cport_id;
 } __packed;