From patchwork Fri Aug 7 17:29:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 6972251 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 41BDBC05AD for ; Fri, 7 Aug 2015 17:29:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2E093205EF for ; Fri, 7 Aug 2015 17:29:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 34E1420532 for ; Fri, 7 Aug 2015 17:29:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7066B6E06A; Fri, 7 Aug 2015 10:29:29 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9A2676E06A for ; Fri, 7 Aug 2015 10:29:27 -0700 (PDT) Received: by wijp15 with SMTP id p15so67929909wij.0 for ; Fri, 07 Aug 2015 10:29:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8d0gmwfWAyzDLY7vIXHN0LElQbmx/qJAhP8f9h5Wrps=; b=bTRy2AFVQmlJymR0PLE9e40tYgYW3DaUwPSDaCIenS1hsn+zLQMpm9ZfOgwKurQbBx RldQTC31Njksuu5ZyatsvMqM4rQgOatFi9mqnSuwj3WzX3/LUjGqW1LZWJaRiJpQ0WUe CcqEggDRphS0UPZ8swYDSsRazQlRwFe4HaNE0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8d0gmwfWAyzDLY7vIXHN0LElQbmx/qJAhP8f9h5Wrps=; b=ic6KwUvaCS7g+eYBF3HCUEUneFLym/blPFvQQs/FpqTGMwu6ENl+n03/qp1vYNLLH5 gTjcARglTwTS6Z7/veUYuAmbWYjf8i16o7TkZSbQMa6r6Es/JZfu6QsYyknmfmTfIJjX 7KlsSnfZZm6fuRUabEcItVO9r0P+PK8MSQxzsaQWOZ+HHTiqnJlyRDvTncj6La146PQp pXw6sG2zpHVP/buH0R5XTOjP/YuNq8Xlv1k8QHpX4cet1M+yyNgNS4Hc0txVQ5ICGCL7 YZEW8ed+q9SRkscJQFiifdXPOD5cPHjlad4cn871aJ6/WNOtNbAH6uMO0GnTmYlZYfQa xXfg== X-Gm-Message-State: ALoCoQlLCjtSAptlbfDbtX08IigXY4/bCb+dlsZXgstjq8D3CTt9FzXAWLR82Lq2FSc2ZJonRvmh X-Received: by 10.194.122.200 with SMTP id lu8mr16227769wjb.83.1438968566049; Fri, 07 Aug 2015 10:29:26 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id fo1sm9406056wib.24.2015.08.07.10.29.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Aug 2015 10:29:25 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Fri, 7 Aug 2015 19:29:17 +0200 Message-Id: <1438968558-1036-2-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1438968558-1036-1-git-send-email-daniel.vetter@ffwll.ch> References: <1438968558-1036-1-git-send-email-daniel.vetter@ffwll.ch> Cc: Daniel Vetter , Daniel Vetter Subject: [Intel-gfx] [PATCH i-g-t 2/3] lib/core: Add igt_reset_timeout X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Convenience wrapper suggested by Chris for igt_set_timeout(0, NULL). v2: While at it add an empty line in kms_flip to make set/reset_timeout a visual block. Cc: Chris Wilson Signed-off-by: Daniel Vetter --- lib/igt_core.c | 14 +++++++++++++- lib/igt_core.h | 2 ++ lib/igt_debugfs.c | 2 +- tests/kms_flip.c | 3 ++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/igt_core.c b/lib/igt_core.c index e2c2502bd147..c70176fb4962 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -1771,7 +1771,8 @@ static void igt_alarm_handler(int signal) * marked as failed. * * Any previous timer is cancelled and no timeout is scheduled if @seconds is - * zero. + * zero. But for clarity the timeout set with this function should be cleared + * with igt_reset_timeout(). */ void igt_set_timeout(unsigned int seconds, const char *op) @@ -1792,6 +1793,17 @@ void igt_set_timeout(unsigned int seconds, alarm(seconds); } +/** + * igt_reset_timeout - reset timeout to default + * + * This function resets a timeout set by igt_set_timeout() and disables any + * timer set up by the former function. + */ +void igt_reset_timeout(void) +{ + igt_set_timeout(0, NULL); +} + FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir, const char* filename) { diff --git a/lib/igt_core.h b/lib/igt_core.h index 1a324ee85514..1d77f4528dea 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -735,6 +735,8 @@ extern enum igt_log_level igt_log_level; void igt_set_timeout(unsigned int seconds, const char *op); +void igt_reset_timeout(void); + FILE *__igt_fopen_data(const char* igt_srcdir, const char* igt_datadir, const char* filename); /** diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index 6180a2aa56db..3cbc981d684c 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -465,7 +465,7 @@ static bool read_one_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out) igt_set_timeout(5, "CRC reading"); bytes_read = read(pipe_crc->crc_fd, &buf, pipe_crc->line_len); - igt_set_timeout(0, NULL); + igt_reset_timeout(); igt_assert_eq(bytes_read, pipe_crc->line_len); buf[bytes_read] = '\0'; diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 214cd696fd2f..a595d9f1d69f 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -1616,7 +1616,8 @@ static void test_nonblocking_read(int in) igt_set_timeout(5, "Nonblocking DRM fd reading"); ret = read(fd, buffer, sizeof(buffer)); - igt_set_timeout(0, NULL); + igt_reset_timeout(); + igt_assert_eq(ret, -1); igt_assert_eq(errno, EAGAIN);