From patchwork Wed Jan 11 14:35:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 91003 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1348343qgi; Wed, 11 Jan 2017 14:35:04 -0800 (PST) X-Received: by 10.99.167.15 with SMTP id d15mr13489608pgf.167.1484174104442; Wed, 11 Jan 2017 14:35:04 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si7074154pfg.122.2017.01.11.14.35.04; Wed, 11 Jan 2017 14:35:04 -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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758366AbdAKWeo (ORCPT + 25 others); Wed, 11 Jan 2017 17:34:44 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:33027 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757759AbdAKWej (ORCPT ); Wed, 11 Jan 2017 17:34:39 -0500 Received: by mail-pf0-f180.google.com with SMTP id y143so1106385pfb.0 for ; Wed, 11 Jan 2017 14:34:39 -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=okvr56895jXvH64FjHPeNrxml23/jaXqTOLoXtYql/A=; b=JTbthkBKLHdDwF2AHyWq82IPnp/j9ib/2sO/IxtZO8yCcuVJvoe7kIGj9UYbczntv+ 4pgX/SFIhKRxhIBD7OrW8XjBi0k5XM+JRB/8cSy2DKR46vFyr6lm5tKGI0Ym7t0kn68x ++39xhq+6hc7EiwN74yd8mPPJ6e1W8O7POTyw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=okvr56895jXvH64FjHPeNrxml23/jaXqTOLoXtYql/A=; b=Xyd2e7ZcAhOyvtvKvR7+fSXGveUANBXwnGf6yl3GWBqflZRmTvpUCcAa22GWZq2n1A 1+T1KXAqZlo3qS7ShWPbCPYXbK9ysolhCATqW/px+cS3atpqG8jXOXkR8yY+1uRnuoIq w0dhGTrXhVzrWUMiy8Nuc2tIgRj5EQq4t+/22lBRspzzWaPCYrRDR3jfGR1tRwQQg8AN Po6Tw1ipwWYRjKSfl1Sbk/nz2jnEpJthoVepAbeXS/kAAfoNOAO75YGeybyTfs/vvT97 o/mRzXaDsTDuGuUHPDJ/h7iQln49yTqBJe+iDwsmwepJaqAAKJPhGe88MICjYqMiJhLO ur2w== X-Gm-Message-State: AIkVDXLyq/P4L4jVsmeDWp0rABVLhaQXE6aJgeT4BA9iBGfyXsdljs587Ij0Uv+UE8Ihds0Y X-Received: by 10.84.225.150 with SMTP id u22mr16758016plj.157.1484174078871; Wed, 11 Jan 2017 14:34:38 -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 o89sm16128591pfi.26.2017.01.11.14.34.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 14:34:37 -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 v3 2/4] rpmsg: qcom_smd: Implement endpoint "poll" Date: Wed, 11 Jan 2017 06:35:11 -0800 Message-Id: <20170111143513.32251-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170111143513.32251-1-bjorn.andersson@linaro.org> References: <20170111143513.32251-1-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 v2: - None Changes since v1: - New patch drivers/rpmsg/qcom_smd.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.11.0 diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index 3dd73edaa525..9e2af6a18aa2 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, }; /*