Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f77b80f authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

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: default avatarJohan Hovold <johan@hovoldconsulting.com>
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Acked-by: default avatarSandeep Patil <sspatil@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 8f71a975
Loading
Loading
Loading
Loading
+21 −5
Original line number Diff line number Diff line
@@ -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)