interrupt.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. /*
  2. *
  3. * Intel Management Engine Interface (Intel MEI) Linux driver
  4. * Copyright (c) 2003-2012, Intel Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. */
  16. #include <linux/export.h>
  17. #include <linux/pci.h>
  18. #include <linux/kthread.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/fs.h>
  21. #include <linux/jiffies.h>
  22. #include <linux/mei.h>
  23. #include "mei_dev.h"
  24. #include "hbm.h"
  25. #include "hw-me.h"
  26. #include "client.h"
  27. /**
  28. * mei_irq_compl_handler - dispatch complete handelers
  29. * for the completed callbacks
  30. *
  31. * @dev - mei device
  32. * @compl_list - list of completed cbs
  33. */
  34. void mei_irq_compl_handler(struct mei_device *dev, struct mei_cl_cb *compl_list)
  35. {
  36. struct mei_cl_cb *cb, *next;
  37. struct mei_cl *cl;
  38. list_for_each_entry_safe(cb, next, &compl_list->list, list) {
  39. cl = cb->cl;
  40. list_del(&cb->list);
  41. if (!cl)
  42. continue;
  43. dev_dbg(&dev->pdev->dev, "completing call back.\n");
  44. if (cl == &dev->iamthif_cl)
  45. mei_amthif_complete(dev, cb);
  46. else
  47. mei_cl_complete(cl, cb);
  48. }
  49. }
  50. EXPORT_SYMBOL_GPL(mei_irq_compl_handler);
  51. /**
  52. * mei_cl_hbm_equal - check if hbm is addressed to the client
  53. *
  54. * @cl: host client
  55. * @mei_hdr: header of mei client message
  56. *
  57. * returns true if matches, false otherwise
  58. */
  59. static inline int mei_cl_hbm_equal(struct mei_cl *cl,
  60. struct mei_msg_hdr *mei_hdr)
  61. {
  62. return cl->host_client_id == mei_hdr->host_addr &&
  63. cl->me_client_id == mei_hdr->me_addr;
  64. }
  65. /**
  66. * mei_cl_is_reading - checks if the client
  67. is the one to read this message
  68. *
  69. * @cl: mei client
  70. * @mei_hdr: header of mei message
  71. *
  72. * returns true on match and false otherwise
  73. */
  74. static bool mei_cl_is_reading(struct mei_cl *cl, struct mei_msg_hdr *mei_hdr)
  75. {
  76. return mei_cl_hbm_equal(cl, mei_hdr) &&
  77. cl->state == MEI_FILE_CONNECTED &&
  78. cl->reading_state != MEI_READ_COMPLETE;
  79. }
  80. /**
  81. * mei_irq_read_client_message - process client message
  82. *
  83. * @dev: the device structure
  84. * @mei_hdr: header of mei client message
  85. * @complete_list: An instance of our list structure
  86. *
  87. * returns 0 on success, <0 on failure.
  88. */
  89. static int mei_cl_irq_read_msg(struct mei_device *dev,
  90. struct mei_msg_hdr *mei_hdr,
  91. struct mei_cl_cb *complete_list)
  92. {
  93. struct mei_cl *cl;
  94. struct mei_cl_cb *cb, *next;
  95. unsigned char *buffer = NULL;
  96. list_for_each_entry_safe(cb, next, &dev->read_list.list, list) {
  97. cl = cb->cl;
  98. if (!cl || !mei_cl_is_reading(cl, mei_hdr))
  99. continue;
  100. cl->reading_state = MEI_READING;
  101. if (cb->response_buffer.size == 0 ||
  102. cb->response_buffer.data == NULL) {
  103. dev_err(&dev->pdev->dev, "response buffer is not allocated.\n");
  104. list_del(&cb->list);
  105. return -ENOMEM;
  106. }
  107. if (cb->response_buffer.size < mei_hdr->length + cb->buf_idx) {
  108. dev_dbg(&dev->pdev->dev, "message overflow. size %d len %d idx %ld\n",
  109. cb->response_buffer.size,
  110. mei_hdr->length, cb->buf_idx);
  111. buffer = krealloc(cb->response_buffer.data,
  112. mei_hdr->length + cb->buf_idx,
  113. GFP_KERNEL);
  114. if (!buffer) {
  115. dev_err(&dev->pdev->dev, "allocation failed.\n");
  116. list_del(&cb->list);
  117. return -ENOMEM;
  118. }
  119. cb->response_buffer.data = buffer;
  120. cb->response_buffer.size =
  121. mei_hdr->length + cb->buf_idx;
  122. }
  123. buffer = cb->response_buffer.data + cb->buf_idx;
  124. mei_read_slots(dev, buffer, mei_hdr->length);
  125. cb->buf_idx += mei_hdr->length;
  126. if (mei_hdr->msg_complete) {
  127. cl->status = 0;
  128. list_del(&cb->list);
  129. dev_dbg(&dev->pdev->dev, "completed read H cl = %d, ME cl = %d, length = %lu\n",
  130. cl->host_client_id,
  131. cl->me_client_id,
  132. cb->buf_idx);
  133. list_add_tail(&cb->list, &complete_list->list);
  134. }
  135. break;
  136. }
  137. dev_dbg(&dev->pdev->dev, "message read\n");
  138. if (!buffer) {
  139. mei_read_slots(dev, dev->rd_msg_buf, mei_hdr->length);
  140. dev_dbg(&dev->pdev->dev, "discarding message " MEI_HDR_FMT "\n",
  141. MEI_HDR_PRM(mei_hdr));
  142. }
  143. return 0;
  144. }
  145. /**
  146. * mei_cl_irq_close - processes close related operation from
  147. * interrupt thread context - send disconnect request
  148. *
  149. * @cl: client
  150. * @cb: callback block.
  151. * @slots: free slots.
  152. * @cmpl_list: complete list.
  153. *
  154. * returns 0, OK; otherwise, error.
  155. */
  156. static int mei_cl_irq_close(struct mei_cl *cl, struct mei_cl_cb *cb,
  157. s32 *slots, struct mei_cl_cb *cmpl_list)
  158. {
  159. struct mei_device *dev = cl->dev;
  160. u32 msg_slots =
  161. mei_data2slots(sizeof(struct hbm_client_connect_request));
  162. if (*slots < msg_slots)
  163. return -EMSGSIZE;
  164. *slots -= msg_slots;
  165. if (mei_hbm_cl_disconnect_req(dev, cl)) {
  166. cl->status = 0;
  167. cb->buf_idx = 0;
  168. list_move_tail(&cb->list, &cmpl_list->list);
  169. return -EIO;
  170. }
  171. cl->state = MEI_FILE_DISCONNECTING;
  172. cl->status = 0;
  173. cb->buf_idx = 0;
  174. list_move_tail(&cb->list, &dev->ctrl_rd_list.list);
  175. cl->timer_count = MEI_CONNECT_TIMEOUT;
  176. return 0;
  177. }
  178. /**
  179. * mei_cl_irq_close - processes client read related operation from the
  180. * interrupt thread context - request for flow control credits
  181. *
  182. * @cl: client
  183. * @cb: callback block.
  184. * @slots: free slots.
  185. * @cmpl_list: complete list.
  186. *
  187. * returns 0, OK; otherwise, error.
  188. */
  189. static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb,
  190. s32 *slots, struct mei_cl_cb *cmpl_list)
  191. {
  192. struct mei_device *dev = cl->dev;
  193. u32 msg_slots = mei_data2slots(sizeof(struct hbm_flow_control));
  194. if (*slots < msg_slots) {
  195. /* return the cancel routine */
  196. list_del(&cb->list);
  197. return -EMSGSIZE;
  198. }
  199. *slots -= msg_slots;
  200. if (mei_hbm_cl_flow_control_req(dev, cl)) {
  201. cl->status = -ENODEV;
  202. cb->buf_idx = 0;
  203. list_move_tail(&cb->list, &cmpl_list->list);
  204. return -ENODEV;
  205. }
  206. list_move_tail(&cb->list, &dev->read_list.list);
  207. return 0;
  208. }
  209. /**
  210. * mei_cl_irq_ioctl - processes client ioctl related operation from the
  211. * interrupt thread context - send connection request
  212. *
  213. * @cl: client
  214. * @cb: callback block.
  215. * @slots: free slots.
  216. * @cmpl_list: complete list.
  217. *
  218. * returns 0, OK; otherwise, error.
  219. */
  220. static int mei_cl_irq_ioctl(struct mei_cl *cl, struct mei_cl_cb *cb,
  221. s32 *slots, struct mei_cl_cb *cmpl_list)
  222. {
  223. struct mei_device *dev = cl->dev;
  224. u32 msg_slots =
  225. mei_data2slots(sizeof(struct hbm_client_connect_request));
  226. if (*slots < msg_slots) {
  227. /* return the cancel routine */
  228. list_del(&cb->list);
  229. return -EMSGSIZE;
  230. }
  231. *slots -= msg_slots;
  232. cl->state = MEI_FILE_CONNECTING;
  233. if (mei_hbm_cl_connect_req(dev, cl)) {
  234. cl->status = -ENODEV;
  235. cb->buf_idx = 0;
  236. list_del(&cb->list);
  237. return -ENODEV;
  238. }
  239. list_move_tail(&cb->list, &dev->ctrl_rd_list.list);
  240. cl->timer_count = MEI_CONNECT_TIMEOUT;
  241. return 0;
  242. }
  243. /**
  244. * mei_irq_read_handler - bottom half read routine after ISR to
  245. * handle the read processing.
  246. *
  247. * @dev: the device structure
  248. * @cmpl_list: An instance of our list structure
  249. * @slots: slots to read.
  250. *
  251. * returns 0 on success, <0 on failure.
  252. */
  253. int mei_irq_read_handler(struct mei_device *dev,
  254. struct mei_cl_cb *cmpl_list, s32 *slots)
  255. {
  256. struct mei_msg_hdr *mei_hdr;
  257. struct mei_cl *cl_pos = NULL;
  258. struct mei_cl *cl_next = NULL;
  259. int ret = 0;
  260. if (!dev->rd_msg_hdr) {
  261. dev->rd_msg_hdr = mei_read_hdr(dev);
  262. dev_dbg(&dev->pdev->dev, "slots =%08x.\n", *slots);
  263. (*slots)--;
  264. dev_dbg(&dev->pdev->dev, "slots =%08x.\n", *slots);
  265. }
  266. mei_hdr = (struct mei_msg_hdr *) &dev->rd_msg_hdr;
  267. dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(mei_hdr));
  268. if (mei_hdr->reserved || !dev->rd_msg_hdr) {
  269. dev_dbg(&dev->pdev->dev, "corrupted message header.\n");
  270. ret = -EBADMSG;
  271. goto end;
  272. }
  273. if (mei_hdr->host_addr || mei_hdr->me_addr) {
  274. list_for_each_entry_safe(cl_pos, cl_next,
  275. &dev->file_list, link) {
  276. dev_dbg(&dev->pdev->dev,
  277. "list_for_each_entry_safe read host"
  278. " client = %d, ME client = %d\n",
  279. cl_pos->host_client_id,
  280. cl_pos->me_client_id);
  281. if (mei_cl_hbm_equal(cl_pos, mei_hdr))
  282. break;
  283. }
  284. if (&cl_pos->link == &dev->file_list) {
  285. dev_dbg(&dev->pdev->dev, "corrupted message header\n");
  286. ret = -EBADMSG;
  287. goto end;
  288. }
  289. }
  290. if (((*slots) * sizeof(u32)) < mei_hdr->length) {
  291. dev_err(&dev->pdev->dev,
  292. "we can't read the message slots =%08x.\n",
  293. *slots);
  294. /* we can't read the message */
  295. ret = -ERANGE;
  296. goto end;
  297. }
  298. /* decide where to read the message too */
  299. if (!mei_hdr->host_addr) {
  300. dev_dbg(&dev->pdev->dev, "call mei_irq_thread_read_bus_message.\n");
  301. mei_hbm_dispatch(dev, mei_hdr);
  302. dev_dbg(&dev->pdev->dev, "end mei_irq_thread_read_bus_message.\n");
  303. } else if (mei_hdr->host_addr == dev->iamthif_cl.host_client_id &&
  304. (MEI_FILE_CONNECTED == dev->iamthif_cl.state) &&
  305. (dev->iamthif_state == MEI_IAMTHIF_READING)) {
  306. dev_dbg(&dev->pdev->dev, "call mei_irq_thread_read_iamthif_message.\n");
  307. dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(mei_hdr));
  308. ret = mei_amthif_irq_read_msg(dev, mei_hdr, cmpl_list);
  309. if (ret)
  310. goto end;
  311. } else {
  312. dev_dbg(&dev->pdev->dev, "call mei_cl_irq_read_msg.\n");
  313. dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(mei_hdr));
  314. ret = mei_cl_irq_read_msg(dev, mei_hdr, cmpl_list);
  315. if (ret)
  316. goto end;
  317. }
  318. /* reset the number of slots and header */
  319. *slots = mei_count_full_read_slots(dev);
  320. dev->rd_msg_hdr = 0;
  321. if (*slots == -EOVERFLOW) {
  322. /* overflow - reset */
  323. dev_err(&dev->pdev->dev, "resetting due to slots overflow.\n");
  324. /* set the event since message has been read */
  325. ret = -ERANGE;
  326. goto end;
  327. }
  328. end:
  329. return ret;
  330. }
  331. EXPORT_SYMBOL_GPL(mei_irq_read_handler);
  332. /**
  333. * mei_irq_write_handler - dispatch write requests
  334. * after irq received
  335. *
  336. * @dev: the device structure
  337. * @cmpl_list: An instance of our list structure
  338. *
  339. * returns 0 on success, <0 on failure.
  340. */
  341. int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
  342. {
  343. struct mei_cl *cl;
  344. struct mei_cl_cb *cb, *next;
  345. struct mei_cl_cb *list;
  346. s32 slots;
  347. int ret;
  348. if (!mei_hbuf_is_ready(dev)) {
  349. dev_dbg(&dev->pdev->dev, "host buffer is not empty.\n");
  350. return 0;
  351. }
  352. slots = mei_hbuf_empty_slots(dev);
  353. if (slots <= 0)
  354. return -EMSGSIZE;
  355. /* complete all waiting for write CB */
  356. dev_dbg(&dev->pdev->dev, "complete all waiting for write cb.\n");
  357. list = &dev->write_waiting_list;
  358. list_for_each_entry_safe(cb, next, &list->list, list) {
  359. cl = cb->cl;
  360. if (cl == NULL)
  361. continue;
  362. cl->status = 0;
  363. list_del(&cb->list);
  364. if (MEI_WRITING == cl->writing_state &&
  365. cb->fop_type == MEI_FOP_WRITE &&
  366. cl != &dev->iamthif_cl) {
  367. dev_dbg(&dev->pdev->dev, "MEI WRITE COMPLETE\n");
  368. cl->writing_state = MEI_WRITE_COMPLETE;
  369. list_add_tail(&cb->list, &cmpl_list->list);
  370. }
  371. if (cl == &dev->iamthif_cl) {
  372. dev_dbg(&dev->pdev->dev, "check iamthif flow control.\n");
  373. if (dev->iamthif_flow_control_pending) {
  374. ret = mei_amthif_irq_read(dev, &slots);
  375. if (ret)
  376. return ret;
  377. }
  378. }
  379. }
  380. if (dev->wd_state == MEI_WD_STOPPING) {
  381. dev->wd_state = MEI_WD_IDLE;
  382. wake_up_interruptible(&dev->wait_stop_wd);
  383. }
  384. if (dev->wr_ext_msg.hdr.length) {
  385. mei_write_message(dev, &dev->wr_ext_msg.hdr,
  386. dev->wr_ext_msg.data);
  387. slots -= mei_data2slots(dev->wr_ext_msg.hdr.length);
  388. dev->wr_ext_msg.hdr.length = 0;
  389. }
  390. if (dev->dev_state == MEI_DEV_ENABLED) {
  391. if (dev->wd_pending &&
  392. mei_cl_flow_ctrl_creds(&dev->wd_cl) > 0) {
  393. if (mei_wd_send(dev))
  394. dev_dbg(&dev->pdev->dev, "wd send failed.\n");
  395. else if (mei_cl_flow_ctrl_reduce(&dev->wd_cl))
  396. return -ENODEV;
  397. dev->wd_pending = false;
  398. if (dev->wd_state == MEI_WD_RUNNING)
  399. slots -= mei_data2slots(MEI_WD_START_MSG_SIZE);
  400. else
  401. slots -= mei_data2slots(MEI_WD_STOP_MSG_SIZE);
  402. }
  403. }
  404. /* complete control write list CB */
  405. dev_dbg(&dev->pdev->dev, "complete control write list cb.\n");
  406. list_for_each_entry_safe(cb, next, &dev->ctrl_wr_list.list, list) {
  407. cl = cb->cl;
  408. if (!cl) {
  409. list_del(&cb->list);
  410. return -ENODEV;
  411. }
  412. switch (cb->fop_type) {
  413. case MEI_FOP_CLOSE:
  414. /* send disconnect message */
  415. ret = mei_cl_irq_close(cl, cb, &slots, cmpl_list);
  416. if (ret)
  417. return ret;
  418. break;
  419. case MEI_FOP_READ:
  420. /* send flow control message */
  421. ret = mei_cl_irq_read(cl, cb, &slots, cmpl_list);
  422. if (ret)
  423. return ret;
  424. break;
  425. case MEI_FOP_IOCTL:
  426. /* connect message */
  427. if (mei_cl_is_other_connecting(cl))
  428. continue;
  429. ret = mei_cl_irq_ioctl(cl, cb, &slots, cmpl_list);
  430. if (ret)
  431. return ret;
  432. break;
  433. default:
  434. BUG();
  435. }
  436. }
  437. /* complete write list CB */
  438. dev_dbg(&dev->pdev->dev, "complete write list cb.\n");
  439. list_for_each_entry_safe(cb, next, &dev->write_list.list, list) {
  440. cl = cb->cl;
  441. if (cl == NULL)
  442. continue;
  443. if (mei_cl_flow_ctrl_creds(cl) <= 0) {
  444. dev_dbg(&dev->pdev->dev,
  445. "No flow control credentials for client %d, not sending.\n",
  446. cl->host_client_id);
  447. continue;
  448. }
  449. if (cl == &dev->iamthif_cl)
  450. ret = mei_amthif_irq_write_complete(cl, cb,
  451. &slots, cmpl_list);
  452. else
  453. ret = mei_cl_irq_write_complete(cl, cb,
  454. &slots, cmpl_list);
  455. if (ret)
  456. return ret;
  457. }
  458. return 0;
  459. }
  460. EXPORT_SYMBOL_GPL(mei_irq_write_handler);
  461. /**
  462. * mei_timer - timer function.
  463. *
  464. * @work: pointer to the work_struct structure
  465. *
  466. * NOTE: This function is called by timer interrupt work
  467. */
  468. void mei_timer(struct work_struct *work)
  469. {
  470. unsigned long timeout;
  471. struct mei_cl *cl_pos = NULL;
  472. struct mei_cl *cl_next = NULL;
  473. struct mei_cl_cb *cb_pos = NULL;
  474. struct mei_cl_cb *cb_next = NULL;
  475. struct mei_device *dev = container_of(work,
  476. struct mei_device, timer_work.work);
  477. mutex_lock(&dev->device_lock);
  478. if (dev->dev_state != MEI_DEV_ENABLED) {
  479. if (dev->dev_state == MEI_DEV_INIT_CLIENTS) {
  480. if (dev->init_clients_timer) {
  481. if (--dev->init_clients_timer == 0) {
  482. dev_err(&dev->pdev->dev, "reset: init clients timeout hbm_state = %d.\n",
  483. dev->hbm_state);
  484. mei_reset(dev, 1);
  485. }
  486. }
  487. }
  488. goto out;
  489. }
  490. /*** connect/disconnect timeouts ***/
  491. list_for_each_entry_safe(cl_pos, cl_next, &dev->file_list, link) {
  492. if (cl_pos->timer_count) {
  493. if (--cl_pos->timer_count == 0) {
  494. dev_err(&dev->pdev->dev, "reset: connect/disconnect timeout.\n");
  495. mei_reset(dev, 1);
  496. goto out;
  497. }
  498. }
  499. }
  500. if (dev->iamthif_stall_timer) {
  501. if (--dev->iamthif_stall_timer == 0) {
  502. dev_err(&dev->pdev->dev, "reset: amthif hanged.\n");
  503. mei_reset(dev, 1);
  504. dev->iamthif_msg_buf_size = 0;
  505. dev->iamthif_msg_buf_index = 0;
  506. dev->iamthif_canceled = false;
  507. dev->iamthif_ioctl = true;
  508. dev->iamthif_state = MEI_IAMTHIF_IDLE;
  509. dev->iamthif_timer = 0;
  510. mei_io_cb_free(dev->iamthif_current_cb);
  511. dev->iamthif_current_cb = NULL;
  512. dev->iamthif_file_object = NULL;
  513. mei_amthif_run_next_cmd(dev);
  514. }
  515. }
  516. if (dev->iamthif_timer) {
  517. timeout = dev->iamthif_timer +
  518. mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER);
  519. dev_dbg(&dev->pdev->dev, "dev->iamthif_timer = %ld\n",
  520. dev->iamthif_timer);
  521. dev_dbg(&dev->pdev->dev, "timeout = %ld\n", timeout);
  522. dev_dbg(&dev->pdev->dev, "jiffies = %ld\n", jiffies);
  523. if (time_after(jiffies, timeout)) {
  524. /*
  525. * User didn't read the AMTHI data on time (15sec)
  526. * freeing AMTHI for other requests
  527. */
  528. dev_dbg(&dev->pdev->dev, "freeing AMTHI for other requests\n");
  529. list_for_each_entry_safe(cb_pos, cb_next,
  530. &dev->amthif_rd_complete_list.list, list) {
  531. cl_pos = cb_pos->file_object->private_data;
  532. /* Finding the AMTHI entry. */
  533. if (cl_pos == &dev->iamthif_cl)
  534. list_del(&cb_pos->list);
  535. }
  536. mei_io_cb_free(dev->iamthif_current_cb);
  537. dev->iamthif_current_cb = NULL;
  538. dev->iamthif_file_object->private_data = NULL;
  539. dev->iamthif_file_object = NULL;
  540. dev->iamthif_timer = 0;
  541. mei_amthif_run_next_cmd(dev);
  542. }
  543. }
  544. out:
  545. schedule_delayed_work(&dev->timer_work, 2 * HZ);
  546. mutex_unlock(&dev->device_lock);
  547. }