Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: composite: fix usb_function_activate/deactivate functions

Using usb_gadget_disconnect to make gadget temporarily invisible to host
doesn't provide desired result, because gadget is connected immediately
after binding regardless to previous usb_gadget_disconnect() calls.

For this reason we use usb_gadget_deactivate() instead of
usb_gadget_disconnect() to make it working as expected.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Robert Baldyga and committed by
Felipe Balbi
5601250b ccdf138f

+2 -2
+2 -2
drivers/usb/gadget/composite.c
··· 279 279 spin_lock_irqsave(&cdev->lock, flags); 280 280 281 281 if (cdev->deactivations == 0) 282 - status = usb_gadget_disconnect(cdev->gadget); 282 + status = usb_gadget_deactivate(cdev->gadget); 283 283 if (status == 0) 284 284 cdev->deactivations++; 285 285 ··· 311 311 else { 312 312 cdev->deactivations--; 313 313 if (cdev->deactivations == 0) 314 - status = usb_gadget_connect(cdev->gadget); 314 + status = usb_gadget_activate(cdev->gadget); 315 315 } 316 316 317 317 spin_unlock_irqrestore(&cdev->lock, flags);