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: 15164 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 266BC23E1A for ; Fri, 1 Mar 2013 00:43:54 +0000 (UTC) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by fiordland.canonical.com (Postfix) with ESMTP id D0097A1935F for ; Fri, 1 Mar 2013 00:43:53 +0000 (UTC) Received: by mail-vc0-f177.google.com with SMTP id m18so1612479vcm.8 for ; Thu, 28 Feb 2013 16:43:53 -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=+NyfKnauMtGKdGmnzL0OuLiy46qAPTZOXDdGylfY+vY=; b=DqQ9Lh+yNDCY1lcs3Ojqkl9K+p5gUzT++Uw4AVEj+WlrUScWjT6BGtRHCY8ZDjBCm8 B63pJKCPrai7w+sNtpNVpeZr1w05bethZoKfnYaw5XJYi6oV4/fHzbaTpKFGVoMC9DdB YmAVJHJIspoIYSrNwAO1Hmzhlw3Y37M2CqtMJIRjSe59OucaIt+Oe7txIXY8QUcwAOd0 O3+3WhXqV7E5R9Et0OMuv84IQi+cfX+fScdFX65OFVGjnQqXq5xq1Kpg2WOB6lGp3A0i OLNwWpLNMXVoM2DFh4FroQTCf3OpIqINTnZeg2HItAmrfO8fhwC8Iawk6djGkC6xuMh7 XfYw== X-Received: by 10.52.93.235 with SMTP id cx11mr2824892vdb.51.1362098633354; Thu, 28 Feb 2013 16:43:53 -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 st5csp644veb; Thu, 28 Feb 2013 16:43:52 -0800 (PST) X-Received: by 10.66.84.232 with SMTP id c8mr15762700paz.8.1362098632543; Thu, 28 Feb 2013 16:43:52 -0800 (PST) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by mx.google.com with ESMTPS id pl3si3481445pbc.48.2013.02.28.16.43.52 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Feb 2013 16:43:52 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.47 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.47; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.47 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-f47.google.com with SMTP id bj3so1458592pad.20 for ; Thu, 28 Feb 2013 16:43:52 -0800 (PST) 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 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 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: ALoCoQmuAkGE12Sd28c10THXvV0FAtGejQYKx8viSPAYAjtMpzricJ3DUpoF8SDrub4R5mTnpgNR 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;