Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp64820ybc; Fri, 22 Nov 2019 02:07:37 -0800 (PST) X-Google-Smtp-Source: APXvYqzLyRrqSAr6e05VzxtLKaJcqp8gJoo94dI58ISm8V3Eh04IY3uU7xR+ZAkIdv+MxHxgIMUu X-Received: by 2002:a17:906:d96e:: with SMTP id rp14mr20825090ejb.14.1574417257658; Fri, 22 Nov 2019 02:07:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574417257; cv=none; d=google.com; s=arc-20160816; b=BEetKKTjaHERzagW4qOsjvJVmBmqk3Mao5yzfAjXk1NN1uKdPijv01Jai0rY6O3RZm khou7k55xEMSX2+ILnx+gigBIb/TGSHkSD3Go2CdTPDWlx3kbrb+4p/RWBla7NXX6a9Q 2Nd7tmMg3QEx965AT6QC+cQy5/Kw6Gx91ZqeNXmhIx303Z0h2RSGeP7HtwGJWZM1XqZJ bn6vjncJ/rA/RgKrfEEa9ApdO9FySCPU4N47p8NiyboGwBwHSovLyB0UTDOxbHQiW9Vy VG9kbs6vgZoJ/ajPVZpz0UnfrxGR4TsrrjHCd35v8coZ1p4SHAOGqUz/XJIEOKO3epGe G8zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:references:in-reply-to :message-id:date:subject:cc:to:from:dmarc-filter:dkim-signature :dkim-signature; bh=DG8kz/kG5a/4plAL4sGGURT5LnkIeY5TQKNi6igxP0Q=; b=UBeL+kHSDwvngK8fCZj+ddZwmFhQIJe7g/MTYrV58FsKO9jVczCBOXpIUOmfgXwgJ4 q1ek8Zn7oQK/I9PubQUwluqwAWNdPcyjYLq0TAeNusB2g3kTq9osef64sNQkeET2H/FR y4uqCF91AmyOUCP9pMEkHOcD03c9pjCAS0kjLoQU25Ep+Ap0409znZwvshQmjpG0THNT OHUP4moyUifJ4et973HS+M8QsO7oHd2QVkBnYl9/ojti9dCZAmW55+RFdpgcZq3MX86c 4sCcxE0bKb4+StGOo44UtT7NazKrEf+MaLAFp6DFnp0E325EOq4tKJ91ZYFd8E3lOp/e YSBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=zsmsymrwgfyinv5wlfyidntwsjeeldzt header.b=Q0cn3i6X; dkim=pass header.i=@amazonses.com header.s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx header.b=QcN65piO; 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 b53si4724602edb.419.2019.11.22.02.07.12; Fri, 22 Nov 2019 02:07:37 -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=@codeaurora.org header.s=zsmsymrwgfyinv5wlfyidntwsjeeldzt header.b=Q0cn3i6X; dkim=pass header.i=@amazonses.com header.s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx header.b=QcN65piO; 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 S1727110AbfKVKFV (ORCPT + 99 others); Fri, 22 Nov 2019 05:05:21 -0500 Received: from a27-21.smtp-out.us-west-2.amazonses.com ([54.240.27.21]:59840 "EHLO a27-21.smtp-out.us-west-2.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbfKVKFU (ORCPT ); Fri, 22 Nov 2019 05:05:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=zsmsymrwgfyinv5wlfyidntwsjeeldzt; d=codeaurora.org; t=1574417119; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; bh=1Kt+Xv8ET8+a4J4BrxOck/hJNtL4dX6RiaqgbkB0ekg=; b=Q0cn3i6X9o385NNyG2G71VKNGavw3C8Io3PpXtxapcksJkQPOs7LqpgpbFFi5yrE +QxE7t4Ab6tWPZMbaU4fGvyWCsZW9QQ1zCFapSAQRJtUbmgIbQEBw7rK/zO/7nhgOAT 6D3KDq52D9Bv2B4XWg6DKg5IZX2dAJKCIsdHYiw4= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=gdwg2y3kokkkj5a55z2ilkup5wp5hhxx; d=amazonses.com; t=1574417119; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Feedback-ID; bh=1Kt+Xv8ET8+a4J4BrxOck/hJNtL4dX6RiaqgbkB0ekg=; b=QcN65piOAEfZy+qmCGshkFgFaqTy26EQb3qOBTZZ9OCORJLDRI3tTO1G8WhWB+Nd JRTw9S0zqE9TfTPznWG6FqBLZki52kXhBWHGF+CSWvVMVlfcF22Ic4/dR2ra0uoOJ8P ANSA8qYG+c3t6eMR5U+p+CDgUYI5bXqfT1MtHWAY= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 03E3FC48B2F Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.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 , Andy Gross , linux-arm-msm@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT) Subject: [PATCH V5 3/5] rpmsg: glink: Add support for rpmsg glink chrdev Date: Fri, 22 Nov 2019 10:05:19 +0000 Message-ID: <0101016e9292b923-a011a502-1986-4cc7-8b3f-05119cd27c90-000000@us-west-2.amazonses.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1574417087-27594-1-git-send-email-aneela@codeaurora.org> References: <1574417087-27594-1-git-send-email-aneela@codeaurora.org> X-SES-Outgoing: 2019.11.22-54.240.27.21 Feedback-ID: 1.us-west-2.CZuq2qbDmUIuT3qdvXlRHZZCpfZqZ4GtG9v3VKgRyF0=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Lew RPMSG provides a char device interface to userspace. Probe the rpmsg chrdev channel to enable the rpmsg_ctrl device creation on glink transports. Signed-off-by: Chris Lew Signed-off-by: Arun Kumar Neelakantam --- drivers/rpmsg/qcom_glink_native.c | 40 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 609a150f..c838c19 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1158,7 +1158,7 @@ static int qcom_glink_announce_create(struct rpmsg_device *rpdev) __be32 *val = defaults; int size; - if (glink->intentless) + if (glink->intentless || !completion_done(&channel->open_ack)) return 0; prop = of_find_property(np, "qcom,intents", NULL); @@ -1544,6 +1544,40 @@ static void qcom_glink_work(struct work_struct *work) } } +static void qcom_glink_device_release(struct device *dev) +{ + struct rpmsg_device *rpdev = to_rpmsg_device(dev); + struct glink_channel *channel = to_glink_channel(rpdev->ept); + + /* Release qcom_glink_alloc_channel() reference */ + kref_put(&channel->refcount, qcom_glink_channel_release); + kfree(rpdev); +} + +static int qcom_glink_create_chrdev(struct qcom_glink *glink) +{ + struct rpmsg_device *rpdev; + struct glink_channel *channel; + + rpdev = kzalloc(sizeof(*rpdev), GFP_KERNEL); + if (!rpdev) + return -ENOMEM; + + channel = qcom_glink_alloc_channel(glink, "rpmsg_chrdev"); + if (IS_ERR(channel)) { + kfree(rpdev); + return PTR_ERR(channel); + } + channel->rpdev = rpdev; + + rpdev->ept = &channel->ept; + rpdev->ops = &glink_device_ops; + rpdev->dev.parent = glink->dev; + rpdev->dev.release = qcom_glink_device_release; + + return rpmsg_chrdev_register_device(rpdev); +} + struct qcom_glink *qcom_glink_native_probe(struct device *dev, unsigned long features, struct qcom_glink_pipe *rx, @@ -1603,6 +1637,10 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev, if (ret) return ERR_PTR(ret); + ret = qcom_glink_create_chrdev(glink); + if (ret) + dev_err(glink->dev, "failed to register chrdev\n"); + return glink; } EXPORT_SYMBOL_GPL(qcom_glink_native_probe); -- 1.9.1