mirror of https://gitee.com/openkylin/linux.git
staging: comedi: wake up async waiters when become non-busy
Wake up all waiters on the comedi subdevice's async wait queue whenever the subdevice is marked "non-busy". This happens when an asynchronous command is cancelled or when a command is terminated and all data has been read or written. Note: use `wake_up_interruptible_all()` as we only use interruptible waits. Remove the call to `wake_up_interruptible()` from `do_cancel_ioctl()` as it will call `wake_up_interruptible_all()` indirectly via `do_cancel()` and `do_become_nonbusy()`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3867e20db4
commit
8da8c86f52
|
@ -563,12 +563,13 @@ static void do_become_nonbusy(struct comedi_device *dev,
|
||||||
async->inttrig = NULL;
|
async->inttrig = NULL;
|
||||||
kfree(async->cmd.chanlist);
|
kfree(async->cmd.chanlist);
|
||||||
async->cmd.chanlist = NULL;
|
async->cmd.chanlist = NULL;
|
||||||
|
s->busy = NULL;
|
||||||
|
wake_up_interruptible_all(&s->async->wait_head);
|
||||||
} else {
|
} else {
|
||||||
dev_err(dev->class_dev,
|
dev_err(dev->class_dev,
|
||||||
"BUG: (?) do_become_nonbusy called with async=NULL\n");
|
"BUG: (?) do_become_nonbusy called with async=NULL\n");
|
||||||
|
s->busy = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->busy = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
|
static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
|
||||||
|
@ -1700,7 +1701,6 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg,
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
ret = do_cancel(dev, s);
|
ret = do_cancel(dev, s);
|
||||||
wake_up_interruptible(&s->async->wait_head);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue