Skip to content

Commit a08fa92

Browse files
amit3srustyrussell
authored andcommitted
virtio: console: Use wait_event_freezable instead of _interruptible
Get ready to support suspend/resume by using the freezable calls so that blocking read/write syscalls are handled properly across suspend/resume. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 291024e commit a08fa92

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎drivers/char/virtio_console.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/debugfs.h>
2222
#include <linux/device.h>
2323
#include <linux/err.h>
24+
#include <linux/freezer.h>
2425
#include <linux/fs.h>
2526
#include <linux/init.h>
2627
#include <linux/list.h>
@@ -633,8 +634,8 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,
633634
if (filp->f_flags & O_NONBLOCK)
634635
return -EAGAIN;
635636

636-
ret = wait_event_interruptible(port->waitqueue,
637-
!will_read_block(port));
637+
ret = wait_event_freezable(port->waitqueue,
638+
!will_read_block(port));
638639
if (ret < 0)
639640
return ret;
640641
}
@@ -677,8 +678,8 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf,
677678
if (nonblock)
678679
return -EAGAIN;
679680

680-
ret = wait_event_interruptible(port->waitqueue,
681-
!will_write_block(port));
681+
ret = wait_event_freezable(port->waitqueue,
682+
!will_write_block(port));
682683
if (ret < 0)
683684
return ret;
684685
}

0 commit comments

Comments
 (0)