diff options
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/phantom.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c index 5447a603686a..71d1c84e2fa8 100644 --- a/drivers/misc/phantom.c +++ b/drivers/misc/phantom.c | |||
@@ -169,6 +169,7 @@ static long phantom_ioctl(struct file *file, unsigned int cmd, | |||
169 | for (i = 0; i < m; i++) | 169 | for (i = 0; i < m; i++) |
170 | if (rs.mask & BIT(i)) | 170 | if (rs.mask & BIT(i)) |
171 | rs.values[i] = ioread32(dev->iaddr + i); | 171 | rs.values[i] = ioread32(dev->iaddr + i); |
172 | atomic_set(&dev->counter, 0); | ||
172 | spin_unlock_irqrestore(&dev->regs_lock, flags); | 173 | spin_unlock_irqrestore(&dev->regs_lock, flags); |
173 | 174 | ||
174 | if (copy_to_user(argp, &rs, sizeof(rs))) | 175 | if (copy_to_user(argp, &rs, sizeof(rs))) |
@@ -254,11 +255,12 @@ static unsigned int phantom_poll(struct file *file, poll_table *wait) | |||
254 | 255 | ||
255 | pr_debug("phantom_poll: %d\n", atomic_read(&dev->counter)); | 256 | pr_debug("phantom_poll: %d\n", atomic_read(&dev->counter)); |
256 | poll_wait(file, &dev->wait, wait); | 257 | poll_wait(file, &dev->wait, wait); |
257 | if (atomic_read(&dev->counter)) { | 258 | |
259 | if (!(dev->status & PHB_RUNNING)) | ||
260 | mask = POLLERR; | ||
261 | else if (atomic_read(&dev->counter)) | ||
258 | mask = POLLIN | POLLRDNORM; | 262 | mask = POLLIN | POLLRDNORM; |
259 | atomic_dec(&dev->counter); | 263 | |
260 | } else if ((dev->status & PHB_RUNNING) == 0) | ||
261 | mask = POLLIN | POLLRDNORM | POLLERR; | ||
262 | pr_debug("phantom_poll end: %x/%d\n", mask, atomic_read(&dev->counter)); | 264 | pr_debug("phantom_poll end: %x/%d\n", mask, atomic_read(&dev->counter)); |
263 | 265 | ||
264 | return mask; | 266 | return mask; |