mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
msm: sdio_ctl: Update the driver to support poll operation
Poll operation is needed by user-space modules, to select among multiple file descriptors for read/write operation. CRs-Fixed: 357121 Change-Id: Iaa817c31bdfee7a1fcb3c5e94a805a526b71cd6c Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
This commit is contained in:
parent
ea9a7b23e9
commit
42a59a7c64
1 changed files with 31 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
|
||||
/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -25,6 +25,7 @@
|
|||
#include <linux/mutex.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/poll.h>
|
||||
#include <asm/ioctls.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <mach/msm_smd.h>
|
||||
|
@ -206,6 +207,34 @@ static long sdio_ctl_ioctl(struct file *file, unsigned int cmd,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static unsigned int sdio_ctl_poll(struct file *file, poll_table *wait)
|
||||
{
|
||||
struct sdio_ctl_dev *sdio_ctl_devp;
|
||||
unsigned int mask = 0;
|
||||
|
||||
sdio_ctl_devp = file->private_data;
|
||||
if (!sdio_ctl_devp) {
|
||||
pr_err("%s: on a NULL device\n", __func__);
|
||||
return POLLERR;
|
||||
}
|
||||
|
||||
poll_wait(file, &sdio_ctl_devp->read_wait_queue, wait);
|
||||
mutex_lock(&sdio_ctl_devp->rx_lock);
|
||||
if (sdio_cmux_is_channel_reset(sdio_ctl_devp->id)) {
|
||||
mutex_unlock(&sdio_ctl_devp->rx_lock);
|
||||
pr_err("%s notifying reset for sdio_ctl_dev id:%d\n",
|
||||
__func__, sdio_ctl_devp->id);
|
||||
return POLLERR;
|
||||
}
|
||||
|
||||
if (sdio_ctl_devp->read_avail > 0)
|
||||
mask |= POLLIN | POLLRDNORM;
|
||||
|
||||
mutex_unlock(&sdio_ctl_devp->rx_lock);
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
ssize_t sdio_ctl_read(struct file *file,
|
||||
char __user *buf,
|
||||
size_t count,
|
||||
|
@ -417,6 +446,7 @@ static const struct file_operations sdio_ctl_fops = {
|
|||
.release = sdio_ctl_release,
|
||||
.read = sdio_ctl_read,
|
||||
.write = sdio_ctl_write,
|
||||
.poll = sdio_ctl_poll,
|
||||
.unlocked_ioctl = sdio_ctl_ioctl,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue