Lines Matching refs:fh

27 	struct cec_fh *fh = filp->private_data;  in cec_devnode_data()  local
29 return &fh->adap->devnode; in cec_devnode_data()
37 struct cec_fh *fh = filp->private_data; in cec_poll() local
38 struct cec_adapter *adap = fh->adap; in cec_poll()
47 if (fh->queued_msgs) in cec_poll()
49 if (fh->total_queued_events) in cec_poll()
51 poll_wait(filp, &fh->wait, poll); in cec_poll()
57 const struct cec_fh *fh) in cec_is_busy() argument
59 bool valid_initiator = adap->cec_initiator && adap->cec_initiator == fh; in cec_is_busy()
60 bool valid_follower = adap->cec_follower && adap->cec_follower == fh; in cec_is_busy()
72 fh->mode_initiator == CEC_MODE_NO_INITIATOR; in cec_is_busy()
104 static long cec_adap_s_phys_addr(struct cec_adapter *adap, struct cec_fh *fh, in cec_adap_s_phys_addr() argument
119 if (cec_is_busy(adap, fh)) in cec_adap_s_phys_addr()
144 static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh, in cec_adap_s_log_addrs() argument
160 !cec_is_busy(adap, fh)) { in cec_adap_s_log_addrs()
173 static long cec_transmit(struct cec_adapter *adap, struct cec_fh *fh, in cec_transmit() argument
197 else if (cec_is_busy(adap, fh)) in cec_transmit()
200 err = cec_transmit_msg_fh(adap, &msg, fh, block); in cec_transmit()
210 static int cec_receive_msg(struct cec_fh *fh, struct cec_msg *msg, bool block) in cec_receive_msg() argument
216 mutex_lock(&fh->lock); in cec_receive_msg()
218 if (fh->queued_msgs) { in cec_receive_msg()
221 list_first_entry(&fh->msgs, in cec_receive_msg()
227 fh->queued_msgs--; in cec_receive_msg()
228 mutex_unlock(&fh->lock); in cec_receive_msg()
235 mutex_unlock(&fh->lock); in cec_receive_msg()
243 res = wait_event_interruptible_timeout(fh->wait, in cec_receive_msg()
244 fh->queued_msgs, in cec_receive_msg()
252 res = wait_event_interruptible(fh->wait, in cec_receive_msg()
253 fh->queued_msgs); in cec_receive_msg()
260 static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh, in cec_receive() argument
269 err = cec_receive_msg(fh, &msg, block); in cec_receive()
278 static long cec_dqevent(struct cec_adapter *adap, struct cec_fh *fh, in cec_dqevent() argument
287 mutex_lock(&fh->lock); in cec_dqevent()
288 while (!fh->total_queued_events && block) { in cec_dqevent()
289 mutex_unlock(&fh->lock); in cec_dqevent()
290 err = wait_event_interruptible(fh->wait, in cec_dqevent()
291 fh->total_queued_events); in cec_dqevent()
294 mutex_lock(&fh->lock); in cec_dqevent()
300 list_first_entry_or_null(&fh->events[i], in cec_dqevent()
320 fh->queued_events[ev_idx]--; in cec_dqevent()
321 fh->total_queued_events--; in cec_dqevent()
324 mutex_unlock(&fh->lock); in cec_dqevent()
328 static long cec_g_mode(struct cec_adapter *adap, struct cec_fh *fh, in cec_g_mode() argument
331 u32 mode = fh->mode_initiator | fh->mode_follower; in cec_g_mode()
338 static long cec_s_mode(struct cec_adapter *adap, struct cec_fh *fh, in cec_s_mode() argument
402 adap->cec_follower && adap->cec_follower != fh) in cec_s_mode()
409 adap->cec_initiator && adap->cec_initiator != fh) in cec_s_mode()
413 bool old_mon_all = fh->mode_follower == CEC_MODE_MONITOR_ALL; in cec_s_mode()
425 bool old_mon_pin = fh->mode_follower == CEC_MODE_MONITOR_PIN; in cec_s_mode()
442 if (fh->mode_follower == CEC_MODE_FOLLOWER) in cec_s_mode()
453 cec_queue_event_fh(fh, &ev, 0); in cec_s_mode()
459 adap->cec_follower = fh; in cec_s_mode()
460 } else if (adap->cec_follower == fh) { in cec_s_mode()
465 adap->cec_initiator = fh; in cec_s_mode()
466 else if (adap->cec_initiator == fh) in cec_s_mode()
468 fh->mode_initiator = mode_initiator; in cec_s_mode()
469 fh->mode_follower = mode_follower; in cec_s_mode()
476 struct cec_fh *fh = filp->private_data; in cec_ioctl() local
477 struct cec_adapter *adap = fh->adap; in cec_ioctl()
492 return cec_adap_s_phys_addr(adap, fh, block, parg); in cec_ioctl()
498 return cec_adap_s_log_addrs(adap, fh, block, parg); in cec_ioctl()
501 return cec_transmit(adap, fh, block, parg); in cec_ioctl()
504 return cec_receive(adap, fh, block, parg); in cec_ioctl()
507 return cec_dqevent(adap, fh, block, parg); in cec_ioctl()
510 return cec_g_mode(adap, fh, parg); in cec_ioctl()
513 return cec_s_mode(adap, fh, parg); in cec_ioctl()
525 struct cec_fh *fh = kzalloc(sizeof(*fh), GFP_KERNEL); in cec_open() local
537 if (!fh) in cec_open()
540 INIT_LIST_HEAD(&fh->msgs); in cec_open()
541 INIT_LIST_HEAD(&fh->xfer_list); in cec_open()
543 INIT_LIST_HEAD(&fh->events[i]); in cec_open()
544 mutex_init(&fh->lock); in cec_open()
545 init_waitqueue_head(&fh->wait); in cec_open()
547 fh->mode_initiator = CEC_MODE_INITIATOR; in cec_open()
548 fh->adap = adap; in cec_open()
552 kfree(fh); in cec_open()
563 kfree(fh); in cec_open()
567 filp->private_data = fh; in cec_open()
572 cec_queue_event_fh(fh, &ev, 0); in cec_open()
579 cec_queue_event_fh(fh, &ev, 0); in cec_open()
587 cec_queue_event_fh(fh, &ev, 0); in cec_open()
592 list_add(&fh->list, &devnode->fhs); in cec_open()
603 struct cec_fh *fh = filp->private_data; in cec_release() local
607 if (adap->cec_initiator == fh) in cec_release()
609 if (adap->cec_follower == fh) { in cec_release()
613 if (fh->mode_follower == CEC_MODE_FOLLOWER) in cec_release()
615 if (fh->mode_follower == CEC_MODE_MONITOR_PIN) in cec_release()
617 if (fh->mode_follower == CEC_MODE_MONITOR_ALL) in cec_release()
622 list_del(&fh->list); in cec_release()
631 while (!list_empty(&fh->xfer_list)) { in cec_release()
633 list_first_entry(&fh->xfer_list, struct cec_data, xfer_list); in cec_release()
636 data->fh = NULL; in cec_release()
640 while (!list_empty(&fh->msgs)) { in cec_release()
642 list_first_entry(&fh->msgs, struct cec_msg_entry, list); in cec_release()
648 while (!list_empty(&fh->events[i])) { in cec_release()
650 list_first_entry(&fh->events[i], in cec_release()
657 kfree(fh); in cec_release()