From patchwork Fri Dec 2 22:03:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 86375 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp464337qgi; Fri, 2 Dec 2016 14:04:35 -0800 (PST) X-Received: by 10.99.174.4 with SMTP id q4mr80917072pgf.178.1480716275217; Fri, 02 Dec 2016 14:04:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a187si6593359pge.103.2016.12.02.14.04.34; Fri, 02 Dec 2016 14:04:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755455AbcLBWEb (ORCPT + 25 others); Fri, 2 Dec 2016 17:04:31 -0500 Received: from mail-pf0-f176.google.com ([209.85.192.176]:35553 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751948AbcLBWE0 (ORCPT ); Fri, 2 Dec 2016 17:04:26 -0500 Received: by mail-pf0-f176.google.com with SMTP id i88so54412892pfk.2 for ; Fri, 02 Dec 2016 14:03:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qIjcs2RTAJTIO36xaF86nOhJMe/6ZThu/KoGGWXjYx4=; b=HjkdSaGC2w1VUD53FZo1/k/Q2FgxKavoPj4lxUS4YcBR1J/MHmUrg20/aeSaq7DPQF SnO+/Hx/Lxz/G5lmZp7mV8v8meKlPHLMk9Ls1oCihWfT7LR0kALRxjh2ns8ma4xG13MI pnPz7NGVIr5+2e5lbE+AOgwZC1zdubbZj5Z+Y= 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=qIjcs2RTAJTIO36xaF86nOhJMe/6ZThu/KoGGWXjYx4=; b=gIZ56qRCwqAKzJhOQ9Pn1ML8V36T4ssva9MpqhXzEgmiumTWyLjY33LmiurG2YZ7uP AteCtSmHYjKsGngOqGMcbLWopiXZsbr+7DS4wTAEglcFvsj2QEMgApSdfSMbHC873JiS MU0sl+ZcxucF786nAuwoFZlklVNNIQbJorvSVuWStcu8wAXu27Ly6UbbMCx19FJG3HUb ve7RbrfDog4bv8S5d3/NzFv4cEpnUbOaK6FUZ1tPeqq84whe7GRv5Bvf8n8EgWcr8zo8 vQ8Q+wKXJbzlHhJQOuxV0GGY50p3bDhAO0F9ar+pE65S9r0w0ki5nK8Ftt2IvkZND2iX EKAQ== X-Gm-Message-State: AKaTC03Dllr9Yr12Af6tP9ysGNhucY2QoWgNIP684TIiM9Fbxwemwl7++PR8Ke7pOKRC1noE X-Received: by 10.99.5.21 with SMTP id 21mr82851344pgf.32.1480716222482; Fri, 02 Dec 2016 14:03:42 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id q20sm9908719pgn.39.2016.12.02.14.03.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Dec 2016 14:03:41 -0800 (PST) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 2/4] rpmsg: qcom_smd: Implement endpoint "poll" Date: Fri, 2 Dec 2016 14:03:35 -0800 Message-Id: <1480716217-23303-2-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1480716217-23303-1-git-send-email-bjorn.andersson@linaro.org> References: <1480716217-23303-1-git-send-email-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for polling the status of the write buffer so that user space can use rpmsg character devices in non-blocking mode. Signed-off-by: Bjorn Andersson --- Changes since v1: - New patch drivers/rpmsg/qcom_smd.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.5.0 diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index 3b77320fb8c9..52c4ec570464 100644 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -919,6 +919,21 @@ static int qcom_smd_trysend(struct rpmsg_endpoint *ept, void *data, int len) return __qcom_smd_send(qsept->qsch, data, len, false); } +static unsigned int qcom_smd_poll(struct rpmsg_endpoint *ept, + struct file *filp, poll_table *wait) +{ + struct qcom_smd_endpoint *qsept = to_smd_endpoint(ept); + struct qcom_smd_channel *channel = qsept->qsch; + unsigned int mask = 0; + + poll_wait(filp, &channel->fblockread_event, wait); + + if (qcom_smd_get_tx_avail(channel) > 20) + mask |= POLLOUT | POLLWRNORM; + + return mask; +} + /* * Finds the device_node for the smd child interested in this channel. */ @@ -951,6 +966,7 @@ static const struct rpmsg_endpoint_ops qcom_smd_endpoint_ops = { .destroy_ept = qcom_smd_destroy_ept, .send = qcom_smd_send, .trysend = qcom_smd_trysend, + .poll = qcom_smd_poll, }; /*