Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp251187ybk; Tue, 12 May 2020 22:14:41 -0700 (PDT) X-Google-Smtp-Source: APiQypIyT/Kq4ok1rSq/BPorGwRhKEYjsBJJQG/4NUgaqdIOQR99nRb4FBj4LCRt8aXSS4btSzvd X-Received: by 2002:a17:906:1e51:: with SMTP id i17mr20999859ejj.336.1589346881159; Tue, 12 May 2020 22:14:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589346881; cv=none; d=google.com; s=arc-20160816; b=m46CjcnzD/9iubz+vBjavl2uNKnA5pt0/SvnszMCPGcrutDFewCYnCJ9nxPyU2Ko3L GCEaQ08py6T7GRDFMe7stwqq1Mh3eISNKxKIhAF9+Grm2pDVrepp+/h8O+uSyGP1+uYm gLqzlI8/mcksrRwrWDMgWq8mt7SfsAAb1QuQ59hmzhbxrqvM6BtluZscQUnPRjBXxDl6 myy6I2DX72Xfl7EBpGv3niE0+Ej35O/J+zubb6scW3rmVKWFrTH+04YYzQ6uOH6vztQK 2Dk4dXQTH2GeO6aHSpW2fJukR5cQhNCO7WB3aoBl4daEJgQ7QrZIjLuoWN52VtsDBncb 4bIw== 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; bh=R+C+1aq3blwnm2NYrLpezZh+VhiUrAzTe3gFClI3wH8=; b=hldptaPfdFFHEKUVgzquADPKLIDXsYJ8Gl/VnssVLhp7IIPO+VJfYtfu5JQ3YnFjfk xlofxa6ay2B3dVlLyLGsPRL5tuZv/3JaYesInyIJcjkoVDnteLPImSACe6XMDjQPwTj4 xHDtwcyiwNmYHgrx3BADsgt8wQPsI5M6jPFPRRfzDV64HMIsFk5cof5TaXKn24c9+QVh 4sprmntfY0H7kagYXSSxKklHnfquQdU31EVEJJweLwE75U5wI0TQWAJUtjOO7VTpHvFi hI/fYrC76DEuOX3uViuth4UyKtun7EKrP2fLLxuQrUFe3nC+WjKq5G4OP/SjShArCEnY kiVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=vXw0XJ5d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y43si7144817ede.404.2020.05.12.22.14.17; Tue, 12 May 2020 22:14:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=vXw0XJ5d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728905AbgEMFKl (ORCPT + 99 others); Wed, 13 May 2020 01:10:41 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:17353 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728890AbgEMFKl (ORCPT ); Wed, 13 May 2020 01:10:41 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1589346640; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=R+C+1aq3blwnm2NYrLpezZh+VhiUrAzTe3gFClI3wH8=; b=vXw0XJ5dzlbfwynQ9kknwPtbXWYjV7jFTkRqOOAdXm2OTsijkKq5fgxNYgzil1WQ12zJAQEe lMC5ynu9kg96zoO2mhnz24rddek5A5Jx8lQZht8oss/eP447Ik44DKZY5Cz/GpdxBbJW7opb N3JYax575ZYQ06N4zQbyUPo23uU= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ebb8149.7f6085785458-smtp-out-n04; Wed, 13 May 2020 05:10:33 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 75056C433F2; Wed, 13 May 2020 05:10:33 +0000 (UTC) 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 autolearn=unavailable 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) by smtp.codeaurora.org (Postfix) with ESMTPSA id BF02DC43637; Wed, 13 May 2020 05:10:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BF02DC43637 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: Wed, 13 May 2020 10:40:04 +0530 Message-Id: <1589346606-15046-4-git-send-email-aneela@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589346606-15046-1-git-send-email-aneela@codeaurora.org> References: <1589346606-15046-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 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 604f11f..3a7f87c 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1178,7 +1178,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); @@ -1574,6 +1574,40 @@ static void qcom_glink_cancel_rx_work(struct qcom_glink *glink) kfree(dcmd); } +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, @@ -1633,6 +1667,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); -- 2.7.4