Received: by 10.192.165.148 with SMTP id m20csp1439079imm; Wed, 25 Apr 2018 19:11:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx48RRLuNAE4mE9TqjoJ70A4fByNW/ssvcGDqnREOvXzVKL+ER5xwAKrWjL1YfCdile3QwnDE X-Received: by 10.99.181.30 with SMTP id y30mr23460346pge.279.1524708704379; Wed, 25 Apr 2018 19:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524708704; cv=none; d=google.com; s=arc-20160816; b=hayUYFoqnpLoK2A46v28AdO8Mf0DpAx4gPn4jzJkhOk5j2rABHoLWciow3gDB01o3E 1f8REAmC3q2BHakZfC1gzLZOWn4WdglqsNnwqjT/PwW2J8etad1nhIWD2BuNNY5JmNsi 4nPMxIOEuh9guY9vheVJJU9wxtdmOPu8eLl34Yg9A5jAZO8oyledwESrCQk6KrZ7TBZd gSJfutXxPbxYoc4LCF74eRVZe5Wz118LYP80gOH467tqQgdQ0zPNWv+prtEkn4yx88Jl LLGVTxXi3u7D8Vp5hNGAxZu7oeiP8sAOxYPrNKtjUt0aawi4eLQlSgjM4wSHVOVr7DCU Z8tA== 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 :arc-authentication-results; bh=+P5so/Z7tPEkl7VxqHNW4E1JcfhMQ3KMExrPzfU12XY=; b=03N99uaBa/DSNwQhwPZexMV4ydhwPjjsHnns/2rRWHq/gqGM5e34iHsKWcHZn9Hmrv y8OC32hgAejxAqY1ZIpRG6h0/LMULhIW/1U9lees4Q/t0uwxwipPWRxMFgzlADi42ulC S9ge1cS0uNXfi8IbefTw53h/LtdoruAxQqxuPfM5+cWJRCI78o2BntrsTsj/hsyLibg+ A7l+DuZLZpmn8oXBEmuMU9ysb7kEsZEg9Yr1ZlRd1j/zpY3f4VlOOoRDCWQLaJ7Qo/Sg dPsZsj7p9FjTjx/odkV0KnLn3Eeu11vZTWxKe8S02gKT8IZf87rvaU6Cp9I4gMHjkm1Q K+jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=OSXo/c3k; dkim=pass header.i=@codeaurora.org header.s=default header.b=ocC5i+3V; 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 g15-v6si19073709pln.526.2018.04.25.19.11.30; Wed, 25 Apr 2018 19:11:44 -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=OSXo/c3k; dkim=pass header.i=@codeaurora.org header.s=default header.b=ocC5i+3V; 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 S1754129AbeDZCJz (ORCPT + 99 others); Wed, 25 Apr 2018 22:09:55 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:44454 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752455AbeDZCIn (ORCPT ); Wed, 25 Apr 2018 22:08:43 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3E1D460FAA; Thu, 26 Apr 2018 02:08:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524708523; bh=gBNq7CPMXI5mKPGKVEfvnz7ABvtYh3xEj+J9UbKqPsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OSXo/c3k3eytJffvwCHe3Wxg2B+6YldIjurMPEPF+ATbG0S6X1Zrotq9C4vtxDXsX fLmw/N6kQhgruGCAQP/wlC4JJGoVIzK4SdYcn3ZJcP3Nki8iONUBtDBIV1KRtBirmy tPu9IxKaLr1lFXj2om4yI6guTlUQJ85Ht2mJfzDQ= 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.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from clew-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: clew@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 157BC60FAA; Thu, 26 Apr 2018 02:08:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524708522; bh=gBNq7CPMXI5mKPGKVEfvnz7ABvtYh3xEj+J9UbKqPsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ocC5i+3VqF6b0/HDGKzEgkIICy3vJPwPHHpU+OACEFHJ/lh4gGqY+dn8dDKPLW5f6 OeZMnhr28Qq4OSred9qRjE6ms2f63ZItDjKEFx3sYfsxz9g5J4uEp4g3J/HPFRGeO6 kI6VaSyYxVzOFJfvM2LiWSvKz9uLD0eUfCSXbwfc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 157BC60FAA 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=clew@codeaurora.org From: Chris Lew To: bjorn.andersson@linaro.org, andy.gross@linaro.org, david.brown@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com Cc: aneela@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, clew@codeaurora.org Subject: [PATCH v2 5/6] rpmsg: glink: Add support for rpmsg glink chrdev Date: Wed, 25 Apr 2018 19:07:51 -0700 Message-Id: <1524708472-18263-6-git-send-email-clew@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524708472-18263-1-git-send-email-clew@codeaurora.org> References: <1524708472-18263-1-git-send-email-clew@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Changes since v1: - Use qcom_glink_alloc_channel to create the chrdev rpmsg device 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 120d6b9bb9f3..1418926f6110 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1166,7 +1166,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); @@ -1552,6 +1552,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, @@ -1611,6 +1645,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); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project