static unsigned int dma_buf_lock_handle_poll(struct file *file, struct poll_table_struct *wait) { dma_buf_lock_resource *resource; unsigned int ret = 0; if (!is_dma_buf_lock_file(file)) return POLLERR; resource = file->private_data; #if DMA_BUF_LOCK_DEBUG printk("dma_buf_lock_handle_poll\n"); #endif if (1 == atomic_read(&resource->locked)) { /* Resources have been locked */ ret = POLLIN | POLLRDNORM; if (resource->exclusive) { ret |= POLLOUT | POLLWRNORM; } } else { if (!poll_does_not_wait(wait)) { poll_wait(file, &resource->wait, wait); } } #if DMA_BUF_LOCK_DEBUG printk("dma_buf_lock_handle_poll : return %i\n", ret); #endif return ret; }
static unsigned int sync_file_poll(struct file *file, poll_table *wait) { struct sync_file *sync_file = file->private_data; poll_wait(file, &sync_file->wq, wait); if (!poll_does_not_wait(wait) && !test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) { if (fence_add_callback(sync_file->fence, &sync_file->cb, fence_check_cb_func) < 0) wake_up_all(&sync_file->wq); } return fence_is_signaled(sync_file->fence) ? POLLIN : 0; }
static unsigned int audiostub_poll(struct file *filp, poll_table *wait) { unsigned int mask = 0; if (filp->private_data != (void *)AUDIO_PCM_OFFSET) return 0; if ((filp->f_flags & O_ACCMODE) == O_RDONLY) { poll_wait(filp, &pcm_rxwq, wait); if (!skb_queue_empty(&pcm_rxq)) mask |= POLLIN | POLLRDNORM; } else if ((filp->f_flags & O_ACCMODE) == O_WRONLY) { poll_wait(filp, &pcm_txwq, wait); /* make sure a packet has been sent before poll returns */ if (poll_does_not_wait(wait) && skb_queue_len(&pcm_txq) < MAX_AUDIO_PACKET_NUM) { mask |= POLLOUT | POLLWRNORM; } } return mask; }