aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/zero.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/zero.c')
-rw-r--r--drivers/usb/gadget/zero.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index ae7a1c0f5748..51424f66a765 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -1119,7 +1119,7 @@ zero_autoresume (unsigned long _dev)
1119 1119
1120/*-------------------------------------------------------------------------*/ 1120/*-------------------------------------------------------------------------*/
1121 1121
1122static void 1122static void __exit
1123zero_unbind (struct usb_gadget *gadget) 1123zero_unbind (struct usb_gadget *gadget)
1124{ 1124{
1125 struct zero_dev *dev = get_gadget_data (gadget); 1125 struct zero_dev *dev = get_gadget_data (gadget);
@@ -1136,7 +1136,7 @@ zero_unbind (struct usb_gadget *gadget)
1136 set_gadget_data (gadget, NULL); 1136 set_gadget_data (gadget, NULL);
1137} 1137}
1138 1138
1139static int 1139static int __init
1140zero_bind (struct usb_gadget *gadget) 1140zero_bind (struct usb_gadget *gadget)
1141{ 1141{
1142 struct zero_dev *dev; 1142 struct zero_dev *dev;
@@ -1188,10 +1188,9 @@ autoconf_fail:
1188 1188
1189 1189
1190 /* ok, we made sense of the hardware ... */ 1190 /* ok, we made sense of the hardware ... */
1191 dev = kmalloc (sizeof *dev, SLAB_KERNEL); 1191 dev = kzalloc(sizeof(*dev), SLAB_KERNEL);
1192 if (!dev) 1192 if (!dev)
1193 return -ENOMEM; 1193 return -ENOMEM;
1194 memset (dev, 0, sizeof *dev);
1195 spin_lock_init (&dev->lock); 1194 spin_lock_init (&dev->lock);
1196 dev->gadget = gadget; 1195 dev->gadget = gadget;
1197 set_gadget_data (gadget, dev); 1196 set_gadget_data (gadget, dev);
@@ -1224,12 +1223,6 @@ autoconf_fail:
1224 loopback_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP; 1223 loopback_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
1225 } 1224 }
1226 1225
1227 if (gadget->is_otg) {
1228 otg_descriptor.bmAttributes |= USB_OTG_HNP,
1229 source_sink_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
1230 loopback_config.bmAttributes |= USB_CONFIG_ATT_WAKEUP;
1231 }
1232
1233 usb_gadget_set_selfpowered (gadget); 1226 usb_gadget_set_selfpowered (gadget);
1234 1227
1235 init_timer (&dev->resume); 1228 init_timer (&dev->resume);
@@ -1294,7 +1287,7 @@ static struct usb_gadget_driver zero_driver = {
1294#endif 1287#endif
1295 .function = (char *) longname, 1288 .function = (char *) longname,
1296 .bind = zero_bind, 1289 .bind = zero_bind,
1297 .unbind = zero_unbind, 1290 .unbind = __exit_p(zero_unbind),
1298 1291
1299 .setup = zero_setup, 1292 .setup = zero_setup,
1300 .disconnect = zero_disconnect, 1293 .disconnect = zero_disconnect,