3 * Intel Management Engine Interface (Intel MEI) Linux driver
4 * Copyright (c) 2003-2012, Intel Corporation.
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.
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
17 #include <linux/pci.h>
18 #include <linux/sched.h>
19 #include <linux/wait.h>
20 #include <linux/delay.h>
21 #include <linux/pm_runtime.h>
23 #include <linux/mei.h>
30 * mei_me_cl_by_uuid - locate index of me client
34 * Locking: called under "dev->device_lock" lock
36 * returns me client index or -ENOENT if not found
38 int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *uuid)
42 for (i = 0; i < dev->me_clients_num; ++i)
43 if (uuid_le_cmp(*uuid,
44 dev->me_clients[i].props.protocol_name) == 0)
52 * mei_me_cl_by_id return index to me_clients for client_id
54 * @dev: the device structure
55 * @client_id: me client id
57 * Locking: called under "dev->device_lock" lock
59 * returns index on success, -ENOENT on failure.
62 int mei_me_cl_by_id(struct mei_device *dev, u8 client_id)
66 for (i = 0; i < dev->me_clients_num; i++)
67 if (dev->me_clients[i].client_id == client_id)
75 * mei_cl_cmp_id - tells if the clients are the same
80 * returns true - if the clients has same host and me ids
83 static inline bool mei_cl_cmp_id(const struct mei_cl *cl1,
84 const struct mei_cl *cl2)
87 (cl1->host_client_id == cl2->host_client_id) &&
88 (cl1->me_client_id == cl2->me_client_id);
92 * mei_io_list_flush - removes cbs belonging to cl.
94 * @list: an instance of our list structure
95 * @cl: host client, can be NULL for flushing the whole list
96 * @free: whether to free the cbs
98 static void __mei_io_list_flush(struct mei_cl_cb *list,
99 struct mei_cl *cl, bool free)
101 struct mei_cl_cb *cb;
102 struct mei_cl_cb *next;
104 /* enable removing everything if no cl is specified */
105 list_for_each_entry_safe(cb, next, &list->list, list) {
106 if (!cl || (cb->cl && mei_cl_cmp_id(cl, cb->cl))) {
115 * mei_io_list_flush - removes list entry belonging to cl.
117 * @list: An instance of our list structure
120 static inline void mei_io_list_flush(struct mei_cl_cb *list, struct mei_cl *cl)
122 __mei_io_list_flush(list, cl, false);
127 * mei_io_list_free - removes cb belonging to cl and free them
129 * @list: An instance of our list structure
132 static inline void mei_io_list_free(struct mei_cl_cb *list, struct mei_cl *cl)
134 __mei_io_list_flush(list, cl, true);
138 * mei_io_cb_free - free mei_cb_private related memory
140 * @cb: mei callback struct
142 void mei_io_cb_free(struct mei_cl_cb *cb)
147 kfree(cb->request_buffer.data);
148 kfree(cb->response_buffer.data);
153 * mei_io_cb_init - allocate and initialize io callback
156 * @fp: pointer to file structure
158 * returns mei_cl_cb pointer or NULL;
160 struct mei_cl_cb *mei_io_cb_init(struct mei_cl *cl, struct file *fp)
162 struct mei_cl_cb *cb;
164 cb = kzalloc(sizeof(struct mei_cl_cb), GFP_KERNEL);
168 mei_io_list_init(cb);
170 cb->file_object = fp;
177 * mei_io_cb_alloc_req_buf - allocate request buffer
179 * @cb: io callback structure
180 * @length: size of the buffer
182 * returns 0 on success
183 * -EINVAL if cb is NULL
184 * -ENOMEM if allocation failed
186 int mei_io_cb_alloc_req_buf(struct mei_cl_cb *cb, size_t length)
194 cb->request_buffer.data = kmalloc(length, GFP_KERNEL);
195 if (!cb->request_buffer.data)
197 cb->request_buffer.size = length;
201 * mei_io_cb_alloc_resp_buf - allocate response buffer
203 * @cb: io callback structure
204 * @length: size of the buffer
206 * returns 0 on success
207 * -EINVAL if cb is NULL
208 * -ENOMEM if allocation failed
210 int mei_io_cb_alloc_resp_buf(struct mei_cl_cb *cb, size_t length)
218 cb->response_buffer.data = kmalloc(length, GFP_KERNEL);
219 if (!cb->response_buffer.data)
221 cb->response_buffer.size = length;
228 * mei_cl_flush_queues - flushes queue lists belonging to cl.
232 int mei_cl_flush_queues(struct mei_cl *cl)
234 struct mei_device *dev;
236 if (WARN_ON(!cl || !cl->dev))
241 cl_dbg(dev, cl, "remove list entry belonging to cl\n");
242 mei_io_list_flush(&cl->dev->read_list, cl);
243 mei_io_list_free(&cl->dev->write_list, cl);
244 mei_io_list_free(&cl->dev->write_waiting_list, cl);
245 mei_io_list_flush(&cl->dev->ctrl_wr_list, cl);
246 mei_io_list_flush(&cl->dev->ctrl_rd_list, cl);
247 mei_io_list_flush(&cl->dev->amthif_cmd_list, cl);
248 mei_io_list_flush(&cl->dev->amthif_rd_complete_list, cl);
254 * mei_cl_init - initializes cl.
256 * @cl: host client to be initialized
259 void mei_cl_init(struct mei_cl *cl, struct mei_device *dev)
261 memset(cl, 0, sizeof(struct mei_cl));
262 init_waitqueue_head(&cl->wait);
263 init_waitqueue_head(&cl->rx_wait);
264 init_waitqueue_head(&cl->tx_wait);
265 INIT_LIST_HEAD(&cl->link);
266 INIT_LIST_HEAD(&cl->device_link);
267 cl->reading_state = MEI_IDLE;
268 cl->writing_state = MEI_IDLE;
273 * mei_cl_allocate - allocates cl structure and sets it up.
276 * returns The allocated file or NULL on failure
278 struct mei_cl *mei_cl_allocate(struct mei_device *dev)
282 cl = kmalloc(sizeof(struct mei_cl), GFP_KERNEL);
286 mei_cl_init(cl, dev);
292 * mei_cl_find_read_cb - find this cl's callback in the read list
296 * returns cb on success, NULL on error
298 struct mei_cl_cb *mei_cl_find_read_cb(struct mei_cl *cl)
300 struct mei_device *dev = cl->dev;
301 struct mei_cl_cb *cb;
303 list_for_each_entry(cb, &dev->read_list.list, list)
304 if (mei_cl_cmp_id(cl, cb->cl))
309 /** mei_cl_link: allocate host id in the host map
312 * @id - fixed host id or -1 for generic one
314 * returns 0 on success
315 * -EINVAL on incorrect values
316 * -ENONET if client not found
318 int mei_cl_link(struct mei_cl *cl, int id)
320 struct mei_device *dev;
321 long open_handle_count;
323 if (WARN_ON(!cl || !cl->dev))
328 /* If Id is not assigned get one*/
329 if (id == MEI_HOST_CLIENT_ID_ANY)
330 id = find_first_zero_bit(dev->host_clients_map,
333 if (id >= MEI_CLIENTS_MAX) {
334 dev_err(&dev->pdev->dev, "id exceeded %d", MEI_CLIENTS_MAX);
338 open_handle_count = dev->open_handle_count + dev->iamthif_open_count;
339 if (open_handle_count >= MEI_MAX_OPEN_HANDLE_COUNT) {
340 dev_err(&dev->pdev->dev, "open_handle_count exceeded %d",
341 MEI_MAX_OPEN_HANDLE_COUNT);
345 dev->open_handle_count++;
347 cl->host_client_id = id;
348 list_add_tail(&cl->link, &dev->file_list);
350 set_bit(id, dev->host_clients_map);
352 cl->state = MEI_FILE_INITIALIZING;
354 cl_dbg(dev, cl, "link cl\n");
359 * mei_cl_unlink - remove me_cl from the list
363 int mei_cl_unlink(struct mei_cl *cl)
365 struct mei_device *dev;
367 /* don't shout on error exit path */
371 /* wd and amthif might not be initialized */
377 cl_dbg(dev, cl, "unlink client");
379 if (dev->open_handle_count > 0)
380 dev->open_handle_count--;
382 /* never clear the 0 bit */
383 if (cl->host_client_id)
384 clear_bit(cl->host_client_id, dev->host_clients_map);
386 list_del_init(&cl->link);
388 cl->state = MEI_FILE_INITIALIZING;
394 void mei_host_client_init(struct work_struct *work)
396 struct mei_device *dev = container_of(work,
397 struct mei_device, init_work);
398 struct mei_client_properties *client_props;
401 mutex_lock(&dev->device_lock);
403 for (i = 0; i < dev->me_clients_num; i++) {
404 client_props = &dev->me_clients[i].props;
406 if (!uuid_le_cmp(client_props->protocol_name, mei_amthif_guid))
407 mei_amthif_host_init(dev);
408 else if (!uuid_le_cmp(client_props->protocol_name, mei_wd_guid))
409 mei_wd_host_init(dev);
410 else if (!uuid_le_cmp(client_props->protocol_name, mei_nfc_guid))
411 mei_nfc_host_init(dev);
415 dev->dev_state = MEI_DEV_ENABLED;
416 dev->reset_count = 0;
418 mutex_unlock(&dev->device_lock);
420 pm_runtime_mark_last_busy(&dev->pdev->dev);
421 dev_dbg(&dev->pdev->dev, "rpm: autosuspend\n");
422 pm_runtime_autosuspend(&dev->pdev->dev);
426 * mei_hbuf_acquire: try to acquire host buffer
428 * @dev: the device structure
429 * returns true if host buffer was acquired
431 bool mei_hbuf_acquire(struct mei_device *dev)
433 if (mei_pg_state(dev) == MEI_PG_ON ||
434 dev->pg_event == MEI_PG_EVENT_WAIT) {
435 dev_dbg(&dev->pdev->dev, "device is in pg\n");
439 if (!dev->hbuf_is_ready) {
440 dev_dbg(&dev->pdev->dev, "hbuf is not ready\n");
444 dev->hbuf_is_ready = false;
450 * mei_cl_disconnect - disconnect host client from the me one
454 * Locking: called under "dev->device_lock" lock
456 * returns 0 on success, <0 on failure.
458 int mei_cl_disconnect(struct mei_cl *cl)
460 struct mei_device *dev;
461 struct mei_cl_cb *cb;
464 if (WARN_ON(!cl || !cl->dev))
469 cl_dbg(dev, cl, "disconnecting");
471 if (cl->state != MEI_FILE_DISCONNECTING)
474 rets = pm_runtime_get(&dev->pdev->dev);
475 if (rets < 0 && rets != -EINPROGRESS) {
476 pm_runtime_put_noidle(&dev->pdev->dev);
477 cl_err(dev, cl, "rpm: get failed %d\n", rets);
481 cb = mei_io_cb_init(cl, NULL);
487 cb->fop_type = MEI_FOP_CLOSE;
488 if (mei_hbuf_acquire(dev)) {
489 if (mei_hbm_cl_disconnect_req(dev, cl)) {
491 cl_err(dev, cl, "failed to disconnect.\n");
494 mdelay(10); /* Wait for hardware disconnection ready */
495 list_add_tail(&cb->list, &dev->ctrl_rd_list.list);
497 cl_dbg(dev, cl, "add disconnect cb to control write list\n");
498 list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
501 mutex_unlock(&dev->device_lock);
503 err = wait_event_timeout(dev->wait_recvd_msg,
504 MEI_FILE_DISCONNECTED == cl->state,
505 mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT));
507 mutex_lock(&dev->device_lock);
508 if (MEI_FILE_DISCONNECTED == cl->state) {
510 cl_dbg(dev, cl, "successfully disconnected from FW client.\n");
513 if (MEI_FILE_DISCONNECTED != cl->state)
514 cl_err(dev, cl, "wrong status client disconnect.\n");
517 cl_dbg(dev, cl, "wait failed disconnect err=%d\n", err);
519 cl_err(dev, cl, "failed to disconnect from FW client.\n");
522 mei_io_list_flush(&dev->ctrl_rd_list, cl);
523 mei_io_list_flush(&dev->ctrl_wr_list, cl);
525 cl_dbg(dev, cl, "rpm: autosuspend\n");
526 pm_runtime_mark_last_busy(&dev->pdev->dev);
527 pm_runtime_put_autosuspend(&dev->pdev->dev);
535 * mei_cl_is_other_connecting - checks if other
536 * client with the same me client id is connecting
538 * @cl: private data of the file object
540 * returns true if other client is connected, false - otherwise.
542 bool mei_cl_is_other_connecting(struct mei_cl *cl)
544 struct mei_device *dev;
545 struct mei_cl *ocl; /* the other client */
547 if (WARN_ON(!cl || !cl->dev))
552 list_for_each_entry(ocl, &dev->file_list, link) {
553 if (ocl->state == MEI_FILE_CONNECTING &&
555 cl->me_client_id == ocl->me_client_id)
564 * mei_cl_connect - connect host client to the me one
568 * Locking: called under "dev->device_lock" lock
570 * returns 0 on success, <0 on failure.
572 int mei_cl_connect(struct mei_cl *cl, struct file *file)
574 struct mei_device *dev;
575 struct mei_cl_cb *cb;
578 if (WARN_ON(!cl || !cl->dev))
583 rets = pm_runtime_get(&dev->pdev->dev);
584 if (rets < 0 && rets != -EINPROGRESS) {
585 pm_runtime_put_noidle(&dev->pdev->dev);
586 cl_err(dev, cl, "rpm: get failed %d\n", rets);
590 cb = mei_io_cb_init(cl, file);
596 cb->fop_type = MEI_FOP_CONNECT;
598 /* run hbuf acquire last so we don't have to undo */
599 if (!mei_cl_is_other_connecting(cl) && mei_hbuf_acquire(dev)) {
600 cl->state = MEI_FILE_CONNECTING;
601 if (mei_hbm_cl_connect_req(dev, cl)) {
605 cl->timer_count = MEI_CONNECT_TIMEOUT;
606 list_add_tail(&cb->list, &dev->ctrl_rd_list.list);
608 list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
611 mutex_unlock(&dev->device_lock);
612 wait_event_timeout(dev->wait_recvd_msg,
613 (cl->state == MEI_FILE_CONNECTED ||
614 cl->state == MEI_FILE_DISCONNECTED),
615 mei_secs_to_jiffies(MEI_CL_CONNECT_TIMEOUT));
616 mutex_lock(&dev->device_lock);
618 if (cl->state != MEI_FILE_CONNECTED) {
619 /* something went really wrong */
621 cl->status = -EFAULT;
623 mei_io_list_flush(&dev->ctrl_rd_list, cl);
624 mei_io_list_flush(&dev->ctrl_wr_list, cl);
630 cl_dbg(dev, cl, "rpm: autosuspend\n");
631 pm_runtime_mark_last_busy(&dev->pdev->dev);
632 pm_runtime_put_autosuspend(&dev->pdev->dev);
639 * mei_cl_flow_ctrl_creds - checks flow_control credits for cl.
641 * @cl: private data of the file object
643 * returns 1 if mei_flow_ctrl_creds >0, 0 - otherwise.
644 * -ENOENT if mei_cl is not present
645 * -EINVAL if single_recv_buf == 0
647 int mei_cl_flow_ctrl_creds(struct mei_cl *cl)
649 struct mei_device *dev;
650 struct mei_me_client *me_cl;
653 if (WARN_ON(!cl || !cl->dev))
658 if (!dev->me_clients_num)
661 if (cl->mei_flow_ctrl_creds > 0)
664 id = mei_me_cl_by_id(dev, cl->me_client_id);
666 cl_err(dev, cl, "no such me client %d\n", cl->me_client_id);
670 me_cl = &dev->me_clients[id];
671 if (me_cl->mei_flow_ctrl_creds) {
672 if (WARN_ON(me_cl->props.single_recv_buf == 0))
680 * mei_cl_flow_ctrl_reduce - reduces flow_control.
682 * @cl: private data of the file object
686 * -ENOENT when me client is not found
687 * -EINVAL when ctrl credits are <= 0
689 int mei_cl_flow_ctrl_reduce(struct mei_cl *cl)
691 struct mei_device *dev;
692 struct mei_me_client *me_cl;
695 if (WARN_ON(!cl || !cl->dev))
700 id = mei_me_cl_by_id(dev, cl->me_client_id);
702 cl_err(dev, cl, "no such me client %d\n", cl->me_client_id);
706 me_cl = &dev->me_clients[id];
707 if (me_cl->props.single_recv_buf != 0) {
708 if (WARN_ON(me_cl->mei_flow_ctrl_creds <= 0))
710 me_cl->mei_flow_ctrl_creds--;
712 if (WARN_ON(cl->mei_flow_ctrl_creds <= 0))
714 cl->mei_flow_ctrl_creds--;
720 * mei_cl_read_start - the start read client message function.
724 * returns 0 on success, <0 on failure.
726 int mei_cl_read_start(struct mei_cl *cl, size_t length)
728 struct mei_device *dev;
729 struct mei_cl_cb *cb;
733 if (WARN_ON(!cl || !cl->dev))
738 if (!mei_cl_is_connected(cl))
742 cl_dbg(dev, cl, "read is pending.\n");
745 i = mei_me_cl_by_id(dev, cl->me_client_id);
747 cl_err(dev, cl, "no such me client %d\n", cl->me_client_id);
751 rets = pm_runtime_get(&dev->pdev->dev);
752 if (rets < 0 && rets != -EINPROGRESS) {
753 pm_runtime_put_noidle(&dev->pdev->dev);
754 cl_err(dev, cl, "rpm: get failed %d\n", rets);
758 cb = mei_io_cb_init(cl, NULL);
764 /* always allocate at least client max message */
765 length = max_t(size_t, length, dev->me_clients[i].props.max_msg_length);
766 rets = mei_io_cb_alloc_resp_buf(cb, length);
770 cb->fop_type = MEI_FOP_READ;
771 if (mei_hbuf_acquire(dev)) {
772 rets = mei_hbm_cl_flow_control_req(dev, cl);
776 list_add_tail(&cb->list, &dev->read_list.list);
778 list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
784 cl_dbg(dev, cl, "rpm: autosuspend\n");
785 pm_runtime_mark_last_busy(&dev->pdev->dev);
786 pm_runtime_put_autosuspend(&dev->pdev->dev);
795 * mei_cl_irq_write - write a message to device
796 * from the interrupt thread context
799 * @cb: callback block.
800 * @cmpl_list: complete list.
802 * returns 0, OK; otherwise error.
804 int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
805 struct mei_cl_cb *cmpl_list)
807 struct mei_device *dev;
808 struct mei_msg_data *buf;
809 struct mei_msg_hdr mei_hdr;
815 if (WARN_ON(!cl || !cl->dev))
820 buf = &cb->request_buffer;
822 rets = mei_cl_flow_ctrl_creds(cl);
827 cl_dbg(dev, cl, "No flow control credentials: not sending.\n");
831 slots = mei_hbuf_empty_slots(dev);
832 len = buf->size - cb->buf_idx;
833 msg_slots = mei_data2slots(len);
835 mei_hdr.host_addr = cl->host_client_id;
836 mei_hdr.me_addr = cl->me_client_id;
837 mei_hdr.reserved = 0;
838 mei_hdr.internal = cb->internal;
840 if (slots >= msg_slots) {
841 mei_hdr.length = len;
842 mei_hdr.msg_complete = 1;
843 /* Split the message only if we can write the whole host buffer */
844 } else if (slots == dev->hbuf_depth) {
846 len = (slots * sizeof(u32)) - sizeof(struct mei_msg_hdr);
847 mei_hdr.length = len;
848 mei_hdr.msg_complete = 0;
850 /* wait for next time the host buffer is empty */
854 cl_dbg(dev, cl, "buf: size = %d idx = %lu\n",
855 cb->request_buffer.size, cb->buf_idx);
857 rets = mei_write_message(dev, &mei_hdr, buf->data + cb->buf_idx);
860 list_move_tail(&cb->list, &cmpl_list->list);
865 cl->writing_state = MEI_WRITING;
866 cb->buf_idx += mei_hdr.length;
868 if (mei_hdr.msg_complete) {
869 if (mei_cl_flow_ctrl_reduce(cl))
871 list_move_tail(&cb->list, &dev->write_waiting_list.list);
878 * mei_cl_write - submit a write cb to mei device
879 assumes device_lock is locked
882 * @cl: write callback with filled data
884 * returns number of bytes sent on success, <0 on failure.
886 int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
888 struct mei_device *dev;
889 struct mei_msg_data *buf;
890 struct mei_msg_hdr mei_hdr;
894 if (WARN_ON(!cl || !cl->dev))
903 buf = &cb->request_buffer;
905 cl_dbg(dev, cl, "mei_cl_write %d\n", buf->size);
907 rets = pm_runtime_get(&dev->pdev->dev);
908 if (rets < 0 && rets != -EINPROGRESS) {
909 pm_runtime_put_noidle(&dev->pdev->dev);
910 cl_err(dev, cl, "rpm: get failed %d\n", rets);
914 cb->fop_type = MEI_FOP_WRITE;
916 cl->writing_state = MEI_IDLE;
918 mei_hdr.host_addr = cl->host_client_id;
919 mei_hdr.me_addr = cl->me_client_id;
920 mei_hdr.reserved = 0;
921 mei_hdr.msg_complete = 0;
922 mei_hdr.internal = cb->internal;
924 rets = mei_cl_flow_ctrl_creds(cl);
929 cl_dbg(dev, cl, "No flow control credentials: not sending.\n");
933 if (!mei_hbuf_acquire(dev)) {
934 cl_dbg(dev, cl, "Cannot acquire the host buffer: not sending.\n");
939 /* Check for a maximum length */
940 if (buf->size > mei_hbuf_max_len(dev)) {
941 mei_hdr.length = mei_hbuf_max_len(dev);
942 mei_hdr.msg_complete = 0;
944 mei_hdr.length = buf->size;
945 mei_hdr.msg_complete = 1;
948 rets = mei_write_message(dev, &mei_hdr, buf->data);
952 cl->writing_state = MEI_WRITING;
953 cb->buf_idx = mei_hdr.length;
956 if (mei_hdr.msg_complete) {
957 rets = mei_cl_flow_ctrl_reduce(cl);
961 list_add_tail(&cb->list, &dev->write_waiting_list.list);
963 list_add_tail(&cb->list, &dev->write_list.list);
967 if (blocking && cl->writing_state != MEI_WRITE_COMPLETE) {
969 mutex_unlock(&dev->device_lock);
970 rets = wait_event_interruptible(cl->tx_wait,
971 cl->writing_state == MEI_WRITE_COMPLETE);
972 mutex_lock(&dev->device_lock);
973 /* wait_event_interruptible returns -ERESTARTSYS */
975 if (signal_pending(current))
983 cl_dbg(dev, cl, "rpm: autosuspend\n");
984 pm_runtime_mark_last_busy(&dev->pdev->dev);
985 pm_runtime_put_autosuspend(&dev->pdev->dev);
992 * mei_cl_complete - processes completed operation for a client
994 * @cl: private data of the file object.
995 * @cb: callback block.
997 void mei_cl_complete(struct mei_cl *cl, struct mei_cl_cb *cb)
999 if (cb->fop_type == MEI_FOP_WRITE) {
1002 cl->writing_state = MEI_WRITE_COMPLETE;
1003 if (waitqueue_active(&cl->tx_wait))
1004 wake_up_interruptible(&cl->tx_wait);
1006 } else if (cb->fop_type == MEI_FOP_READ &&
1007 MEI_READING == cl->reading_state) {
1008 cl->reading_state = MEI_READ_COMPLETE;
1009 if (waitqueue_active(&cl->rx_wait))
1010 wake_up_interruptible(&cl->rx_wait);
1012 mei_cl_bus_rx_event(cl);
1019 * mei_cl_all_disconnect - disconnect forcefully all connected clients
1024 void mei_cl_all_disconnect(struct mei_device *dev)
1028 list_for_each_entry(cl, &dev->file_list, link) {
1029 cl->state = MEI_FILE_DISCONNECTED;
1030 cl->mei_flow_ctrl_creds = 0;
1031 cl->timer_count = 0;
1037 * mei_cl_all_wakeup - wake up all readers and writers they can be interrupted
1041 void mei_cl_all_wakeup(struct mei_device *dev)
1044 list_for_each_entry(cl, &dev->file_list, link) {
1045 if (waitqueue_active(&cl->rx_wait)) {
1046 cl_dbg(dev, cl, "Waking up reading client!\n");
1047 wake_up_interruptible(&cl->rx_wait);
1049 if (waitqueue_active(&cl->tx_wait)) {
1050 cl_dbg(dev, cl, "Waking up writing client!\n");
1051 wake_up_interruptible(&cl->tx_wait);
1057 * mei_cl_all_write_clear - clear all pending writes
1061 void mei_cl_all_write_clear(struct mei_device *dev)
1063 mei_io_list_free(&dev->write_list, NULL);
1064 mei_io_list_free(&dev->write_waiting_list, NULL);