From patchwork Fri Oct 25 11:21:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Suchanek X-Patchwork-Id: 11212071 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 53D8B139A for ; Fri, 25 Oct 2019 11:22:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 32A4D21D81 for ; Fri, 25 Oct 2019 11:22:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409266AbfJYLVv (ORCPT ); Fri, 25 Oct 2019 07:21:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:56812 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726352AbfJYLVv (ORCPT ); Fri, 25 Oct 2019 07:21:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 396CDB227; Fri, 25 Oct 2019 11:21:49 +0000 (UTC) From: Michal Suchanek To: linux-scsi@vger.kernel.org Cc: Michal Suchanek , Christoph Hellwig , Matthew Wilcox , "Ewan D. Milne" , Jonathan Corbet , Jens Axboe , "James E.J. Bottomley" , "Martin K. Petersen" , Alexander Viro , "J. Bruce Fields" , Mauro Carvalho Chehab , Eric Biggers , Benjamin Coddington , Hannes Reinecke , Omar Sandoval , Ming Lei , Damien Le Moal , Bart Van Assche , Tejun Heo , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v3 1/7] cdrom: add poll_event_interruptible Date: Fri, 25 Oct 2019 13:21:38 +0200 Message-Id: <0a5ab9c86120851692aaa4390ee85ab9b2f86a8a.1572002144.git.msuchanek@suse.de> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add convenience macro for polling an event that does not have a waitqueue. Signed-off-by: Michal Suchanek --- 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 #include #include +#include #include +#include #include #include +#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 */