Lines Matching refs:cl
48 struct mei_cl *cl; in mei_open() local
65 cl = mei_cl_alloc_linked(dev); in mei_open()
66 if (IS_ERR(cl)) { in mei_open()
67 err = PTR_ERR(cl); in mei_open()
71 cl->fp = file; in mei_open()
72 file->private_data = cl; in mei_open()
93 struct mei_cl *cl = file->private_data; in mei_release() local
97 if (WARN_ON(!cl || !cl->dev)) in mei_release()
100 dev = cl->dev; in mei_release()
104 rets = mei_cl_disconnect(cl); in mei_release()
106 mei_cl_flush_queues(cl, file); in mei_release()
107 cl_dbg(dev, cl, "removing\n"); in mei_release()
109 mei_cl_unlink(cl); in mei_release()
113 kfree(cl); in mei_release()
133 struct mei_cl *cl = file->private_data; in mei_read() local
139 if (WARN_ON(!cl || !cl->dev)) in mei_read()
142 dev = cl->dev; in mei_read()
161 cb = mei_cl_read_cb(cl, file); in mei_read()
168 rets = mei_cl_read_start(cl, length, file); in mei_read()
170 cl_dbg(dev, cl, "mei start read failure status = %zd\n", rets); in mei_read()
180 if (wait_event_interruptible(cl->rx_wait, in mei_read()
181 !list_empty(&cl->rd_completed) || in mei_read()
182 !mei_cl_is_connected(cl))) { in mei_read()
189 if (!mei_cl_is_connected(cl)) { in mei_read()
194 cb = mei_cl_read_cb(cl, file); in mei_read()
204 cl_dbg(dev, cl, "read operation failed %zd\n", rets); in mei_read()
208 cl_dbg(dev, cl, "buf.size = %zu buf.idx = %zu offset = %lld\n", in mei_read()
236 cl_dbg(dev, cl, "end mei read rets = %zd\n", rets); in mei_read()
253 struct mei_cl *cl = file->private_data; in mei_write() local
258 if (WARN_ON(!cl || !cl->dev)) in mei_write()
261 dev = cl->dev; in mei_write()
270 if (!mei_cl_is_connected(cl)) { in mei_write()
271 cl_err(dev, cl, "is not connected"); in mei_write()
276 if (!mei_me_cl_is_active(cl->me_cl)) { in mei_write()
281 if (length > mei_cl_mtu(cl)) { in mei_write()
291 while (cl->tx_cb_queued >= dev->tx_queue_limit) { in mei_write()
297 rets = wait_event_interruptible(cl->tx_wait, in mei_write()
298 cl->writing_state == MEI_WRITE_COMPLETE || in mei_write()
299 (!mei_cl_is_connected(cl))); in mei_write()
306 if (!mei_cl_is_connected(cl)) { in mei_write()
312 cb = mei_cl_alloc_cb(cl, length, MEI_FOP_WRITE, file); in mei_write()
326 rets = mei_cl_write(cl, cb); in mei_write()
348 struct mei_cl *cl; in mei_ioctl_connect_client() local
351 cl = file->private_data; in mei_ioctl_connect_client()
352 dev = cl->dev; in mei_ioctl_connect_client()
357 if (cl->state != MEI_FILE_INITIALIZING && in mei_ioctl_connect_client()
358 cl->state != MEI_FILE_DISCONNECTED) in mei_ioctl_connect_client()
394 rets = mei_cl_connect(cl, me_cl, file); in mei_ioctl_connect_client()
412 struct mei_cl *cl = file->private_data; in mei_ioctl_client_notify_request() local
418 return mei_cl_notify_request(cl, file, (u8)request); in mei_ioctl_client_notify_request()
431 struct mei_cl *cl = file->private_data; in mei_ioctl_client_notify_get() local
436 rets = mei_cl_notify_get(cl, block, ¬ify_ev); in mei_ioctl_client_notify_get()
456 struct mei_cl *cl = file->private_data; in mei_ioctl() local
462 if (WARN_ON(!cl || !cl->dev)) in mei_ioctl()
465 dev = cl->dev; in mei_ioctl()
564 struct mei_cl *cl = file->private_data; in mei_poll() local
569 if (WARN_ON(!cl || !cl->dev)) in mei_poll()
572 dev = cl->dev; in mei_poll()
576 notify_en = cl->notify_en && (req_events & EPOLLPRI); in mei_poll()
579 !mei_cl_is_connected(cl)) { in mei_poll()
585 poll_wait(file, &cl->ev_wait, wait); in mei_poll()
586 if (cl->notify_ev) in mei_poll()
591 poll_wait(file, &cl->rx_wait, wait); in mei_poll()
593 if (!list_empty(&cl->rd_completed)) in mei_poll()
596 mei_cl_read_start(cl, mei_cl_mtu(cl), file); in mei_poll()
600 poll_wait(file, &cl->tx_wait, wait); in mei_poll()
601 if (cl->tx_cb_queued < dev->tx_queue_limit) in mei_poll()
617 static bool mei_cl_is_write_queued(struct mei_cl *cl) in mei_cl_is_write_queued() argument
619 struct mei_device *dev = cl->dev; in mei_cl_is_write_queued()
623 if (cb->cl == cl) in mei_cl_is_write_queued()
626 if (cb->cl == cl) in mei_cl_is_write_queued()
643 struct mei_cl *cl = fp->private_data; in mei_fsync() local
647 if (WARN_ON(!cl || !cl->dev)) in mei_fsync()
650 dev = cl->dev; in mei_fsync()
654 if (dev->dev_state != MEI_DEV_ENABLED || !mei_cl_is_connected(cl)) { in mei_fsync()
659 while (mei_cl_is_write_queued(cl)) { in mei_fsync()
661 rets = wait_event_interruptible(cl->tx_wait, in mei_fsync()
662 cl->writing_state == MEI_WRITE_COMPLETE || in mei_fsync()
663 !mei_cl_is_connected(cl)); in mei_fsync()
670 if (!mei_cl_is_connected(cl)) { in mei_fsync()
695 struct mei_cl *cl = file->private_data; in mei_fasync() local
697 if (!mei_cl_is_connected(cl)) in mei_fasync()
700 return fasync_helper(fd, file, band, &cl->ev_async); in mei_fasync()