mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 22:21:42 +00:00
media: dvb_frontend: Use wait_event_freezable_timeout() for freezable kthread
A freezable kernel thread can enter frozen state during freezing by either calling try_to_freeze() or using wait_event_freezable() and its variants. So for the following snippet of code in a kernel thread loop: wait_event_interruptible_timeout(); try_to_freeze(); We can change it to a simple wait_event_freezable_timeout() and then eliminate a function call. Signed-off-by: Kevin Hao <haokexin@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
856525e8db
commit
ed917040eb
@ -679,12 +679,10 @@ static int dvb_frontend_thread(void *data)
|
||||
set_freezable();
|
||||
while (1) {
|
||||
up(&fepriv->sem); /* is locked when we enter the thread... */
|
||||
restart:
|
||||
wait_event_interruptible_timeout(fepriv->wait_queue,
|
||||
dvb_frontend_should_wakeup(fe) ||
|
||||
kthread_should_stop() ||
|
||||
freezing(current),
|
||||
fepriv->delay);
|
||||
wait_event_freezable_timeout(fepriv->wait_queue,
|
||||
dvb_frontend_should_wakeup(fe) ||
|
||||
kthread_should_stop(),
|
||||
fepriv->delay);
|
||||
|
||||
if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) {
|
||||
/* got signal or quitting */
|
||||
@ -694,9 +692,6 @@ restart:
|
||||
break;
|
||||
}
|
||||
|
||||
if (try_to_freeze())
|
||||
goto restart;
|
||||
|
||||
if (down_interruptible(&fepriv->sem))
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user