usb: gadget: udc-core: fix bug on soft_connect interface
authorFelipe Balbi <balbi@ti.com>
Thu, 8 Sep 2011 11:12:18 +0000 (14:12 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 26 Sep 2011 22:36:07 +0000 (15:36 -0700)
We should not be using dev_get_drvdata() because we
never call dev_set_drvdata(). Let's use container_of()
as all other sysfs attributes.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/udc-core.c

index 5e77a46a429a40d1da00ea64177ea6fe86058b24..022baeca7c94f4f55819d6cf2be5550752e3318a 100644 (file)
@@ -356,7 +356,7 @@ static DEVICE_ATTR(srp, S_IWUSR, NULL, usb_udc_srp_store);
 static ssize_t usb_udc_softconn_store(struct device *dev,
                struct device_attribute *attr, const char *buf, size_t n)
 {
-       struct usb_udc          *udc = dev_get_drvdata(dev);
+       struct usb_udc          *udc = container_of(dev, struct usb_udc, dev);
 
        if (sysfs_streq(buf, "connect")) {
                usb_gadget_connect(udc->gadget);