|
@@ -169,6 +169,7 @@ static long phantom_ioctl(struct file *file, unsigned int cmd,
|
|
for (i = 0; i < m; i++)
|
|
for (i = 0; i < m; i++)
|
|
if (rs.mask & BIT(i))
|
|
if (rs.mask & BIT(i))
|
|
rs.values[i] = ioread32(dev->iaddr + i);
|
|
rs.values[i] = ioread32(dev->iaddr + i);
|
|
|
|
+ atomic_set(&dev->counter, 0);
|
|
spin_unlock_irqrestore(&dev->regs_lock, flags);
|
|
spin_unlock_irqrestore(&dev->regs_lock, flags);
|
|
|
|
|
|
if (copy_to_user(argp, &rs, sizeof(rs)))
|
|
if (copy_to_user(argp, &rs, sizeof(rs)))
|
|
@@ -254,11 +255,12 @@ static unsigned int phantom_poll(struct file *file, poll_table *wait)
|
|
|
|
|
|
pr_debug("phantom_poll: %d\n", atomic_read(&dev->counter));
|
|
pr_debug("phantom_poll: %d\n", atomic_read(&dev->counter));
|
|
poll_wait(file, &dev->wait, wait);
|
|
poll_wait(file, &dev->wait, wait);
|
|
- if (atomic_read(&dev->counter)) {
|
|
|
|
|
|
+
|
|
|
|
+ if (!(dev->status & PHB_RUNNING))
|
|
|
|
+ mask = POLLERR;
|
|
|
|
+ else if (atomic_read(&dev->counter))
|
|
mask = POLLIN | POLLRDNORM;
|
|
mask = POLLIN | POLLRDNORM;
|
|
- atomic_dec(&dev->counter);
|
|
|
|
- } else if ((dev->status & PHB_RUNNING) == 0)
|
|
|
|
- mask = POLLIN | POLLRDNORM | POLLERR;
|
|
|
|
|
|
+
|
|
pr_debug("phantom_poll end: %x/%d\n", mask, atomic_read(&dev->counter));
|
|
pr_debug("phantom_poll end: %x/%d\n", mask, atomic_read(&dev->counter));
|
|
|
|
|
|
return mask;
|
|
return mask;
|