Lines Matching refs:fh

27 	struct cec_fh *fh = filp->private_data;
29 return &fh->adap->devnode;
37 struct cec_fh *fh = filp->private_data;
38 struct cec_adapter *adap = fh->adap;
41 poll_wait(filp, &fh->wait, poll);
48 if (fh->queued_msgs)
50 if (fh->total_queued_events)
57 const struct cec_fh *fh)
59 bool valid_initiator = adap->cec_initiator && adap->cec_initiator == fh;
60 bool valid_follower = adap->cec_follower && adap->cec_follower == fh;
72 fh->mode_initiator == CEC_MODE_NO_INITIATOR;
121 static long cec_adap_s_phys_addr(struct cec_adapter *adap, struct cec_fh *fh,
136 if (cec_is_busy(adap, fh))
167 static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh,
183 !cec_is_busy(adap, fh)) {
211 static long cec_transmit(struct cec_adapter *adap, struct cec_fh *fh,
227 else if (cec_is_busy(adap, fh))
230 err = cec_transmit_msg_fh(adap, &msg, fh, block);
240 static int cec_receive_msg(struct cec_fh *fh, struct cec_msg *msg, bool block)
246 mutex_lock(&fh->lock);
248 if (fh->queued_msgs) {
251 list_first_entry(&fh->msgs,
257 fh->queued_msgs--;
258 mutex_unlock(&fh->lock);
265 mutex_unlock(&fh->lock);
273 res = wait_event_interruptible_timeout(fh->wait,
274 fh->queued_msgs,
282 res = wait_event_interruptible(fh->wait,
283 fh->queued_msgs);
290 static long cec_receive(struct cec_adapter *adap, struct cec_fh *fh,
299 err = cec_receive_msg(fh, &msg, block);
308 static long cec_dqevent(struct cec_adapter *adap, struct cec_fh *fh,
317 mutex_lock(&fh->lock);
318 while (!fh->total_queued_events && block) {
319 mutex_unlock(&fh->lock);
320 err = wait_event_interruptible(fh->wait,
321 fh->total_queued_events);
324 mutex_lock(&fh->lock);
330 list_first_entry_or_null(&fh->events[i],
350 fh->queued_events[ev_idx]--;
351 fh->total_queued_events--;
354 mutex_unlock(&fh->lock);
358 static long cec_g_mode(struct cec_adapter *adap, struct cec_fh *fh,
361 u32 mode = fh->mode_initiator | fh->mode_follower;
368 static long cec_s_mode(struct cec_adapter *adap, struct cec_fh *fh,
432 adap->cec_follower && adap->cec_follower != fh)
439 adap->cec_initiator && adap->cec_initiator != fh)
443 bool old_mon_all = fh->mode_follower == CEC_MODE_MONITOR_ALL;
455 bool old_mon_pin = fh->mode_follower == CEC_MODE_MONITOR_PIN;
472 if (fh->mode_follower == CEC_MODE_FOLLOWER)
483 cec_queue_event_fh(fh, &ev, 0);
489 adap->cec_follower = fh;
490 } else if (adap->cec_follower == fh) {
495 adap->cec_initiator = fh;
496 else if (adap->cec_initiator == fh)
498 fh->mode_initiator = mode_initiator;
499 fh->mode_follower = mode_follower;
506 struct cec_fh *fh = filp->private_data;
507 struct cec_adapter *adap = fh->adap;
522 return cec_adap_s_phys_addr(adap, fh, block, parg);
528 return cec_adap_s_log_addrs(adap, fh, block, parg);
534 return cec_transmit(adap, fh, block, parg);
537 return cec_receive(adap, fh, block, parg);
540 return cec_dqevent(adap, fh, block, parg);
543 return cec_g_mode(adap, fh, parg);
546 return cec_s_mode(adap, fh, parg);
558 struct cec_fh *fh = kzalloc(sizeof(*fh), GFP_KERNEL);
570 if (!fh)
573 INIT_LIST_HEAD(&fh->msgs);
574 INIT_LIST_HEAD(&fh->xfer_list);
576 INIT_LIST_HEAD(&fh->events[i]);
577 mutex_init(&fh->lock);
578 init_waitqueue_head(&fh->wait);
580 fh->mode_initiator = CEC_MODE_INITIATOR;
581 fh->adap = adap;
585 kfree(fh);
589 filp->private_data = fh;
596 cec_queue_event_fh(fh, &ev, 0);
604 cec_queue_event_fh(fh, &ev, 0);
613 cec_queue_event_fh(fh, &ev, 0);
620 list_add(&fh->list, &devnode->fhs);
632 struct cec_fh *fh = filp->private_data;
636 if (adap->cec_initiator == fh)
638 if (adap->cec_follower == fh) {
642 if (fh->mode_follower == CEC_MODE_FOLLOWER)
644 if (fh->mode_follower == CEC_MODE_MONITOR_PIN)
646 if (fh->mode_follower == CEC_MODE_MONITOR_ALL)
652 list_del(&fh->list);
658 while (!list_empty(&fh->xfer_list)) {
660 list_first_entry(&fh->xfer_list, struct cec_data, xfer_list);
663 data->fh = NULL;
668 mutex_lock(&fh->lock);
669 while (!list_empty(&fh->msgs)) {
671 list_first_entry(&fh->msgs, struct cec_msg_entry, list);
677 while (!list_empty(&fh->events[i])) {
679 list_first_entry(&fh->events[i],
686 mutex_unlock(&fh->lock);
687 kfree(fh);