From patchwork Tue Jun 5 23:45:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Gilling X-Patchwork-Id: 9134 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 69E7823E5A for ; Tue, 5 Jun 2012 23:47:10 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 230FCA189DB for ; Tue, 5 Jun 2012 23:47:10 +0000 (UTC) Received: by yhpp61 with SMTP id p61so4964199yhp.11 for ; Tue, 05 Jun 2012 16:47:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to :date:message-id:x-mailer:in-reply-to:references:subject:x-beenthere :x-mailman-version:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-gm-message-state; bh=gADwfiLvXBDJdFlrfkEsCNIdaWnqlnJb7cMys7J0e3E=; b=Tx8YS+kedcTse+Kg5m/3JfXpmQXi5CnR5DYq0zHZRlqxjVyBkZPx2qA2HDzHM3FPl/ 7jyrfrtDs5741naDhosYaLYcGWt4nTzMFTFPI91yWOu+8D/OCKgoOQBcf968//uRrcAh 3FC7725M7XWsgfqt1LGUKxRTNts/8HOgbQgi2q/9j10FQIYCqdRGltJZ0PJKnF8ZXk+w xc1dmmTKJEFbztHAsMqCk5l7+L4Ksqiqike66i9aEWlhycW0f/V2/Knqn9MfBWah0hP7 vPy8YDBvosBj/Pk61979hKW0dfQGZpKXwHolCnnSnPd8lvOEwjOlY+j+D7d1l9D3ntZ5 /sQw== Received: by 10.50.193.196 with SMTP id hq4mr4773986igc.57.1338940029278; Tue, 05 Jun 2012 16:47:09 -0700 (PDT) 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.231.24.148 with SMTP id v20csp52421ibb; Tue, 5 Jun 2012 16:47:08 -0700 (PDT) Received: by 10.68.204.2 with SMTP id ku2mr53260714pbc.55.1338940028522; Tue, 05 Jun 2012 16:47:08 -0700 (PDT) Received: from mombin.canonical.com (mombin.canonical.com. [91.189.95.16]) by mx.google.com with ESMTP id nm7si32260pbc.88.2012.06.05.16.47.06; Tue, 05 Jun 2012 16:47:08 -0700 (PDT) Received-SPF: neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) client-ip=91.189.95.16; Authentication-Results: mx.google.com; spf=neutral (google.com: 91.189.95.16 is neither permitted nor denied by best guess record for domain of linaro-mm-sig-bounces@lists.linaro.org) smtp.mail=linaro-mm-sig-bounces@lists.linaro.org Received: from localhost ([127.0.0.1] helo=mombin.canonical.com) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Sc3SV-0005pG-HR; Tue, 05 Jun 2012 23:46:44 +0000 Received: from mail-vc0-f202.google.com ([209.85.220.202]) by mombin.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Sc3Rx-0005hc-8f for linaro-mm-sig@lists.linaro.org; Tue, 05 Jun 2012 23:46:09 +0000 Received: by vcbfl13 with SMTP id fl13so655544vcb.1 for ; Tue, 05 Jun 2012 16:46:08 -0700 (PDT) Received: by 10.101.11.39 with SMTP id o39mr8255430ani.7.1338939968579; Tue, 05 Jun 2012 16:46:08 -0700 (PDT) Received: by 10.101.11.39 with SMTP id o39mr8255424ani.7.1338939968528; Tue, 05 Jun 2012 16:46:08 -0700 (PDT) Received: from wpzn4.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id p72si2013590yhh.1.2012.06.05.16.46.08 (version=TLSv1/SSLv3 cipher=AES128-SHA); Tue, 05 Jun 2012 16:46:08 -0700 (PDT) Received: from dirtysouth.mtv.corp.google.com (dirtysouth.mtv.corp.google.com [172.18.104.93]) by wpzn4.hot.corp.google.com (Postfix) with ESMTP id 6C5921E004D; Tue, 5 Jun 2012 16:46:08 -0700 (PDT) Received: by dirtysouth.mtv.corp.google.com (Postfix, from userid 94083) id 1EA2840EB9; Tue, 5 Jun 2012 16:46:08 -0700 (PDT) From: Erik Gilling To: linaro-mm-sig@lists.linaro.org Date: Tue, 5 Jun 2012 16:45:53 -0700 Message-Id: <1338939956-17312-9-git-send-email-konkers@android.com> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1338939956-17312-1-git-send-email-konkers@android.com> References: <1338939956-17312-1-git-send-email-konkers@android.com> Subject: [Linaro-mm-sig] [RFC 08/11] sync: add poll support X-BeenThere: linaro-mm-sig@lists.linaro.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Unified memory management interest group." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linaro-mm-sig-bounces@lists.linaro.org Errors-To: linaro-mm-sig-bounces@lists.linaro.org X-Gm-Message-State: ALoCoQnXdNaRqGkbiL1nWMpuhPfQBAMDm8Bk3QnJSx9gbQa/Mw+hqEXckbUla/QtH15OGIJ2xoMP Allows userspace processes to asynchronously wait on fences. Signed-off-by: Erik Gilling --- drivers/base/sync.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/drivers/base/sync.c b/drivers/base/sync.c index 80749ec..cc40e4c 100644 --- a/drivers/base/sync.c +++ b/drivers/base/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) { __u32 value;