From: Felipe Balbi Date: Thu, 18 Sep 2014 15:01:55 +0000 (-0500) Subject: usb: gadget: composite: conditionally dequeue os_desc and setup requests X-Git-Tag: omap-for-v3.20/drop-legacy-3517~84^2~32^2~209 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7c12eaf2e5eea0c15242ebb7d1d3b6e7fcb62bb;p=pandora-kernel.git usb: gadget: composite: conditionally dequeue os_desc and setup requests In case we unload a gadget driver while any of os_desc_req or req are still pending, we need to make sure to dequeue them. By using our setup_pending and os_desc_pending flags we achieve that in a way that doesn't cause any regressions because we won't dequeue a request which was already completed. The original idea came from Li Jun's commit f2267089ea17fa97b796b1b4247e3f8957655df3 (usb: gadget: composite: dequeue cdev->req before free it in composite_dev_cleanup) which, unfortunately, caused two regressions (kfree() being called before usb_ep_dequeue() and calling usb_ep_dequeue() when the request was already completed). That commit also didn't take care of os_desc_req which can fall into the same situation so we must care for that one too. Note that in order to make code slightly easier to read, we introduce composite_ep_queue() which hides details about how to fiddle with our pending flags. Signed-off-by: Felipe Balbi --- Reading git-diff-tree failed