From patchwork Fri Mar 1 00:43:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 2201501 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id D2EDA3FCA4 for ; Fri, 1 Mar 2013 12:39:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BB01EE6306 for ; Fri, 1 Mar 2013 04:39:28 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by gabe.freedesktop.org (Postfix) with ESMTP id 32096E5F01 for ; Thu, 28 Feb 2013 16:43:52 -0800 (PST) Received: by mail-pa0-f51.google.com with SMTP id hz1so1447679pad.24 for ; Thu, 28 Feb 2013 16:43:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=+NyfKnauMtGKdGmnzL0OuLiy46qAPTZOXDdGylfY+vY=; b=QuyBNrZVcl0Ru1gifImSogMLWztW8PWLXjpAQI0zbGvwIf/DfQu8G1k+FtnBMJzbf+ dCQdLMkiREPyBL4ngMrm8GEOd1srxAQM2gelsmcusnL/TwC9XHoS3DCc8g9HgDG5df1C qltp0qQjiRMEkcLvPorua1Kxw0VsFzn0Tjf91g+cFkxGQiacDUzRhI+C8HnqtJ3jQKjN IPhlX30WILMtKwZNUsw/+61Lz3YiwyZTb5fX1mdvNjaQTArR1YePzO2nCdpKWD7p+GN8 S1cWvdRaLyqfeUQzGlgdgBYk6cX011YeXbmAMnVM6SL3up1RtTwSA1hOL5RinLHN3J14 a5uw== X-Received: by 10.66.8.3 with SMTP id n3mr16122729paa.216.1362098632172; Thu, 28 Feb 2013 16:43:52 -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.43.50 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Feb 2013 16:43:51 -0800 (PST) From: John Stultz To: lkml Subject: [PATCH 08/30] staging: sync: Add poll support Date: Thu, 28 Feb 2013 16:43:04 -0800 Message-Id: <1362098606-26469-9-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: ALoCoQm8OGeeJ01eswlxIo3sBrPU4tOB/D2Eca37iZ8XNviB6IpRR21KFxRRS1gJG0nIt3nfHI2Z X-Mailman-Approved-At: Fri, 01 Mar 2013 04:21:18 -0800 Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, Rob Clark , John Stultz , Greg KH , Android Kernel Team X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Erik Gilling Support poll on sync fence 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: Add commit message] Signed-off-by: John Stultz --- drivers/staging/android/sync.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index f84caad..9e35ea3 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -221,12 +222,14 @@ out: } static int sync_fence_release(struct inode *inode, struct file *file); +static unsigned int sync_fence_poll(struct file *file, poll_table *wait); static long sync_fence_ioctl(struct file *file, unsigned int cmd, unsigned long arg); static const struct file_operations sync_fence_fops = { .release = sync_fence_release, + .poll = sync_fence_poll, .unlocked_ioctl = sync_fence_ioctl, }; @@ -497,6 +500,20 @@ static int sync_fence_release(struct inode *inode, struct file *file) return 0; } +static unsigned int sync_fence_poll(struct file *file, poll_table *wait) +{ + struct sync_fence *fence = file->private_data; + + poll_wait(file, &fence->wq, wait); + + if (fence->status == 1) + return POLLIN; + else if (fence->status < 0) + return POLLERR; + else + return 0; +} + static long sync_fence_ioctl_wait(struct sync_fence *fence, unsigned long arg) { __s32 value;