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

Commit cee5cbff authored by Andrzej Pietrasiewicz's avatar Andrzej Pietrasiewicz Committed by Felipe Balbi
Browse files

usb: gadget: printer: call usb_add_function() last



Conversion to the new function interface requires splitting a
<something>_bind_config() function into two parts: allocation of
container_of struct usb_function and invocation of usb_add_function().
This patch moves the latter to the end of the f_printer_bind_config()
in order to enable conversion to the new interface.

Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 4504b5a0
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -1254,11 +1254,6 @@ static int f_printer_bind_config(struct usb_configuration *c, char *pnp_str,
	INIT_LIST_HEAD(&dev->rx_reqs);
	INIT_LIST_HEAD(&dev->rx_buffers);

	dev->q_len = q_len;
	status = usb_add_function(c, &dev->function);
	if (status)
		return status;

	if (pnp_str)
		strlcpy(&pnp_string[2], pnp_str, sizeof(pnp_string) - 2);

@@ -1280,7 +1275,11 @@ static int f_printer_bind_config(struct usb_configuration *c, char *pnp_str,
	dev->current_rx_req = NULL;
	dev->current_rx_bytes = 0;
	dev->current_rx_buf = NULL;
	dev->q_len = q_len;

	status = usb_add_function(c, &dev->function);
	if (status)
		return status;
	INFO(dev, "%s, version: " DRIVER_VERSION "\n", driver_desc);
	return 0;
}