From patchwork Fri Jan 26 16:58:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Suchanek X-Patchwork-Id: 10187583 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 044FB60383 for ; Sat, 27 Jan 2018 16:45:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D945C28C1F for ; Sat, 27 Jan 2018 16:45:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBD8428C46; Sat, 27 Jan 2018 16:45:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.9 required=2.0 tests=BAYES_00, DATE_IN_PAST_12_24, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7646928C1F for ; Sat, 27 Jan 2018 16:45:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753170AbeA0QpS (ORCPT ); Sat, 27 Jan 2018 11:45:18 -0500 Received: from mx2.suse.de ([195.135.220.15]:44976 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753122AbeA0QpQ (ORCPT ); Sat, 27 Jan 2018 11:45:16 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id EF97EACF0; Sat, 27 Jan 2018 16:38:33 +0000 (UTC) From: Michal Suchanek To: Jens Axboe , Jonathan Corbet , Borislav Petkov , Tim Waugh , "David S. Miller" , "James E.J. Bottomley" , "Martin K. Petersen" , Michal Suchanek , Kees Cook , Christophe JAILLET , Thomas Gleixner , Greg Kroah-Hartman , Kate Stewart , Philippe Ombredanne , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org Subject: [PATCH resend 1/6] delay: add poll_event_interruptible Date: Fri, 26 Jan 2018 17:58:35 +0100 Message-Id: X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add convenience macro for polling an event that does not have a waitqueue. Signed-off-by: Michal Suchanek --- 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) */