wa-rpipe.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. /*
  2. * WUSB Wire Adapter
  3. * rpipe management
  4. *
  5. * Copyright (C) 2005-2006 Intel Corporation
  6. * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License version
  10. * 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  20. * 02110-1301, USA.
  21. *
  22. *
  23. * FIXME: docs
  24. *
  25. * RPIPE
  26. *
  27. * Targeted at different downstream endpoints
  28. *
  29. * Descriptor: use to config the remote pipe.
  30. *
  31. * The number of blocks could be dynamic (wBlocks in descriptor is
  32. * 0)--need to schedule them then.
  33. *
  34. * Each bit in wa->rpipe_bm represents if an rpipe is being used or
  35. * not. Rpipes are represented with a 'struct wa_rpipe' that is
  36. * attached to the hcpriv member of a 'struct usb_host_endpoint'.
  37. *
  38. * When you need to xfer data to an endpoint, you get an rpipe for it
  39. * with wa_ep_rpipe_get(), which gives you a reference to the rpipe
  40. * and keeps a single one (the first one) with the endpoint. When you
  41. * are done transferring, you drop that reference. At the end the
  42. * rpipe is always allocated and bound to the endpoint. There it might
  43. * be recycled when not used.
  44. *
  45. * Addresses:
  46. *
  47. * We use a 1:1 mapping mechanism between port address (0 based
  48. * index, actually) and the address. The USB stack knows about this.
  49. *
  50. * USB Stack port number 4 (1 based)
  51. * WUSB code port index 3 (0 based)
  52. * USB Address 5 (2 based -- 0 is for default, 1 for root hub)
  53. *
  54. * Now, because we don't use the concept as default address exactly
  55. * like the (wired) USB code does, we need to kind of skip it. So we
  56. * never take addresses from the urb->pipe, but from the
  57. * urb->dev->devnum, to make sure that we always have the right
  58. * destination address.
  59. */
  60. #include <linux/atomic.h>
  61. #include <linux/bitmap.h>
  62. #include <linux/slab.h>
  63. #include <linux/export.h>
  64. #include "wusbhc.h"
  65. #include "wa-hc.h"
  66. static int __rpipe_get_descr(struct wahc *wa,
  67. struct usb_rpipe_descriptor *descr, u16 index)
  68. {
  69. ssize_t result;
  70. struct device *dev = &wa->usb_iface->dev;
  71. /* Get the RPIPE descriptor -- we cannot use the usb_get_descriptor()
  72. * function because the arguments are different.
  73. */
  74. result = usb_control_msg(
  75. wa->usb_dev, usb_rcvctrlpipe(wa->usb_dev, 0),
  76. USB_REQ_GET_DESCRIPTOR,
  77. USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_RPIPE,
  78. USB_DT_RPIPE<<8, index, descr, sizeof(*descr),
  79. USB_CTRL_GET_TIMEOUT);
  80. if (result < 0) {
  81. dev_err(dev, "rpipe %u: get descriptor failed: %d\n",
  82. index, (int)result);
  83. goto error;
  84. }
  85. if (result < sizeof(*descr)) {
  86. dev_err(dev, "rpipe %u: got short descriptor "
  87. "(%zd vs %zd bytes needed)\n",
  88. index, result, sizeof(*descr));
  89. result = -EINVAL;
  90. goto error;
  91. }
  92. result = 0;
  93. error:
  94. return result;
  95. }
  96. /*
  97. *
  98. * The descriptor is assumed to be properly initialized (ie: you got
  99. * it through __rpipe_get_descr()).
  100. */
  101. static int __rpipe_set_descr(struct wahc *wa,
  102. struct usb_rpipe_descriptor *descr, u16 index)
  103. {
  104. ssize_t result;
  105. struct device *dev = &wa->usb_iface->dev;
  106. /* we cannot use the usb_get_descriptor() function because the
  107. * arguments are different.
  108. */
  109. result = usb_control_msg(
  110. wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0),
  111. USB_REQ_SET_DESCRIPTOR,
  112. USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_RPIPE,
  113. USB_DT_RPIPE<<8, index, descr, sizeof(*descr),
  114. USB_CTRL_SET_TIMEOUT);
  115. if (result < 0) {
  116. dev_err(dev, "rpipe %u: set descriptor failed: %d\n",
  117. index, (int)result);
  118. goto error;
  119. }
  120. if (result < sizeof(*descr)) {
  121. dev_err(dev, "rpipe %u: sent short descriptor "
  122. "(%zd vs %zd bytes required)\n",
  123. index, result, sizeof(*descr));
  124. result = -EINVAL;
  125. goto error;
  126. }
  127. result = 0;
  128. error:
  129. return result;
  130. }
  131. static void rpipe_init(struct wa_rpipe *rpipe)
  132. {
  133. kref_init(&rpipe->refcnt);
  134. spin_lock_init(&rpipe->seg_lock);
  135. INIT_LIST_HEAD(&rpipe->seg_list);
  136. INIT_LIST_HEAD(&rpipe->list_node);
  137. }
  138. static unsigned rpipe_get_idx(struct wahc *wa, unsigned rpipe_idx)
  139. {
  140. unsigned long flags;
  141. spin_lock_irqsave(&wa->rpipe_lock, flags);
  142. rpipe_idx = find_next_zero_bit(wa->rpipe_bm, wa->rpipes, rpipe_idx);
  143. if (rpipe_idx < wa->rpipes)
  144. set_bit(rpipe_idx, wa->rpipe_bm);
  145. spin_unlock_irqrestore(&wa->rpipe_lock, flags);
  146. return rpipe_idx;
  147. }
  148. static void rpipe_put_idx(struct wahc *wa, unsigned rpipe_idx)
  149. {
  150. unsigned long flags;
  151. spin_lock_irqsave(&wa->rpipe_lock, flags);
  152. clear_bit(rpipe_idx, wa->rpipe_bm);
  153. spin_unlock_irqrestore(&wa->rpipe_lock, flags);
  154. }
  155. void rpipe_destroy(struct kref *_rpipe)
  156. {
  157. struct wa_rpipe *rpipe = container_of(_rpipe, struct wa_rpipe, refcnt);
  158. u8 index = le16_to_cpu(rpipe->descr.wRPipeIndex);
  159. if (rpipe->ep)
  160. rpipe->ep->hcpriv = NULL;
  161. rpipe_put_idx(rpipe->wa, index);
  162. wa_put(rpipe->wa);
  163. kfree(rpipe);
  164. }
  165. EXPORT_SYMBOL_GPL(rpipe_destroy);
  166. /*
  167. * Locate an idle rpipe, create an structure for it and return it
  168. *
  169. * @wa is referenced and unlocked
  170. * @crs enum rpipe_attr, required endpoint characteristics
  171. *
  172. * The rpipe can be used only sequentially (not in parallel).
  173. *
  174. * The rpipe is moved into the "ready" state.
  175. */
  176. static int rpipe_get_idle(struct wa_rpipe **prpipe, struct wahc *wa, u8 crs,
  177. gfp_t gfp)
  178. {
  179. int result;
  180. unsigned rpipe_idx;
  181. struct wa_rpipe *rpipe;
  182. struct device *dev = &wa->usb_iface->dev;
  183. rpipe = kzalloc(sizeof(*rpipe), gfp);
  184. if (rpipe == NULL)
  185. return -ENOMEM;
  186. rpipe_init(rpipe);
  187. /* Look for an idle pipe */
  188. for (rpipe_idx = 0; rpipe_idx < wa->rpipes; rpipe_idx++) {
  189. rpipe_idx = rpipe_get_idx(wa, rpipe_idx);
  190. if (rpipe_idx >= wa->rpipes) /* no more pipes :( */
  191. break;
  192. result = __rpipe_get_descr(wa, &rpipe->descr, rpipe_idx);
  193. if (result < 0)
  194. dev_err(dev, "Can't get descriptor for rpipe %u: %d\n",
  195. rpipe_idx, result);
  196. else if ((rpipe->descr.bmCharacteristics & crs) != 0)
  197. goto found;
  198. rpipe_put_idx(wa, rpipe_idx);
  199. }
  200. *prpipe = NULL;
  201. kfree(rpipe);
  202. return -ENXIO;
  203. found:
  204. set_bit(rpipe_idx, wa->rpipe_bm);
  205. rpipe->wa = wa_get(wa);
  206. *prpipe = rpipe;
  207. return 0;
  208. }
  209. static int __rpipe_reset(struct wahc *wa, unsigned index)
  210. {
  211. int result;
  212. struct device *dev = &wa->usb_iface->dev;
  213. result = usb_control_msg(
  214. wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0),
  215. USB_REQ_RPIPE_RESET,
  216. USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_RPIPE,
  217. 0, index, NULL, 0, USB_CTRL_SET_TIMEOUT);
  218. if (result < 0)
  219. dev_err(dev, "rpipe %u: reset failed: %d\n",
  220. index, result);
  221. return result;
  222. }
  223. /*
  224. * Fake companion descriptor for ep0
  225. *
  226. * See WUSB1.0[7.4.4], most of this is zero for bulk/int/ctl
  227. */
  228. static struct usb_wireless_ep_comp_descriptor epc0 = {
  229. .bLength = sizeof(epc0),
  230. .bDescriptorType = USB_DT_WIRELESS_ENDPOINT_COMP,
  231. .bMaxBurst = 1,
  232. .bMaxSequence = 2,
  233. };
  234. /*
  235. * Look for EP companion descriptor
  236. *
  237. * Get there, look for Inara in the endpoint's extra descriptors
  238. */
  239. static struct usb_wireless_ep_comp_descriptor *rpipe_epc_find(
  240. struct device *dev, struct usb_host_endpoint *ep)
  241. {
  242. void *itr;
  243. size_t itr_size;
  244. struct usb_descriptor_header *hdr;
  245. struct usb_wireless_ep_comp_descriptor *epcd;
  246. if (ep->desc.bEndpointAddress == 0) {
  247. epcd = &epc0;
  248. goto out;
  249. }
  250. itr = ep->extra;
  251. itr_size = ep->extralen;
  252. epcd = NULL;
  253. while (itr_size > 0) {
  254. if (itr_size < sizeof(*hdr)) {
  255. dev_err(dev, "HW Bug? ep 0x%02x: extra descriptors "
  256. "at offset %zu: only %zu bytes left\n",
  257. ep->desc.bEndpointAddress,
  258. itr - (void *) ep->extra, itr_size);
  259. break;
  260. }
  261. hdr = itr;
  262. if (hdr->bDescriptorType == USB_DT_WIRELESS_ENDPOINT_COMP) {
  263. epcd = itr;
  264. break;
  265. }
  266. if (hdr->bLength > itr_size) {
  267. dev_err(dev, "HW Bug? ep 0x%02x: extra descriptor "
  268. "at offset %zu (type 0x%02x) "
  269. "length %d but only %zu bytes left\n",
  270. ep->desc.bEndpointAddress,
  271. itr - (void *) ep->extra, hdr->bDescriptorType,
  272. hdr->bLength, itr_size);
  273. break;
  274. }
  275. itr += hdr->bLength;
  276. itr_size -= hdr->bLength;
  277. }
  278. out:
  279. return epcd;
  280. }
  281. /*
  282. * Aim an rpipe to its device & endpoint destination
  283. *
  284. * Make sure we change the address to unauthenticated if the device
  285. * is WUSB and it is not authenticated.
  286. */
  287. static int rpipe_aim(struct wa_rpipe *rpipe, struct wahc *wa,
  288. struct usb_host_endpoint *ep, struct urb *urb, gfp_t gfp)
  289. {
  290. int result = -ENOMSG; /* better code for lack of companion? */
  291. struct device *dev = &wa->usb_iface->dev;
  292. struct usb_device *usb_dev = urb->dev;
  293. struct usb_wireless_ep_comp_descriptor *epcd;
  294. u32 ack_window, epcd_max_sequence;
  295. u8 unauth;
  296. epcd = rpipe_epc_find(dev, ep);
  297. if (epcd == NULL) {
  298. dev_err(dev, "ep 0x%02x: can't find companion descriptor\n",
  299. ep->desc.bEndpointAddress);
  300. goto error;
  301. }
  302. unauth = usb_dev->wusb && !usb_dev->authenticated ? 0x80 : 0;
  303. __rpipe_reset(wa, le16_to_cpu(rpipe->descr.wRPipeIndex));
  304. atomic_set(&rpipe->segs_available,
  305. le16_to_cpu(rpipe->descr.wRequests));
  306. /* FIXME: block allocation system; request with queuing and timeout */
  307. /* FIXME: compute so seg_size > ep->maxpktsize */
  308. rpipe->descr.wBlocks = cpu_to_le16(16); /* given */
  309. /* ep0 maxpktsize is 0x200 (WUSB1.0[4.8.1]) */
  310. if (usb_endpoint_xfer_isoc(&ep->desc))
  311. rpipe->descr.wMaxPacketSize = epcd->wOverTheAirPacketSize;
  312. else
  313. rpipe->descr.wMaxPacketSize = ep->desc.wMaxPacketSize;
  314. rpipe->descr.hwa_bMaxBurst = max(min_t(unsigned int,
  315. epcd->bMaxBurst, 16U), 1U);
  316. rpipe->descr.hwa_bDeviceInfoIndex =
  317. wusb_port_no_to_idx(urb->dev->portnum);
  318. /* FIXME: use maximum speed as supported or recommended by device */
  319. rpipe->descr.bSpeed = usb_pipeendpoint(urb->pipe) == 0 ?
  320. UWB_PHY_RATE_53 : UWB_PHY_RATE_200;
  321. dev_dbg(dev, "addr %u (0x%02x) rpipe #%u ep# %u speed %d\n",
  322. urb->dev->devnum, urb->dev->devnum | unauth,
  323. le16_to_cpu(rpipe->descr.wRPipeIndex),
  324. usb_pipeendpoint(urb->pipe), rpipe->descr.bSpeed);
  325. rpipe->descr.hwa_reserved = 0;
  326. rpipe->descr.bEndpointAddress = ep->desc.bEndpointAddress;
  327. /* FIXME: bDataSequence */
  328. rpipe->descr.bDataSequence = 0;
  329. /* start with base window of hwa_bMaxBurst bits starting at 0. */
  330. ack_window = 0xFFFFFFFF >> (32 - rpipe->descr.hwa_bMaxBurst);
  331. rpipe->descr.dwCurrentWindow = cpu_to_le32(ack_window);
  332. epcd_max_sequence = max(min_t(unsigned int,
  333. epcd->bMaxSequence, 32U), 2U);
  334. rpipe->descr.bMaxDataSequence = epcd_max_sequence - 1;
  335. rpipe->descr.bInterval = ep->desc.bInterval;
  336. if (usb_endpoint_xfer_isoc(&ep->desc))
  337. rpipe->descr.bOverTheAirInterval = epcd->bOverTheAirInterval;
  338. else
  339. rpipe->descr.bOverTheAirInterval = 0; /* 0 if not isoc */
  340. /* FIXME: xmit power & preamble blah blah */
  341. rpipe->descr.bmAttribute = (ep->desc.bmAttributes &
  342. USB_ENDPOINT_XFERTYPE_MASK);
  343. /* rpipe->descr.bmCharacteristics RO */
  344. rpipe->descr.bmRetryOptions = (wa->wusb->retry_count & 0xF);
  345. /* FIXME: use for assessing link quality? */
  346. rpipe->descr.wNumTransactionErrors = 0;
  347. result = __rpipe_set_descr(wa, &rpipe->descr,
  348. le16_to_cpu(rpipe->descr.wRPipeIndex));
  349. if (result < 0) {
  350. dev_err(dev, "Cannot aim rpipe: %d\n", result);
  351. goto error;
  352. }
  353. result = 0;
  354. error:
  355. return result;
  356. }
  357. /*
  358. * Check an aimed rpipe to make sure it points to where we want
  359. *
  360. * We use bit 19 of the Linux USB pipe bitmap for unauth vs auth
  361. * space; when it is like that, we or 0x80 to make an unauth address.
  362. */
  363. static int rpipe_check_aim(const struct wa_rpipe *rpipe, const struct wahc *wa,
  364. const struct usb_host_endpoint *ep,
  365. const struct urb *urb, gfp_t gfp)
  366. {
  367. int result = 0;
  368. struct device *dev = &wa->usb_iface->dev;
  369. u8 portnum = wusb_port_no_to_idx(urb->dev->portnum);
  370. #define AIM_CHECK(rdf, val, text) \
  371. do { \
  372. if (rpipe->descr.rdf != (val)) { \
  373. dev_err(dev, \
  374. "rpipe aim discrepancy: " #rdf " " text "\n", \
  375. rpipe->descr.rdf, (val)); \
  376. result = -EINVAL; \
  377. WARN_ON(1); \
  378. } \
  379. } while (0)
  380. AIM_CHECK(hwa_bDeviceInfoIndex, portnum, "(%u vs %u)");
  381. AIM_CHECK(bSpeed, usb_pipeendpoint(urb->pipe) == 0 ?
  382. UWB_PHY_RATE_53 : UWB_PHY_RATE_200,
  383. "(%u vs %u)");
  384. AIM_CHECK(bEndpointAddress, ep->desc.bEndpointAddress, "(%u vs %u)");
  385. AIM_CHECK(bInterval, ep->desc.bInterval, "(%u vs %u)");
  386. AIM_CHECK(bmAttribute, ep->desc.bmAttributes & 0x03, "(%u vs %u)");
  387. #undef AIM_CHECK
  388. return result;
  389. }
  390. #ifndef CONFIG_BUG
  391. #define CONFIG_BUG 0
  392. #endif
  393. /*
  394. * Make sure there is an rpipe allocated for an endpoint
  395. *
  396. * If already allocated, we just refcount it; if not, we get an
  397. * idle one, aim it to the right location and take it.
  398. *
  399. * Attaches to ep->hcpriv and rpipe->ep to ep.
  400. */
  401. int rpipe_get_by_ep(struct wahc *wa, struct usb_host_endpoint *ep,
  402. struct urb *urb, gfp_t gfp)
  403. {
  404. int result = 0;
  405. struct device *dev = &wa->usb_iface->dev;
  406. struct wa_rpipe *rpipe;
  407. u8 eptype;
  408. mutex_lock(&wa->rpipe_mutex);
  409. rpipe = ep->hcpriv;
  410. if (rpipe != NULL) {
  411. if (CONFIG_BUG == 1) {
  412. result = rpipe_check_aim(rpipe, wa, ep, urb, gfp);
  413. if (result < 0)
  414. goto error;
  415. }
  416. __rpipe_get(rpipe);
  417. dev_dbg(dev, "ep 0x%02x: reusing rpipe %u\n",
  418. ep->desc.bEndpointAddress,
  419. le16_to_cpu(rpipe->descr.wRPipeIndex));
  420. } else {
  421. /* hmm, assign idle rpipe, aim it */
  422. result = -ENOBUFS;
  423. eptype = ep->desc.bmAttributes & 0x03;
  424. result = rpipe_get_idle(&rpipe, wa, 1 << eptype, gfp);
  425. if (result < 0)
  426. goto error;
  427. result = rpipe_aim(rpipe, wa, ep, urb, gfp);
  428. if (result < 0) {
  429. rpipe_put(rpipe);
  430. goto error;
  431. }
  432. ep->hcpriv = rpipe;
  433. rpipe->ep = ep;
  434. __rpipe_get(rpipe); /* for caching into ep->hcpriv */
  435. dev_dbg(dev, "ep 0x%02x: using rpipe %u\n",
  436. ep->desc.bEndpointAddress,
  437. le16_to_cpu(rpipe->descr.wRPipeIndex));
  438. }
  439. error:
  440. mutex_unlock(&wa->rpipe_mutex);
  441. return result;
  442. }
  443. /*
  444. * Allocate the bitmap for each rpipe.
  445. */
  446. int wa_rpipes_create(struct wahc *wa)
  447. {
  448. wa->rpipes = le16_to_cpu(wa->wa_descr->wNumRPipes);
  449. wa->rpipe_bm = kzalloc(BITS_TO_LONGS(wa->rpipes)*sizeof(unsigned long),
  450. GFP_KERNEL);
  451. if (wa->rpipe_bm == NULL)
  452. return -ENOMEM;
  453. return 0;
  454. }
  455. void wa_rpipes_destroy(struct wahc *wa)
  456. {
  457. struct device *dev = &wa->usb_iface->dev;
  458. if (!bitmap_empty(wa->rpipe_bm, wa->rpipes)) {
  459. WARN_ON(1);
  460. dev_err(dev, "BUG: pipes not released on exit: %*pb\n",
  461. wa->rpipes, wa->rpipe_bm);
  462. }
  463. kfree(wa->rpipe_bm);
  464. }
  465. /*
  466. * Release resources allocated for an endpoint
  467. *
  468. * If there is an associated rpipe to this endpoint, Abort any pending
  469. * transfers and put it. If the rpipe ends up being destroyed,
  470. * __rpipe_destroy() will cleanup ep->hcpriv.
  471. *
  472. * This is called before calling hcd->stop(), so you don't need to do
  473. * anything else in there.
  474. */
  475. void rpipe_ep_disable(struct wahc *wa, struct usb_host_endpoint *ep)
  476. {
  477. struct wa_rpipe *rpipe;
  478. mutex_lock(&wa->rpipe_mutex);
  479. rpipe = ep->hcpriv;
  480. if (rpipe != NULL) {
  481. u16 index = le16_to_cpu(rpipe->descr.wRPipeIndex);
  482. usb_control_msg(
  483. wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0),
  484. USB_REQ_RPIPE_ABORT,
  485. USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_RPIPE,
  486. 0, index, NULL, 0, USB_CTRL_SET_TIMEOUT);
  487. rpipe_put(rpipe);
  488. }
  489. mutex_unlock(&wa->rpipe_mutex);
  490. }
  491. EXPORT_SYMBOL_GPL(rpipe_ep_disable);
  492. /* Clear the stalled status of an RPIPE. */
  493. void rpipe_clear_feature_stalled(struct wahc *wa, struct usb_host_endpoint *ep)
  494. {
  495. struct wa_rpipe *rpipe;
  496. mutex_lock(&wa->rpipe_mutex);
  497. rpipe = ep->hcpriv;
  498. if (rpipe != NULL) {
  499. u16 index = le16_to_cpu(rpipe->descr.wRPipeIndex);
  500. usb_control_msg(
  501. wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0),
  502. USB_REQ_CLEAR_FEATURE,
  503. USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_RPIPE,
  504. RPIPE_STALL, index, NULL, 0, USB_CTRL_SET_TIMEOUT);
  505. }
  506. mutex_unlock(&wa->rpipe_mutex);
  507. }
  508. EXPORT_SYMBOL_GPL(rpipe_clear_feature_stalled);