lkml.org 
[lkml]   [2019]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v4 01/10] cdrom: add poll_event_interruptible
    Date
    Add convenience macro for polling an event that does not have a
    waitqueue.

    Signed-off-by: Michal Suchanek <msuchanek@suse.de>
    ---
    drivers/cdrom/cdrom.c | 14 ++++++++++++++
    1 file changed, 14 insertions(+)

    diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
    index ac42ae4651ce..2ad6b73482fe 100644
    --- a/drivers/cdrom/cdrom.c
    +++ b/drivers/cdrom/cdrom.c
    @@ -282,10 +282,24 @@
    #include <linux/fcntl.h>
    #include <linux/blkdev.h>
    #include <linux/times.h>
    +#include <linux/delay.h>
    #include <linux/uaccess.h>
    +#include <linux/sched/signal.h>
    #include <scsi/scsi_common.h>
    #include <scsi/scsi_request.h>

    +#define poll_event_interruptible(event, interval) ({ \
    + int ret = 0; \
    + while (!(event)) { \
    + if (signal_pending(current)) { \
    + ret = -ERESTARTSYS; \
    + break; \
    + } \
    + msleep_interruptible(interval); \
    + } \
    + ret; \
    +})
    +
    /* used to tell the module to turn on full debugging messages */
    static bool debug;
    /* default compatibility mode */
    --
    2.23.0
    \
     
     \ /
      Last update: 2019-11-21 18:15    [W:4.371 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site