interrupt.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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 handlers
  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. cl_err(dev, cl, "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. cl_dbg(dev, cl, "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. cl_err(dev, cl, "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. cl_dbg(dev, cl, "completed read length = %lu\n",
  130. cb->buf_idx);
  131. list_add_tail(&cb->list, &complete_list->list);
  132. }
  133. break;
  134. }
  135. dev_dbg(&dev->pdev->dev, "message read\n");
  136. if (!buffer) {
  137. mei_read_slots(dev, dev->rd_msg_buf, mei_hdr->length);
  138. dev_dbg(&dev->pdev->dev, "discarding message " MEI_HDR_FMT "\n",
  139. MEI_HDR_PRM(mei_hdr));
  140. }
  141. return 0;
  142. }
  143. /**
  144. * mei_cl_irq_disconnect_rsp - send disconnection response message
  145. *
  146. * @cl: client
  147. * @cb: callback block.
  148. * @slots: free slots.
  149. * @cmpl_list: complete list.
  150. *
  151. * returns 0, OK; otherwise, error.
  152. */
  153. static int mei_cl_irq_disconnect_rsp(struct mei_cl *cl, struct mei_cl_cb *cb,
  154. s32 *slots, struct mei_cl_cb *cmpl_list)
  155. {
  156. struct mei_device *dev = cl->dev;
  157. int ret;
  158. u32 msg_slots =
  159. mei_data2slots(sizeof(struct hbm_client_connect_response));
  160. if (*slots < msg_slots)
  161. return -EMSGSIZE;
  162. *slots -= msg_slots;
  163. ret = mei_hbm_cl_disconnect_rsp(dev, cl);
  164. cl->state = MEI_FILE_DISCONNECTED;
  165. cl->status = 0;
  166. mei_io_cb_free(cb);
  167. return ret;
  168. }
  169. /**
  170. * mei_cl_irq_close - processes close related operation from
  171. * interrupt thread context - send disconnect request
  172. *
  173. * @cl: client
  174. * @cb: callback block.
  175. * @slots: free slots.
  176. * @cmpl_list: complete list.
  177. *
  178. * returns 0, OK; otherwise, error.
  179. */
  180. static int mei_cl_irq_close(struct mei_cl *cl, struct mei_cl_cb *cb,
  181. s32 *slots, struct mei_cl_cb *cmpl_list)
  182. {
  183. struct mei_device *dev = cl->dev;
  184. u32 msg_slots =
  185. mei_data2slots(sizeof(struct hbm_client_connect_request));
  186. if (*slots < msg_slots)
  187. return -EMSGSIZE;
  188. *slots -= msg_slots;
  189. if (mei_hbm_cl_disconnect_req(dev, cl)) {
  190. cl->status = 0;
  191. cb->buf_idx = 0;
  192. list_move_tail(&cb->list, &cmpl_list->list);
  193. return -EIO;
  194. }
  195. cl->state = MEI_FILE_DISCONNECTING;
  196. cl->status = 0;
  197. cb->buf_idx = 0;
  198. list_move_tail(&cb->list, &dev->ctrl_rd_list.list);
  199. cl->timer_count = MEI_CONNECT_TIMEOUT;
  200. return 0;
  201. }
  202. /**
  203. * mei_cl_irq_close - processes client read related operation from the
  204. * interrupt thread context - request for flow control credits
  205. *
  206. * @cl: client
  207. * @cb: callback block.
  208. * @slots: free slots.
  209. * @cmpl_list: complete list.
  210. *
  211. * returns 0, OK; otherwise, error.
  212. */
  213. static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb,
  214. s32 *slots, struct mei_cl_cb *cmpl_list)
  215. {
  216. struct mei_device *dev = cl->dev;
  217. u32 msg_slots = mei_data2slots(sizeof(struct hbm_flow_control));
  218. int ret;
  219. if (*slots < msg_slots) {
  220. /* return the cancel routine */
  221. list_del(&cb->list);
  222. return -EMSGSIZE;
  223. }
  224. *slots -= msg_slots;
  225. ret = mei_hbm_cl_flow_control_req(dev, cl);
  226. if (ret) {
  227. cl->status = ret;
  228. cb->buf_idx = 0;
  229. list_move_tail(&cb->list, &cmpl_list->list);
  230. return ret;
  231. }
  232. list_move_tail(&cb->list, &dev->read_list.list);
  233. return 0;
  234. }
  235. /**
  236. * mei_cl_irq_connect - send connect request in irq_thread context
  237. *
  238. * @cl: client
  239. * @cb: callback block.
  240. * @slots: free slots.
  241. * @cmpl_list: complete list.
  242. *
  243. * returns 0, OK; otherwise, error.
  244. */
  245. static int mei_cl_irq_connect(struct mei_cl *cl, struct mei_cl_cb *cb,
  246. s32 *slots, struct mei_cl_cb *cmpl_list)
  247. {
  248. struct mei_device *dev = cl->dev;
  249. int ret;
  250. u32 msg_slots =
  251. mei_data2slots(sizeof(struct hbm_client_connect_request));
  252. if (mei_cl_is_other_connecting(cl))
  253. return 0;
  254. if (*slots < msg_slots) {
  255. /* return the cancel routine */
  256. list_del(&cb->list);
  257. return -EMSGSIZE;
  258. }
  259. *slots -= msg_slots;
  260. cl->state = MEI_FILE_CONNECTING;
  261. ret = mei_hbm_cl_connect_req(dev, cl);
  262. if (ret) {
  263. cl->status = ret;
  264. cb->buf_idx = 0;
  265. list_del(&cb->list);
  266. return ret;
  267. }
  268. list_move_tail(&cb->list, &dev->ctrl_rd_list.list);
  269. cl->timer_count = MEI_CONNECT_TIMEOUT;
  270. return 0;
  271. }
  272. /**
  273. * mei_irq_read_handler - bottom half read routine after ISR to
  274. * handle the read processing.
  275. *
  276. * @dev: the device structure
  277. * @cmpl_list: An instance of our list structure
  278. * @slots: slots to read.
  279. *
  280. * returns 0 on success, <0 on failure.
  281. */
  282. int mei_irq_read_handler(struct mei_device *dev,
  283. struct mei_cl_cb *cmpl_list, s32 *slots)
  284. {
  285. struct mei_msg_hdr *mei_hdr;
  286. struct mei_cl *cl;
  287. int ret;
  288. if (!dev->rd_msg_hdr) {
  289. dev->rd_msg_hdr = mei_read_hdr(dev);
  290. (*slots)--;
  291. dev_dbg(&dev->pdev->dev, "slots =%08x.\n", *slots);
  292. }
  293. mei_hdr = (struct mei_msg_hdr *) &dev->rd_msg_hdr;
  294. dev_dbg(&dev->pdev->dev, MEI_HDR_FMT, MEI_HDR_PRM(mei_hdr));
  295. if (mei_hdr->reserved || !dev->rd_msg_hdr) {
  296. dev_err(&dev->pdev->dev, "corrupted message header 0x%08X\n",
  297. dev->rd_msg_hdr);
  298. ret = -EBADMSG;
  299. goto end;
  300. }
  301. if (mei_slots2data(*slots) < mei_hdr->length) {
  302. dev_err(&dev->pdev->dev, "less data available than length=%08x.\n",
  303. *slots);
  304. /* we can't read the message */
  305. ret = -ERANGE;
  306. goto end;
  307. }
  308. /* HBM message */
  309. if (mei_hdr->host_addr == 0 && mei_hdr->me_addr == 0) {
  310. ret = mei_hbm_dispatch(dev, mei_hdr);
  311. if (ret) {
  312. dev_dbg(&dev->pdev->dev, "mei_hbm_dispatch failed ret = %d\n",
  313. ret);
  314. goto end;
  315. }
  316. goto reset_slots;
  317. }
  318. /* find recipient cl */
  319. list_for_each_entry(cl, &dev->file_list, link) {
  320. if (mei_cl_hbm_equal(cl, mei_hdr)) {
  321. cl_dbg(dev, cl, "got a message\n");
  322. break;
  323. }
  324. }
  325. /* if no recipient cl was found we assume corrupted header */
  326. if (&cl->link == &dev->file_list) {
  327. dev_err(&dev->pdev->dev, "no destination client found 0x%08X\n",
  328. dev->rd_msg_hdr);
  329. ret = -EBADMSG;
  330. goto end;
  331. }
  332. if (mei_hdr->host_addr == dev->iamthif_cl.host_client_id &&
  333. MEI_FILE_CONNECTED == dev->iamthif_cl.state &&
  334. dev->iamthif_state == MEI_IAMTHIF_READING) {
  335. ret = mei_amthif_irq_read_msg(dev, mei_hdr, cmpl_list);
  336. if (ret) {
  337. dev_err(&dev->pdev->dev, "mei_amthif_irq_read_msg failed = %d\n",
  338. ret);
  339. goto end;
  340. }
  341. } else {
  342. ret = mei_cl_irq_read_msg(dev, mei_hdr, cmpl_list);
  343. if (ret) {
  344. dev_err(&dev->pdev->dev, "mei_cl_irq_read_msg failed = %d\n",
  345. ret);
  346. goto end;
  347. }
  348. }
  349. reset_slots:
  350. /* reset the number of slots and header */
  351. *slots = mei_count_full_read_slots(dev);
  352. dev->rd_msg_hdr = 0;
  353. if (*slots == -EOVERFLOW) {
  354. /* overflow - reset */
  355. dev_err(&dev->pdev->dev, "resetting due to slots overflow.\n");
  356. /* set the event since message has been read */
  357. ret = -ERANGE;
  358. goto end;
  359. }
  360. end:
  361. return ret;
  362. }
  363. EXPORT_SYMBOL_GPL(mei_irq_read_handler);
  364. /**
  365. * mei_irq_write_handler - dispatch write requests
  366. * after irq received
  367. *
  368. * @dev: the device structure
  369. * @cmpl_list: An instance of our list structure
  370. *
  371. * returns 0 on success, <0 on failure.
  372. */
  373. int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
  374. {
  375. struct mei_cl *cl;
  376. struct mei_cl_cb *cb, *next;
  377. struct mei_cl_cb *list;
  378. s32 slots;
  379. int ret;
  380. if (!mei_hbuf_is_ready(dev)) {
  381. dev_dbg(&dev->pdev->dev, "host buffer is not empty.\n");
  382. return 0;
  383. }
  384. slots = mei_hbuf_empty_slots(dev);
  385. if (slots <= 0)
  386. return -EMSGSIZE;
  387. /* complete all waiting for write CB */
  388. dev_dbg(&dev->pdev->dev, "complete all waiting for write cb.\n");
  389. list = &dev->write_waiting_list;
  390. list_for_each_entry_safe(cb, next, &list->list, list) {
  391. cl = cb->cl;
  392. if (cl == NULL)
  393. continue;
  394. cl->status = 0;
  395. list_del(&cb->list);
  396. if (MEI_WRITING == cl->writing_state &&
  397. cb->fop_type == MEI_FOP_WRITE &&
  398. cl != &dev->iamthif_cl) {
  399. cl_dbg(dev, cl, "MEI WRITE COMPLETE\n");
  400. cl->writing_state = MEI_WRITE_COMPLETE;
  401. list_add_tail(&cb->list, &cmpl_list->list);
  402. }
  403. if (cl == &dev->iamthif_cl) {
  404. cl_dbg(dev, cl, "check iamthif flow control.\n");
  405. if (dev->iamthif_flow_control_pending) {
  406. ret = mei_amthif_irq_read(dev, &slots);
  407. if (ret)
  408. return ret;
  409. }
  410. }
  411. }
  412. if (dev->wd_state == MEI_WD_STOPPING) {
  413. dev->wd_state = MEI_WD_IDLE;
  414. wake_up_interruptible(&dev->wait_stop_wd);
  415. }
  416. if (mei_cl_is_connected(&dev->wd_cl)) {
  417. if (dev->wd_pending &&
  418. mei_cl_flow_ctrl_creds(&dev->wd_cl) > 0) {
  419. if (mei_wd_send(dev))
  420. dev_dbg(&dev->pdev->dev, "wd send failed.\n");
  421. else if (mei_cl_flow_ctrl_reduce(&dev->wd_cl))
  422. return -ENODEV;
  423. dev->wd_pending = false;
  424. if (dev->wd_state == MEI_WD_RUNNING)
  425. slots -= mei_data2slots(MEI_WD_START_MSG_SIZE);
  426. else
  427. slots -= mei_data2slots(MEI_WD_STOP_MSG_SIZE);
  428. }
  429. }
  430. /* complete control write list CB */
  431. dev_dbg(&dev->pdev->dev, "complete control write list cb.\n");
  432. list_for_each_entry_safe(cb, next, &dev->ctrl_wr_list.list, list) {
  433. cl = cb->cl;
  434. if (!cl) {
  435. list_del(&cb->list);
  436. return -ENODEV;
  437. }
  438. switch (cb->fop_type) {
  439. case MEI_FOP_CLOSE:
  440. /* send disconnect message */
  441. ret = mei_cl_irq_close(cl, cb, &slots, cmpl_list);
  442. if (ret)
  443. return ret;
  444. break;
  445. case MEI_FOP_READ:
  446. /* send flow control message */
  447. ret = mei_cl_irq_read(cl, cb, &slots, cmpl_list);
  448. if (ret)
  449. return ret;
  450. break;
  451. case MEI_FOP_CONNECT:
  452. /* connect message */
  453. ret = mei_cl_irq_connect(cl, cb, &slots, cmpl_list);
  454. if (ret)
  455. return ret;
  456. break;
  457. case MEI_FOP_DISCONNECT_RSP:
  458. /* send disconnect resp */
  459. ret = mei_cl_irq_disconnect_rsp(cl, cb, &slots, cmpl_list);
  460. if (ret)
  461. return ret;
  462. default:
  463. BUG();
  464. }
  465. }
  466. /* complete write list CB */
  467. dev_dbg(&dev->pdev->dev, "complete write list cb.\n");
  468. list_for_each_entry_safe(cb, next, &dev->write_list.list, list) {
  469. cl = cb->cl;
  470. if (cl == NULL)
  471. continue;
  472. if (cl == &dev->iamthif_cl)
  473. ret = mei_amthif_irq_write_complete(cl, cb,
  474. &slots, cmpl_list);
  475. else
  476. ret = mei_cl_irq_write_complete(cl, cb,
  477. &slots, cmpl_list);
  478. if (ret)
  479. return ret;
  480. }
  481. return 0;
  482. }
  483. EXPORT_SYMBOL_GPL(mei_irq_write_handler);
  484. /**
  485. * mei_timer - timer function.
  486. *
  487. * @work: pointer to the work_struct structure
  488. *
  489. */
  490. void mei_timer(struct work_struct *work)
  491. {
  492. unsigned long timeout;
  493. struct mei_cl *cl;
  494. struct mei_cl_cb *cb_pos = NULL;
  495. struct mei_cl_cb *cb_next = NULL;
  496. struct mei_device *dev = container_of(work,
  497. struct mei_device, timer_work.work);
  498. mutex_lock(&dev->device_lock);
  499. /* Catch interrupt stalls during HBM init handshake */
  500. if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
  501. dev->hbm_state != MEI_HBM_IDLE) {
  502. if (dev->init_clients_timer) {
  503. if (--dev->init_clients_timer == 0) {
  504. dev_err(&dev->pdev->dev, "timer: init clients timeout hbm_state = %d.\n",
  505. dev->hbm_state);
  506. mei_reset(dev);
  507. goto out;
  508. }
  509. }
  510. }
  511. if (dev->dev_state != MEI_DEV_ENABLED)
  512. goto out;
  513. /*** connect/disconnect timeouts ***/
  514. list_for_each_entry(cl, &dev->file_list, link) {
  515. if (cl->timer_count) {
  516. if (--cl->timer_count == 0) {
  517. dev_err(&dev->pdev->dev, "timer: connect/disconnect timeout.\n");
  518. mei_reset(dev);
  519. goto out;
  520. }
  521. }
  522. }
  523. if (!mei_cl_is_connected(&dev->iamthif_cl))
  524. goto out;
  525. if (dev->iamthif_stall_timer) {
  526. if (--dev->iamthif_stall_timer == 0) {
  527. dev_err(&dev->pdev->dev, "timer: amthif hanged.\n");
  528. mei_reset(dev);
  529. dev->iamthif_msg_buf_size = 0;
  530. dev->iamthif_msg_buf_index = 0;
  531. dev->iamthif_canceled = false;
  532. dev->iamthif_ioctl = true;
  533. dev->iamthif_state = MEI_IAMTHIF_IDLE;
  534. dev->iamthif_timer = 0;
  535. mei_io_cb_free(dev->iamthif_current_cb);
  536. dev->iamthif_current_cb = NULL;
  537. dev->iamthif_file_object = NULL;
  538. mei_amthif_run_next_cmd(dev);
  539. }
  540. }
  541. if (dev->iamthif_timer) {
  542. timeout = dev->iamthif_timer +
  543. mei_secs_to_jiffies(MEI_IAMTHIF_READ_TIMER);
  544. dev_dbg(&dev->pdev->dev, "dev->iamthif_timer = %ld\n",
  545. dev->iamthif_timer);
  546. dev_dbg(&dev->pdev->dev, "timeout = %ld\n", timeout);
  547. dev_dbg(&dev->pdev->dev, "jiffies = %ld\n", jiffies);
  548. if (time_after(jiffies, timeout)) {
  549. /*
  550. * User didn't read the AMTHI data on time (15sec)
  551. * freeing AMTHI for other requests
  552. */
  553. dev_dbg(&dev->pdev->dev, "freeing AMTHI for other requests\n");
  554. list_for_each_entry_safe(cb_pos, cb_next,
  555. &dev->amthif_rd_complete_list.list, list) {
  556. cl = cb_pos->file_object->private_data;
  557. /* Finding the AMTHI entry. */
  558. if (cl == &dev->iamthif_cl)
  559. list_del(&cb_pos->list);
  560. }
  561. mei_io_cb_free(dev->iamthif_current_cb);
  562. dev->iamthif_current_cb = NULL;
  563. dev->iamthif_file_object->private_data = NULL;
  564. dev->iamthif_file_object = NULL;
  565. dev->iamthif_timer = 0;
  566. mei_amthif_run_next_cmd(dev);
  567. }
  568. }
  569. out:
  570. if (dev->dev_state != MEI_DEV_DISABLED)
  571. schedule_delayed_work(&dev->timer_work, 2 * HZ);
  572. mutex_unlock(&dev->device_lock);
  573. }