diff options
author | Kevin Hao <haokexin@gmail.com> | 2023-12-21 10:22:26 +0800 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2024-02-16 11:46:31 +0100 |
commit | ed917040ebf5a66250cfda91bf8aec325ab09724 (patch) | |
tree | 257d22d0eea9b3060d0a3da25def935ce4e96857 | |
parent | 856525e8db272b0ce6d9c6e6c2eeb97892b485a6 (diff) | |
download | lwn-ed917040ebf5a66250cfda91bf8aec325ab09724.tar.gz lwn-ed917040ebf5a66250cfda91bf8aec325ab09724.zip |
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>
-rw-r--r-- | drivers/media/dvb-core/dvb_frontend.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index 93d3378a0df4..4f78f30b3646 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -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; |