diff options
author | Kevin Hao <haokexin@gmail.com> | 2023-12-21 10:22:28 +0800 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2024-02-16 11:46:31 +0100 |
commit | 730ffa9c5c76703b4c7f9c7126287957dc50f1e0 (patch) | |
tree | 0edebd2c3ef1b8543be3fab1cba54fcb9d9dd6b8 /drivers/media/usb | |
parent | 7c17c55248327d70b065378eaf2e8be0f22593ce (diff) | |
download | linux-730ffa9c5c76703b4c7f9c7126287957dc50f1e0.tar.gz linux-730ffa9c5c76703b4c7f9c7126287957dc50f1e0.tar.bz2 linux-730ffa9c5c76703b4c7f9c7126287957dc50f1e0.zip |
media: pvrusb2: Use wait_event_freezable() 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:
try_to_freeze();
wait_event_interruptible();
We can change it to a simple wait_event_freezable() and then eliminate
a function call.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r-- | drivers/media/usb/pvrusb2/pvrusb2-dvb.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-dvb.c b/drivers/media/usb/pvrusb2/pvrusb2-dvb.c index 26811efe0fb5..6dd6c5a18251 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-dvb.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-dvb.c @@ -33,9 +33,6 @@ static int pvr2_dvb_feed_func(struct pvr2_dvb_adapter *adap) for (;;) { if (kthread_should_stop()) break; - /* Not sure about this... */ - try_to_freeze(); - bp = pvr2_stream_get_ready_buffer(stream); if (bp != NULL) { count = pvr2_buffer_get_count(bp); @@ -62,8 +59,7 @@ static int pvr2_dvb_feed_func(struct pvr2_dvb_adapter *adap) /* Wait until more buffers become available or we're told not to wait any longer. */ - ret = wait_event_interruptible( - adap->buffer_wait_data, + ret = wait_event_freezable(adap->buffer_wait_data, (pvr2_stream_get_ready_count(stream) > 0) || kthread_should_stop()); if (ret < 0) break; |