neh.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. /*
  2. * WUSB Wire Adapter: Radio Control Interface (WUSB[8])
  3. * Notification and Event Handling
  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. * The RC interface of the Host Wire Adapter (USB dongle) or WHCI PCI
  24. * card delivers a stream of notifications and events to the
  25. * notification end event endpoint or area. This code takes care of
  26. * getting a buffer with that data, breaking it up in separate
  27. * notifications and events and then deliver those.
  28. *
  29. * Events are answers to commands and they carry a context ID that
  30. * associates them to the command. Notifications are that,
  31. * notifications, they come out of the blue and have a context ID of
  32. * zero. Think of the context ID kind of like a handler. The
  33. * uwb_rc_neh_* code deals with managing context IDs.
  34. *
  35. * This is why you require a handle to operate on a UWB host. When you
  36. * open a handle a context ID is assigned to you.
  37. *
  38. * So, as it is done is:
  39. *
  40. * 1. Add an event handler [uwb_rc_neh_add()] (assigns a ctx id)
  41. * 2. Issue command [rc->cmd(rc, ...)]
  42. * 3. Arm the timeout timer [uwb_rc_neh_arm()]
  43. * 4, Release the reference to the neh [uwb_rc_neh_put()]
  44. * 5. Wait for the callback
  45. * 6. Command result (RCEB) is passed to the callback
  46. *
  47. * If (2) fails, you should remove the handle [uwb_rc_neh_rm()]
  48. * instead of arming the timer.
  49. *
  50. * Handles are for using in *serialized* code, single thread.
  51. *
  52. * When the notification/event comes, the IRQ handler/endpoint
  53. * callback passes the data read to uwb_rc_neh_grok() which will break
  54. * it up in a discrete series of events, look up who is listening for
  55. * them and execute the pertinent callbacks.
  56. *
  57. * If the reader detects an error while reading the data stream, call
  58. * uwb_rc_neh_error().
  59. *
  60. * CONSTRAINTS/ASSUMPTIONS:
  61. *
  62. * - Most notifications/events are small (less thank .5k), copying
  63. * around is ok.
  64. *
  65. * - Notifications/events are ALWAYS smaller than PAGE_SIZE
  66. *
  67. * - Notifications/events always come in a single piece (ie: a buffer
  68. * will always contain entire notifications/events).
  69. *
  70. * - we cannot know in advance how long each event is (because they
  71. * lack a length field in their header--smart move by the standards
  72. * body, btw). So we need a facility to get the event size given the
  73. * header. This is what the EST code does (notif/Event Size
  74. * Tables), check nest.c--as well, you can associate the size to
  75. * the handle [w/ neh->extra_size()].
  76. *
  77. * - Most notifications/events are fixed size; only a few are variable
  78. * size (NEST takes care of that).
  79. *
  80. * - Listeners of events expect them, so they usually provide a
  81. * buffer, as they know the size. Listeners to notifications don't,
  82. * so we allocate their buffers dynamically.
  83. */
  84. #include <linux/kernel.h>
  85. #include <linux/timer.h>
  86. #include <linux/err.h>
  87. #include "uwb-internal.h"
  88. /*
  89. * UWB Radio Controller Notification/Event Handle
  90. *
  91. * Represents an entity waiting for an event coming from the UWB Radio
  92. * Controller with a given context id (context) and type (evt_type and
  93. * evt). On reception of the notification/event, the callback (cb) is
  94. * called with the event.
  95. *
  96. * If the timer expires before the event is received, the callback is
  97. * called with -ETIMEDOUT as the event size.
  98. */
  99. struct uwb_rc_neh {
  100. struct kref kref;
  101. struct uwb_rc *rc;
  102. u8 evt_type;
  103. __le16 evt;
  104. u8 context;
  105. uwb_rc_cmd_cb_f cb;
  106. void *arg;
  107. struct timer_list timer;
  108. struct list_head list_node;
  109. };
  110. static void uwb_rc_neh_timer(unsigned long arg);
  111. static void uwb_rc_neh_release(struct kref *kref)
  112. {
  113. struct uwb_rc_neh *neh = container_of(kref, struct uwb_rc_neh, kref);
  114. kfree(neh);
  115. }
  116. static void uwb_rc_neh_get(struct uwb_rc_neh *neh)
  117. {
  118. kref_get(&neh->kref);
  119. }
  120. /**
  121. * uwb_rc_neh_put - release reference to a neh
  122. * @neh: the neh
  123. */
  124. void uwb_rc_neh_put(struct uwb_rc_neh *neh)
  125. {
  126. kref_put(&neh->kref, uwb_rc_neh_release);
  127. }
  128. /**
  129. * Assigns @neh a context id from @rc's pool
  130. *
  131. * @rc: UWB Radio Controller descriptor; @rc->neh_lock taken
  132. * @neh: Notification/Event Handle
  133. * @returns 0 if context id was assigned ok; < 0 errno on error (if
  134. * all the context IDs are taken).
  135. *
  136. * (assumes @wa is locked).
  137. *
  138. * NOTE: WUSB spec reserves context ids 0x00 for notifications and
  139. * 0xff is invalid, so they must not be used. Initialization
  140. * fills up those two in the bitmap so they are not allocated.
  141. *
  142. * We spread the allocation around to reduce the posiblity of two
  143. * consecutive opened @neh's getting the same context ID assigned (to
  144. * avoid surprises with late events that timed out long time ago). So
  145. * first we search from where @rc->ctx_roll is, if not found, we
  146. * search from zero.
  147. */
  148. static
  149. int __uwb_rc_ctx_get(struct uwb_rc *rc, struct uwb_rc_neh *neh)
  150. {
  151. int result;
  152. result = find_next_zero_bit(rc->ctx_bm, UWB_RC_CTX_MAX,
  153. rc->ctx_roll++);
  154. if (result < UWB_RC_CTX_MAX)
  155. goto found;
  156. result = find_first_zero_bit(rc->ctx_bm, UWB_RC_CTX_MAX);
  157. if (result < UWB_RC_CTX_MAX)
  158. goto found;
  159. return -ENFILE;
  160. found:
  161. set_bit(result, rc->ctx_bm);
  162. neh->context = result;
  163. return 0;
  164. }
  165. /** Releases @neh's context ID back to @rc (@rc->neh_lock is locked). */
  166. static
  167. void __uwb_rc_ctx_put(struct uwb_rc *rc, struct uwb_rc_neh *neh)
  168. {
  169. struct device *dev = &rc->uwb_dev.dev;
  170. if (neh->context == 0)
  171. return;
  172. if (test_bit(neh->context, rc->ctx_bm) == 0) {
  173. dev_err(dev, "context %u not set in bitmap\n",
  174. neh->context);
  175. WARN_ON(1);
  176. }
  177. clear_bit(neh->context, rc->ctx_bm);
  178. neh->context = 0;
  179. }
  180. /**
  181. * uwb_rc_neh_add - add a neh for a radio controller command
  182. * @rc: the radio controller
  183. * @cmd: the radio controller command
  184. * @expected_type: the type of the expected response event
  185. * @expected_event: the expected event ID
  186. * @cb: callback for when the event is received
  187. * @arg: argument for the callback
  188. *
  189. * Creates a neh and adds it to the list of those waiting for an
  190. * event. A context ID will be assigned to the command.
  191. */
  192. struct uwb_rc_neh *uwb_rc_neh_add(struct uwb_rc *rc, struct uwb_rccb *cmd,
  193. u8 expected_type, u16 expected_event,
  194. uwb_rc_cmd_cb_f cb, void *arg)
  195. {
  196. int result;
  197. unsigned long flags;
  198. struct device *dev = &rc->uwb_dev.dev;
  199. struct uwb_rc_neh *neh;
  200. neh = kzalloc(sizeof(*neh), GFP_KERNEL);
  201. if (neh == NULL) {
  202. result = -ENOMEM;
  203. goto error_kzalloc;
  204. }
  205. kref_init(&neh->kref);
  206. INIT_LIST_HEAD(&neh->list_node);
  207. init_timer(&neh->timer);
  208. neh->timer.function = uwb_rc_neh_timer;
  209. neh->timer.data = (unsigned long)neh;
  210. neh->rc = rc;
  211. neh->evt_type = expected_type;
  212. neh->evt = cpu_to_le16(expected_event);
  213. neh->cb = cb;
  214. neh->arg = arg;
  215. spin_lock_irqsave(&rc->neh_lock, flags);
  216. result = __uwb_rc_ctx_get(rc, neh);
  217. if (result >= 0) {
  218. cmd->bCommandContext = neh->context;
  219. list_add_tail(&neh->list_node, &rc->neh_list);
  220. uwb_rc_neh_get(neh);
  221. }
  222. spin_unlock_irqrestore(&rc->neh_lock, flags);
  223. if (result < 0)
  224. goto error_ctx_get;
  225. return neh;
  226. error_ctx_get:
  227. kfree(neh);
  228. error_kzalloc:
  229. dev_err(dev, "cannot open handle to radio controller: %d\n", result);
  230. return ERR_PTR(result);
  231. }
  232. static void __uwb_rc_neh_rm(struct uwb_rc *rc, struct uwb_rc_neh *neh)
  233. {
  234. __uwb_rc_ctx_put(rc, neh);
  235. list_del(&neh->list_node);
  236. }
  237. /**
  238. * uwb_rc_neh_rm - remove a neh.
  239. * @rc: the radio controller
  240. * @neh: the neh to remove
  241. *
  242. * Remove an active neh immediately instead of waiting for the event
  243. * (or a time out).
  244. */
  245. void uwb_rc_neh_rm(struct uwb_rc *rc, struct uwb_rc_neh *neh)
  246. {
  247. unsigned long flags;
  248. spin_lock_irqsave(&rc->neh_lock, flags);
  249. __uwb_rc_neh_rm(rc, neh);
  250. spin_unlock_irqrestore(&rc->neh_lock, flags);
  251. del_timer_sync(&neh->timer);
  252. uwb_rc_neh_put(neh);
  253. }
  254. /**
  255. * uwb_rc_neh_arm - arm an event handler timeout timer
  256. *
  257. * @rc: UWB Radio Controller
  258. * @neh: Notification/event handler for @rc
  259. *
  260. * The timer is only armed if the neh is active.
  261. */
  262. void uwb_rc_neh_arm(struct uwb_rc *rc, struct uwb_rc_neh *neh)
  263. {
  264. unsigned long flags;
  265. spin_lock_irqsave(&rc->neh_lock, flags);
  266. if (neh->context)
  267. mod_timer(&neh->timer,
  268. jiffies + msecs_to_jiffies(UWB_RC_CMD_TIMEOUT_MS));
  269. spin_unlock_irqrestore(&rc->neh_lock, flags);
  270. }
  271. static void uwb_rc_neh_cb(struct uwb_rc_neh *neh, struct uwb_rceb *rceb, size_t size)
  272. {
  273. (*neh->cb)(neh->rc, neh->arg, rceb, size);
  274. uwb_rc_neh_put(neh);
  275. }
  276. static bool uwb_rc_neh_match(struct uwb_rc_neh *neh, const struct uwb_rceb *rceb)
  277. {
  278. return neh->evt_type == rceb->bEventType
  279. && neh->evt == rceb->wEvent
  280. && neh->context == rceb->bEventContext;
  281. }
  282. /**
  283. * Find the handle waiting for a RC Radio Control Event
  284. *
  285. * @rc: UWB Radio Controller
  286. * @rceb: Pointer to the RCEB buffer
  287. * @event_size: Pointer to the size of the RCEB buffer. Might be
  288. * adjusted to take into account the @neh->extra_size
  289. * settings.
  290. *
  291. * If the listener has no buffer (NULL buffer), one is allocated for
  292. * the right size (the amount of data received). @neh->ptr will point
  293. * to the event payload, which always starts with a 'struct
  294. * uwb_rceb'. kfree() it when done.
  295. */
  296. static
  297. struct uwb_rc_neh *uwb_rc_neh_lookup(struct uwb_rc *rc,
  298. const struct uwb_rceb *rceb)
  299. {
  300. struct uwb_rc_neh *neh = NULL, *h;
  301. unsigned long flags;
  302. spin_lock_irqsave(&rc->neh_lock, flags);
  303. list_for_each_entry(h, &rc->neh_list, list_node) {
  304. if (uwb_rc_neh_match(h, rceb)) {
  305. neh = h;
  306. break;
  307. }
  308. }
  309. if (neh)
  310. __uwb_rc_neh_rm(rc, neh);
  311. spin_unlock_irqrestore(&rc->neh_lock, flags);
  312. return neh;
  313. }
  314. /*
  315. * Process notifications coming from the radio control interface
  316. *
  317. * @rc: UWB Radio Control Interface descriptor
  318. * @neh: Notification/Event Handler @neh->ptr points to
  319. * @uwb_evt->buffer.
  320. *
  321. * This function is called by the event/notif handling subsystem when
  322. * notifications arrive (hwarc_probe() arms a notification/event handle
  323. * that calls back this function for every received notification; this
  324. * function then will rearm itself).
  325. *
  326. * Notification data buffers are dynamically allocated by the NEH
  327. * handling code in neh.c [uwb_rc_neh_lookup()]. What is actually
  328. * allocated is space to contain the notification data.
  329. *
  330. * Buffers are prefixed with a Radio Control Event Block (RCEB) as
  331. * defined by the WUSB Wired-Adapter Radio Control interface. We
  332. * just use it for the notification code.
  333. *
  334. * On each case statement we just transcode endianess of the different
  335. * fields. We declare a pointer to a RCI definition of an event, and
  336. * then to a UWB definition of the same event (which are the same,
  337. * remember). Event if we use different pointers
  338. */
  339. static
  340. void uwb_rc_notif(struct uwb_rc *rc, struct uwb_rceb *rceb, ssize_t size)
  341. {
  342. struct device *dev = &rc->uwb_dev.dev;
  343. struct uwb_event *uwb_evt;
  344. if (size == -ESHUTDOWN)
  345. return;
  346. if (size < 0) {
  347. dev_err(dev, "ignoring event with error code %zu\n",
  348. size);
  349. return;
  350. }
  351. uwb_evt = kzalloc(sizeof(*uwb_evt), GFP_ATOMIC);
  352. if (unlikely(uwb_evt == NULL)) {
  353. dev_err(dev, "no memory to queue event 0x%02x/%04x/%02x\n",
  354. rceb->bEventType, le16_to_cpu(rceb->wEvent),
  355. rceb->bEventContext);
  356. return;
  357. }
  358. uwb_evt->rc = __uwb_rc_get(rc); /* will be put by uwbd's uwbd_event_handle() */
  359. uwb_evt->ts_jiffies = jiffies;
  360. uwb_evt->type = UWB_EVT_TYPE_NOTIF;
  361. uwb_evt->notif.size = size;
  362. uwb_evt->notif.rceb = rceb;
  363. uwbd_event_queue(uwb_evt);
  364. }
  365. static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size_t size)
  366. {
  367. struct device *dev = &rc->uwb_dev.dev;
  368. struct uwb_rc_neh *neh;
  369. struct uwb_rceb *notif;
  370. if (rceb->bEventContext == 0) {
  371. notif = kmalloc(size, GFP_ATOMIC);
  372. if (notif) {
  373. memcpy(notif, rceb, size);
  374. uwb_rc_notif(rc, notif, size);
  375. } else
  376. dev_err(dev, "event 0x%02x/%04x/%02x (%zu bytes): no memory\n",
  377. rceb->bEventType, le16_to_cpu(rceb->wEvent),
  378. rceb->bEventContext, size);
  379. } else {
  380. neh = uwb_rc_neh_lookup(rc, rceb);
  381. if (neh) {
  382. del_timer_sync(&neh->timer);
  383. uwb_rc_neh_cb(neh, rceb, size);
  384. } else
  385. dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n",
  386. rceb->bEventType, le16_to_cpu(rceb->wEvent),
  387. rceb->bEventContext, size);
  388. }
  389. }
  390. /**
  391. * Given a buffer with one or more UWB RC events/notifications, break
  392. * them up and dispatch them.
  393. *
  394. * @rc: UWB Radio Controller
  395. * @buf: Buffer with the stream of notifications/events
  396. * @buf_size: Amount of data in the buffer
  397. *
  398. * Note each notification/event starts always with a 'struct
  399. * uwb_rceb', so the minimum size if 4 bytes.
  400. *
  401. * The device may pass us events formatted differently than expected.
  402. * These are first filtered, potentially creating a new event in a new
  403. * memory location. If a new event is created by the filter it is also
  404. * freed here.
  405. *
  406. * For each notif/event, tries to guess the size looking at the EST
  407. * tables, then looks for a neh that is waiting for that event and if
  408. * found, copies the payload to the neh's buffer and calls it back. If
  409. * not, the data is ignored.
  410. *
  411. * Note that if we can't find a size description in the EST tables, we
  412. * still might find a size in the 'neh' handle in uwb_rc_neh_lookup().
  413. *
  414. * Assumptions:
  415. *
  416. * @rc->neh_lock is NOT taken
  417. *
  418. * We keep track of various sizes here:
  419. * size: contains the size of the buffer that is processed for the
  420. * incoming event. this buffer may contain events that are not
  421. * formatted as WHCI.
  422. * real_size: the actual space taken by this event in the buffer.
  423. * We need to keep track of the real size of an event to be able to
  424. * advance the buffer correctly.
  425. * event_size: the size of the event as expected by the core layer
  426. * [OR] the size of the event after filtering. if the filtering
  427. * created a new event in a new memory location then this is
  428. * effectively the size of a new event buffer
  429. */
  430. void uwb_rc_neh_grok(struct uwb_rc *rc, void *buf, size_t buf_size)
  431. {
  432. struct device *dev = &rc->uwb_dev.dev;
  433. void *itr;
  434. struct uwb_rceb *rceb;
  435. size_t size, real_size, event_size;
  436. int needtofree;
  437. itr = buf;
  438. size = buf_size;
  439. while (size > 0) {
  440. if (size < sizeof(*rceb)) {
  441. dev_err(dev, "not enough data in event buffer to "
  442. "process incoming events (%zu left, minimum is "
  443. "%zu)\n", size, sizeof(*rceb));
  444. break;
  445. }
  446. rceb = itr;
  447. if (rc->filter_event) {
  448. needtofree = rc->filter_event(rc, &rceb, size,
  449. &real_size, &event_size);
  450. if (needtofree < 0 && needtofree != -ENOANO) {
  451. dev_err(dev, "BUG: Unable to filter event "
  452. "(0x%02x/%04x/%02x) from "
  453. "device. \n", rceb->bEventType,
  454. le16_to_cpu(rceb->wEvent),
  455. rceb->bEventContext);
  456. break;
  457. }
  458. } else
  459. needtofree = -ENOANO;
  460. /* do real processing if there was no filtering or the
  461. * filtering didn't act */
  462. if (needtofree == -ENOANO) {
  463. ssize_t ret = uwb_est_find_size(rc, rceb, size);
  464. if (ret < 0)
  465. break;
  466. if (ret > size) {
  467. dev_err(dev, "BUG: hw sent incomplete event "
  468. "0x%02x/%04x/%02x (%zd bytes), only got "
  469. "%zu bytes. We don't handle that.\n",
  470. rceb->bEventType, le16_to_cpu(rceb->wEvent),
  471. rceb->bEventContext, ret, size);
  472. break;
  473. }
  474. real_size = event_size = ret;
  475. }
  476. uwb_rc_neh_grok_event(rc, rceb, event_size);
  477. if (needtofree == 1)
  478. kfree(rceb);
  479. itr += real_size;
  480. size -= real_size;
  481. }
  482. }
  483. EXPORT_SYMBOL_GPL(uwb_rc_neh_grok);
  484. /**
  485. * The entity that reads from the device notification/event channel has
  486. * detected an error.
  487. *
  488. * @rc: UWB Radio Controller
  489. * @error: Errno error code
  490. *
  491. */
  492. void uwb_rc_neh_error(struct uwb_rc *rc, int error)
  493. {
  494. struct uwb_rc_neh *neh;
  495. unsigned long flags;
  496. for (;;) {
  497. spin_lock_irqsave(&rc->neh_lock, flags);
  498. if (list_empty(&rc->neh_list)) {
  499. spin_unlock_irqrestore(&rc->neh_lock, flags);
  500. break;
  501. }
  502. neh = list_first_entry(&rc->neh_list, struct uwb_rc_neh, list_node);
  503. __uwb_rc_neh_rm(rc, neh);
  504. spin_unlock_irqrestore(&rc->neh_lock, flags);
  505. del_timer_sync(&neh->timer);
  506. uwb_rc_neh_cb(neh, NULL, error);
  507. }
  508. }
  509. EXPORT_SYMBOL_GPL(uwb_rc_neh_error);
  510. static void uwb_rc_neh_timer(unsigned long arg)
  511. {
  512. struct uwb_rc_neh *neh = (struct uwb_rc_neh *)arg;
  513. struct uwb_rc *rc = neh->rc;
  514. unsigned long flags;
  515. spin_lock_irqsave(&rc->neh_lock, flags);
  516. if (neh->context)
  517. __uwb_rc_neh_rm(rc, neh);
  518. else
  519. neh = NULL;
  520. spin_unlock_irqrestore(&rc->neh_lock, flags);
  521. if (neh)
  522. uwb_rc_neh_cb(neh, NULL, -ETIMEDOUT);
  523. }
  524. /** Initializes the @rc's neh subsystem
  525. */
  526. void uwb_rc_neh_create(struct uwb_rc *rc)
  527. {
  528. spin_lock_init(&rc->neh_lock);
  529. INIT_LIST_HEAD(&rc->neh_list);
  530. set_bit(0, rc->ctx_bm); /* 0 is reserved (see [WUSB] table 8-65) */
  531. set_bit(0xff, rc->ctx_bm); /* and 0xff is invalid */
  532. rc->ctx_roll = 1;
  533. }
  534. /** Release's the @rc's neh subsystem */
  535. void uwb_rc_neh_destroy(struct uwb_rc *rc)
  536. {
  537. unsigned long flags;
  538. struct uwb_rc_neh *neh;
  539. for (;;) {
  540. spin_lock_irqsave(&rc->neh_lock, flags);
  541. if (list_empty(&rc->neh_list)) {
  542. spin_unlock_irqrestore(&rc->neh_lock, flags);
  543. break;
  544. }
  545. neh = list_first_entry(&rc->neh_list, struct uwb_rc_neh, list_node);
  546. __uwb_rc_neh_rm(rc, neh);
  547. spin_unlock_irqrestore(&rc->neh_lock, flags);
  548. del_timer_sync(&neh->timer);
  549. uwb_rc_neh_put(neh);
  550. }
  551. }