Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Johan Hovold and committed by
Greg Kroah-Hartman
9f77b80f 8f71a975

+21 -5
+21 -5
drivers/staging/greybus/control.c
··· 152 152 int gb_control_disconnecting_operation(struct gb_control *control, 153 153 u16 cport_id) 154 154 { 155 - struct gb_control_disconnecting_request request; 155 + struct gb_control_disconnecting_request *request; 156 + struct gb_operation *operation; 157 + int ret; 156 158 157 - request.cport_id = cpu_to_le16(cport_id); 159 + operation = gb_operation_create_core(control->connection, 160 + GB_CONTROL_TYPE_DISCONNECTING, 161 + sizeof(*request), 0, 0, 162 + GFP_KERNEL); 163 + if (!operation) 164 + return -ENOMEM; 158 165 159 - return gb_operation_sync(control->connection, 160 - GB_CONTROL_TYPE_DISCONNECTING, &request, 161 - sizeof(request), NULL, 0); 166 + request = operation->request->payload; 167 + request->cport_id = cpu_to_le16(cport_id); 168 + 169 + ret = gb_operation_request_send_sync(operation); 170 + if (ret) { 171 + dev_err(&control->dev, "failed to send disconnecting: %d\n", 172 + ret); 173 + } 174 + 175 + gb_operation_put(operation); 176 + 177 + return ret; 162 178 } 163 179 164 180 int gb_control_mode_switch_operation(struct gb_control *control)