From patchwork Fri Mar 1 00:43:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 15174 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CBF6823E1A for ; Fri, 1 Mar 2013 00:44:10 +0000 (UTC) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by fiordland.canonical.com (Postfix) with ESMTP id 70B50A1935F for ; Fri, 1 Mar 2013 00:44:10 +0000 (UTC) Received: by mail-vc0-f173.google.com with SMTP id fy27so1629490vcb.18 for ; Thu, 28 Feb 2013 16:44:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=T6wFJmuaVzyTkMjfczQDLJe60yH1+VAGWMx2/DNdudk=; b=FDRO+dKr3e0L2YzQiBLuPVTE3Dk7G5G4McoeqhrdjxPh9sSTd2p/x4RNRGLx2j/4gL SY+uWsltZ3bQhZWV47DGbZeBYlJenq46gXVX8zsWFjN+XbL+Dvq0ioAEvjEbN5Brag03 mTSKWNQH194jM3CXcdxCk4NwpQSenOlWedNPQE91H7Z2OC8V/fwoBrIhZiWBcjPxxw1Z OOLLsyxzr9c5aHFQpGJqvtXLJu82E83YuxuY9G5HIvDjo/exh2jhKYnMZqwrEKz5V98A 9K+OS523SPS4DaENFbbplz7KwJbE01BtqUhyhiVQBkqXryxcAgA+Ao3ycsFKh27Gk1oL R6dQ== X-Received: by 10.52.18.148 with SMTP id w20mr2946267vdd.8.1362098650003; Thu, 28 Feb 2013 16:44:10 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp659veb; Thu, 28 Feb 2013 16:44:09 -0800 (PST) X-Received: by 10.66.162.196 with SMTP id yc4mr16190373pab.137.1362098648941; Thu, 28 Feb 2013 16:44:08 -0800 (PST) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by mx.google.com with ESMTPS id si3si10305358pbc.11.2013.02.28.16.44.08 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Feb 2013 16:44:08 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.49 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.49; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.49 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) smtp.mail=john.stultz@linaro.org Received: by mail-pa0-f49.google.com with SMTP id kp6so1437162pab.8 for ; Thu, 28 Feb 2013 16:44:08 -0800 (PST) X-Received: by 10.66.102.3 with SMTP id fk3mr2343533pab.179.1362098648572; Thu, 28 Feb 2013 16:44:08 -0800 (PST) Received: from localhost.localdomain (c-24-21-54-107.hsd1.or.comcast.net. [24.21.54.107]) by mx.google.com with ESMTPS id dx17sm10914892pac.17.2013.02.28.16.44.06 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Feb 2013 16:44:07 -0800 (PST) From: John Stultz To: lkml Cc: Erik Gilling , Maarten Lankhorst , Daniel Vetter , Rob Clark , Sumit Semwal , Greg KH , dri-devel@lists.freedesktop.org, Android Kernel Team , John Stultz Subject: [PATCH 18/30] staging: sync: Change wait timeout to mirror poll semantics Date: Thu, 28 Feb 2013 16:43:14 -0800 Message-Id: <1362098606-26469-19-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1362098606-26469-1-git-send-email-john.stultz@linaro.org> References: <1362098606-26469-1-git-send-email-john.stultz@linaro.org> X-Gm-Message-State: ALoCoQn2IG3SxlFPG8yMcgtOd/p/qm+3WfzBegZYqqJhLwAlw40mcYltNA4HAndPff8POv62ElM9 From: Erik Gilling Change wait timeout to act like poll Cc: Maarten Lankhorst Cc: Erik Gilling Cc: Daniel Vetter Cc: Rob Clark Cc: Sumit Semwal Cc: Greg KH Cc: dri-devel@lists.freedesktop.org Cc: Android Kernel Team Signed-off-by: Erik Gilling [jstultz: Added commit message, squished typo-fix] Signed-off-by: John Stultz --- drivers/staging/android/sync.c | 6 +++--- drivers/staging/android/sync.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index c4a3c1d..7fccfcd 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -557,14 +557,14 @@ EXPORT_SYMBOL(sync_fence_cancel_async); int sync_fence_wait(struct sync_fence *fence, long timeout) { - int err; + int err = 0; - if (timeout) { + if (timeout > 0) { timeout = msecs_to_jiffies(timeout); err = wait_event_interruptible_timeout(fence->wq, fence->status != 0, timeout); - } else { + } else if (timeout < 0) { err = wait_event_interruptible(fence->wq, fence->status != 0); } diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index 15863a6..75ed5f1 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -329,8 +329,8 @@ int sync_fence_cancel_async(struct sync_fence *fence, * @fence: fence to wait on * @tiemout: timeout in ms * - * Wait for @fence to be signaled or have an error. Waits indefintly - * if @timeout = 0 + * Wait for @fence to be signaled or have an error. Waits indefinitely + * if @timeout < 0 */ int sync_fence_wait(struct sync_fence *fence, long timeout); @@ -389,9 +389,9 @@ struct sync_fence_info_data { /** * DOC: SYNC_IOC_WAIT - wait for a fence to signal * - * pass timeout in milliseconds. + * pass timeout in milliseconds. Waits indefinitely timeout < 0. */ -#define SYNC_IOC_WAIT _IOW(SYNC_IOC_MAGIC, 0, __u32) +#define SYNC_IOC_WAIT _IOW(SYNC_IOC_MAGIC, 0, __s32) /** * DOC: SYNC_IOC_MERGE - merge two fences