summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2015-03-03 10:52:14 +0100
committerFelipe Balbi <balbi@ti.com>2015-03-10 15:33:36 -0500
commitcee5cbff8d80ec2d10fe8070f229e95cc42443bf (patch)
treea8aae40b4f190e1721e845a7cfb6c056620e9b36 /drivers/usb/gadget
parent4504b5a0b22e26a7213d9e08706303a790f5a400 (diff)
downloadlinux-stable-cee5cbff8d80ec2d10fe8070f229e95cc42443bf.tar.gz
linux-stable-cee5cbff8d80ec2d10fe8070f229e95cc42443bf.tar.bz2
linux-stable-cee5cbff8d80ec2d10fe8070f229e95cc42443bf.zip
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: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/legacy/printer.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/usb/gadget/legacy/printer.c b/drivers/usb/gadget/legacy/printer.c
index c8570441a303..5dbb93a91512 100644
--- a/drivers/usb/gadget/legacy/printer.c
+++ b/drivers/usb/gadget/legacy/printer.c
@@ -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;
}