usb: gadget: printer: don't access file global usb_printer_gadget in function's code
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Tue, 3 Mar 2015 09:52:21 +0000 (10:52 +0100)
committerFelipe Balbi <balbi@ti.com>
Tue, 10 Mar 2015 20:33:38 +0000 (15:33 -0500)
The printer_dev can be recovered from printer_func_unbind() function's
parameters.

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/legacy/printer.c

index 3206ebcdd7a6a28bcc4ab90c8b9ae86d5a77354b..806475c19934d5a312ae512f29d5eddae2bf91d2 100644 (file)
@@ -1159,7 +1159,7 @@ static void printer_func_unbind(struct usb_configuration *c,
        struct printer_dev      *dev;
        struct usb_request      *req;
 
-       dev = &usb_printer_gadget;
+       dev = container_of(f, struct printer_dev, function);
 
        device_destroy(usb_gadget_class, g_printer_devno);