[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <a26ef20e6ff686573a0af16435f20aba186746af.1516985620.git.msuchanek@suse.de>
Date: Fri, 26 Jan 2018 17:58:35 +0100
From: Michal Suchanek <msuchanek@...e.de>
To: Jens Axboe <axboe@...nel.dk>, Jonathan Corbet <corbet@....net>,
Borislav Petkov <bp@...en8.de>, Tim Waugh <tim@...erelk.net>,
"David S. Miller" <davem@...emloft.net>,
"James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Michal Suchanek <msuchanek@...e.de>,
Kees Cook <keescook@...omium.org>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Thomas Gleixner <tglx@...utronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kate Stewart <kstewart@...uxfoundation.org>,
Philippe Ombredanne <pombredanne@...b.com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-ide@...r.kernel.org, linux-scsi@...r.kernel.org
Subject: [PATCH resend 1/6] delay: add poll_event_interruptible
Add convenience macro for polling an event that does not have a
waitqueue.
Signed-off-by: Michal Suchanek <msuchanek@...e.de>
---
include/linux/delay.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/delay.h b/include/linux/delay.h
index b78bab4395d8..3ae9fa395628 100644
--- a/include/linux/delay.h
+++ b/include/linux/delay.h
@@ -64,4 +64,16 @@ static inline void ssleep(unsigned int seconds)
msleep(seconds * 1000);
}
+#define poll_event_interruptible(event, interval) ({ \
+ int ret = 0; \
+ while (!(event)) { \
+ if (signal_pending(current)) { \
+ ret = -ERESTARTSYS; \
+ break; \
+ } \
+ msleep_interruptible(interval); \
+ } \
+ ret; \
+})
+
#endif /* defined(_LINUX_DELAY_H) */
--
2.13.6
Powered by blists - more mailing lists