Lines Matching refs:cl

50 	struct mei_cl *cl;
65 cl = mei_cl_alloc_linked(dev);
66 if (IS_ERR(cl)) {
67 err = PTR_ERR(cl);
71 cl->fp = file;
72 file->private_data = cl;
86 * @cl: host client
90 static void mei_cl_vtag_remove_by_fp(const struct mei_cl *cl,
95 list_for_each_entry_safe(vtag_l, next, &cl->vtag_map, list) {
114 struct mei_cl *cl = file->private_data;
118 if (WARN_ON(!cl || !cl->dev))
121 dev = cl->dev;
125 mei_cl_vtag_remove_by_fp(cl, file);
127 if (!list_empty(&cl->vtag_map)) {
128 cl_dbg(dev, cl, "not the last vtag\n");
129 mei_cl_flush_queues(cl, file);
134 rets = mei_cl_disconnect(cl);
139 if (!list_empty(&cl->vtag_map)) {
140 cl_dbg(dev, cl, "not the last vtag after disconnect\n");
141 mei_cl_flush_queues(cl, file);
145 mei_cl_flush_queues(cl, NULL);
146 cl_dbg(dev, cl, "removing\n");
148 mei_cl_unlink(cl);
149 kfree(cl);
172 struct mei_cl *cl = file->private_data;
178 if (WARN_ON(!cl || !cl->dev))
181 dev = cl->dev;
200 cb = mei_cl_read_cb(cl, file);
207 rets = mei_cl_read_start(cl, length, file);
209 cl_dbg(dev, cl, "mei start read failure status = %zd\n", rets);
219 if (wait_event_interruptible(cl->rx_wait,
220 mei_cl_read_cb(cl, file) ||
221 !mei_cl_is_connected(cl))) {
228 if (!mei_cl_is_connected(cl)) {
233 cb = mei_cl_read_cb(cl, file);
243 cl_dbg(dev, cl, "read operation failed %zd\n", rets);
247 cl_dbg(dev, cl, "buf.size = %zu buf.idx = %zu offset = %lld\n",
271 mei_cl_del_rd_completed(cl, cb);
275 cl_dbg(dev, cl, "end mei read rets = %zd\n", rets);
283 * @cl: host client
288 static u8 mei_cl_vtag_by_fp(const struct mei_cl *cl, const struct file *fp)
295 list_for_each_entry(cl_vtag, &cl->vtag_map, list)
314 struct mei_cl *cl = file->private_data;
319 if (WARN_ON(!cl || !cl->dev))
322 dev = cl->dev;
331 if (!mei_cl_is_connected(cl)) {
332 cl_err(dev, cl, "is not connected");
337 if (!mei_me_cl_is_active(cl->me_cl)) {
342 if (length > mei_cl_mtu(cl)) {
352 while (cl->tx_cb_queued >= dev->tx_queue_limit) {
358 rets = wait_event_interruptible(cl->tx_wait,
359 cl->writing_state == MEI_WRITE_COMPLETE ||
360 (!mei_cl_is_connected(cl)));
367 if (!mei_cl_is_connected(cl)) {
373 cb = mei_cl_alloc_cb(cl, length, MEI_FOP_WRITE, file);
378 cb->vtag = mei_cl_vtag_by_fp(cl, file);
388 rets = mei_cl_write(cl, cb, MAX_SCHEDULE_TIMEOUT);
411 struct mei_cl *cl;
414 cl = file->private_data;
415 dev = cl->dev;
417 if (cl->state != MEI_FILE_INITIALIZING &&
418 cl->state != MEI_FILE_DISCONNECTED)
453 rets = mei_cl_connect(cl, me_cl, file);
511 struct mei_cl *cl;
515 cl = file->private_data;
516 dev = cl->dev;
520 switch (cl->state) {
522 if (mei_cl_vtag_by_fp(cl, file) != vtag) {
529 if (!IS_ERR(mei_cl_fp_by_vtag(cl, vtag))) {
535 if (pos == cl)
548 /* replace cl with acquired one */
549 dev_dbg(dev->dev, "replacing with existing cl\n");
550 mei_cl_unlink(cl);
551 kfree(cl);
553 cl = pos;
561 list_add_tail(&cl_vtag->list, &cl->vtag_map);
567 while (cl->state != MEI_FILE_INITIALIZING &&
568 cl->state != MEI_FILE_DISCONNECTED &&
569 cl->state != MEI_FILE_CONNECTED) {
571 wait_event_timeout(cl->wait,
572 (cl->state == MEI_FILE_CONNECTED ||
573 cl->state == MEI_FILE_DISCONNECTED ||
574 cl->state == MEI_FILE_DISCONNECT_REQUIRED ||
575 cl->state == MEI_FILE_DISCONNECT_REPLY),
580 if (!mei_cl_is_connected(cl))
583 client->max_msg_length = cl->me_cl->props.max_msg_length;
584 client->protocol_version = cl->me_cl->props.protocol_version;
600 struct mei_cl *cl = file->private_data;
606 return mei_cl_notify_request(cl, file, (u8)request);
619 struct mei_cl *cl = file->private_data;
624 rets = mei_cl_notify_get(cl, block, &notify_ev);
644 struct mei_cl *cl = file->private_data;
654 if (WARN_ON(!cl || !cl->dev))
657 dev = cl->dev;
786 struct mei_cl *cl = file->private_data;
791 if (WARN_ON(!cl || !cl->dev))
794 dev = cl->dev;
798 notify_en = cl->notify_en && (req_events & EPOLLPRI);
801 !mei_cl_is_connected(cl)) {
807 poll_wait(file, &cl->ev_wait, wait);
808 if (cl->notify_ev)
813 poll_wait(file, &cl->rx_wait, wait);
815 if (mei_cl_read_cb(cl, file))
818 mei_cl_read_start(cl, mei_cl_mtu(cl), file);
822 poll_wait(file, &cl->tx_wait, wait);
823 if (cl->tx_cb_queued < dev->tx_queue_limit)
835 * @cl: writing host client
839 static bool mei_cl_is_write_queued(struct mei_cl *cl)
841 struct mei_device *dev = cl->dev;
845 if (cb->cl == cl)
848 if (cb->cl == cl)
865 struct mei_cl *cl = fp->private_data;
869 if (WARN_ON(!cl || !cl->dev))
872 dev = cl->dev;
876 if (dev->dev_state != MEI_DEV_ENABLED || !mei_cl_is_connected(cl)) {
881 while (mei_cl_is_write_queued(cl)) {
883 rets = wait_event_interruptible(cl->tx_wait,
884 cl->writing_state == MEI_WRITE_COMPLETE ||
885 !mei_cl_is_connected(cl));
892 if (!mei_cl_is_connected(cl)) {
917 struct mei_cl *cl = file->private_data;
919 if (!mei_cl_is_connected(cl))
922 return fasync_helper(fd, file, band, &cl->ev_async);