Skip to content

Commit

Permalink
media: Add poll support
Browse files Browse the repository at this point in the history
Implement poll for events. POLLPRI is used to notify users on incoming
events.

disable the poll function for build error.

Signed-off-by: Wanhui Sun <wanhui.sun@intel.com>
Signed-off-by: Chen Meng J <meng.j.chen@intel.com>
Signed-off-by: Meng Wei <wei.meng@intel.com>
  • Loading branch information
wanhuisu authored and krispan-intel committed Jul 2, 2021
1 parent c7a2268 commit 9ca13cf
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions drivers/media/mc/mc-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,39 @@ static long media_device_ioctl(struct file *filp, unsigned int cmd,
return ret;
}

static unsigned int media_device_poll(struct file *filp,
struct poll_table_struct *wait)
{
/*
struct media_device_fh *fh = media_device_fh(filp);
struct media_device *mdev = fh->fh.devnode->media_dev;
unsigned int poll_events = poll_requested_events(wait);
int ret = 0;
if (poll_events & (POLLIN | POLLOUT))
return POLLERR;
if (poll_events & POLLPRI) {
unsigned long flags;
bool empty;
spin_lock_irqsave(&mdev->req_lock, flags);
empty = list_empty(&fh->kevents.head);
spin_unlock_irqrestore(&mdev->req_lock, flags);
if (empty)
poll_wait(filp, &fh->kevents.wait, wait);
else
ret |= POLLPRI;
}
return ret;
*/

printk("media_device_poll func\n");
return 0;
}

#ifdef CONFIG_COMPAT

struct media_links_enum32 {
Expand Down Expand Up @@ -566,6 +599,7 @@ static const struct media_file_operations media_device_fops = {
.owner = THIS_MODULE,
.open = media_device_open,
.ioctl = media_device_ioctl,
.poll = media_device_poll,
#ifdef CONFIG_COMPAT
.compat_ioctl = media_device_compat_ioctl,
#endif /* CONFIG_COMPAT */
Expand Down

0 comments on commit 9ca13cf

Please sign in to comment.