Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp993115imm; Thu, 4 Oct 2018 06:42:40 -0700 (PDT) X-Google-Smtp-Source: ACcGV62w8s8lohQSRsyzYyaQWs1fck0OGek17jwHYyMQ8hVOSw/uQyDb16L8VOsQBD6Xn/CnH9mp X-Received: by 2002:a17:902:6b06:: with SMTP id o6-v6mr6571781plk.6.1538660560626; Thu, 04 Oct 2018 06:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538660560; cv=none; d=google.com; s=arc-20160816; b=loUjvyQbIafHISPqy08PspLLbrxFDhuy2moWW/ew9orOHfhWXcTpw8rUCpjeJJSw6a oUsBDO9/zbZ7qCR9CuwNfl83j7nAEIzBVnKk1ufwg61ttB7eFMox310To9HB5Q8VWwgu bj3fQifX+HW3NcGB+VvsGsZHs3H1J8tSTzwe8X3SuAtBjkaGYzGyulHg5GOkRUUEaKxj k+yoylnV2kYOtOTrXtYe4U2OILBEbbymc+Y2qxS4lTKewOS7PY4X4yrzgj9MhLuzYE47 zAmpnhFd7nCLuQKhEK/zJTxVaG31tfqRz+UiOo2LX759nHgLGXFeFfutCEFX07B32F7N ksLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature; bh=3ODkgncrxvFEddOIvYpNbEnifCIr5u9RsfAXrsdBwUw=; b=vv746tUKoFJbjKKPRB/0hqKbg3BcZR/Ha+Iz9W2Pu5VZk7oiIKrS2KdqrrB8qV4O9x N9Yvu2zBlT1sJMOcOm636tVo6Lp9291KtS0KkDhC0Y7/hGj39gnDGZxHd/1hWXaotm50 cE8LDu5OG6UCa2oYQmYVngRaMYjiY7xdTgO1xnopx3gZlwsQoGko7iLp9kxY7ckSy6c9 Q3AprG4D6LzPKXU3qam/4IcGCxr2HhBhGOikTWyu8zv6RUAZ9HGfktI0oBPD/TzjdZPE ztmnegavACz+rWGoRkeZhNwa1K70HwcMsItg7+8+GKfsd3PWI/gNmVerltyBhvzPDtGZ /3ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Jlq5Eoho; dkim=pass header.i=@codeaurora.org header.s=default header.b=WXfjZpLg; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20-v6si5409855plj.261.2018.10.04.06.42.25; Thu, 04 Oct 2018 06:42:40 -0700 (PDT) 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=@codeaurora.org header.s=default header.b=Jlq5Eoho; dkim=pass header.i=@codeaurora.org header.s=default header.b=WXfjZpLg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727685AbeJDUeL (ORCPT + 99 others); Thu, 4 Oct 2018 16:34:11 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42956 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727264AbeJDUeK (ORCPT ); Thu, 4 Oct 2018 16:34:10 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5B72960C87; Thu, 4 Oct 2018 13:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538660448; bh=Z/w2FwMWEx6h/lpCzvRLbqrpyG+YBx6cri+tPB+026w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jlq5EohoC9atxlZbqNq/tj236rnmpUv3PZ1xnOb3qRPQqCMRmpk5VvfWlEu9sClpB 3a1Cvg2QIT7ZOf0uZHTAAXnpJdPCXgYax31vP1cmblsBVE+Frig102Wt63uguqSVFz mWapnjN5zYGk/5VI/px70Zj+3eysgOSevu6htgTA= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from aneelaka-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: aneela@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2358860C8C; Thu, 4 Oct 2018 13:40:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538660447; bh=Z/w2FwMWEx6h/lpCzvRLbqrpyG+YBx6cri+tPB+026w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WXfjZpLgCrPyO3CKw/TnKL0tLuS99jTHke0+L3bUSR0Jw0/nqH//ac9CwqFykeD/l 1V3yZQ1wRxarEPsbn+KW2O19Ws5ueb0h3qUOI5S4fYVyy4POoqQfqku4wfhzyphFap yIdzj40GSMVP9hhxevJuYe71c07Q8nuFcYvGZUNU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2358860C8C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=aneela@codeaurora.org From: Arun Kumar Neelakantam To: ohad@wizery.com, bjorn.andersson@linaro.org, clew@codeaurora.org, sricharan@codeaurora.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Arun Kumar Neelakantam Subject: [PATCH V2 4/4] rpmsg: char: Add signal callback and POLLPRI support Date: Thu, 4 Oct 2018 19:10:20 +0530 Message-Id: <1538660420-27797-5-git-send-email-aneela@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1538660420-27797-1-git-send-email-aneela@codeaurora.org> References: <1538660420-27797-1-git-send-email-aneela@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Register a callback to get the signal notifications from rpmsg and send POLLPRI mask to indicate the signal change in POLL system call. Signed-off-by: Arun Kumar Neelakantam --- drivers/rpmsg/rpmsg_char.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c index 9380c6e..194d54a 100644 --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -64,6 +64,7 @@ struct rpmsg_ctrldev { * @queue_lock: synchronization of @queue operations * @queue: incoming message queue * @readq: wait object for incoming queue + * @sig_pending:state of signal notification */ struct rpmsg_eptdev { struct device dev; @@ -78,6 +79,8 @@ struct rpmsg_eptdev { spinlock_t queue_lock; struct sk_buff_head queue; wait_queue_head_t readq; + + bool sig_pending; }; static int rpmsg_eptdev_destroy(struct device *dev, void *data) @@ -122,6 +125,18 @@ static int rpmsg_ept_cb(struct rpmsg_device *rpdev, void *buf, int len, return 0; } +static int rpmsg_sigs_cb(struct rpmsg_device *rpdev, void *priv, + u32 old, u32 new) +{ + struct rpmsg_eptdev *eptdev = priv; + + eptdev->sig_pending = true; + + /* wake up any blocking processes, waiting for signal notification */ + wake_up_interruptible(&eptdev->readq); + return 0; +} + static int rpmsg_eptdev_open(struct inode *inode, struct file *filp) { struct rpmsg_eptdev *eptdev = cdev_to_eptdev(inode->i_cdev); @@ -138,6 +153,7 @@ static int rpmsg_eptdev_open(struct inode *inode, struct file *filp) return -EINVAL; } + ept->sig_cb = rpmsg_sigs_cb; eptdev->ept = ept; filp->private_data = eptdev; @@ -157,6 +173,7 @@ static int rpmsg_eptdev_release(struct inode *inode, struct file *filp) eptdev->ept = NULL; } mutex_unlock(&eptdev->ept_lock); + eptdev->sig_pending = false; /* Discard all SKBs */ while (!skb_queue_empty(&eptdev->queue)) { @@ -263,6 +280,9 @@ static __poll_t rpmsg_eptdev_poll(struct file *filp, poll_table *wait) if (!skb_queue_empty(&eptdev->queue)) mask |= EPOLLIN | EPOLLRDNORM; + if (eptdev->sig_pending) + mask |= POLLPRI; + mask |= rpmsg_poll(eptdev->ept, filp, wait); return mask; @@ -307,6 +327,7 @@ static long rpmsg_eptdev_ioctl(struct file *fp, unsigned int cmd, switch (cmd) { case TIOCMGET: + eptdev->sig_pending = false; ret = rpmsg_get_signals(eptdev->ept, &lsigs, &rsigs); if (!ret) ret = put_user(rsigs, (int __user *)arg); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project