Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp407093ybk; Wed, 20 May 2020 02:42:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxH2SsofZlUHWSuGS+2ohYgzxDxdH+pSDcNksE930bVbxFOCiga42AzhAX9yM43QQr0/6ew X-Received: by 2002:a17:906:474f:: with SMTP id j15mr2885168ejs.58.1589967727851; Wed, 20 May 2020 02:42:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589967727; cv=none; d=google.com; s=arc-20160816; b=RS4i42AJkXQ6ExKiFXQJxxdE061vSJzU+ksCJ9t4f9CiKdb/7EJBxOTrFrO5gOPeBL ZZZTu3RAsfZPeNpxeU0FyE+MxQ+GYpHQV1U8MPkI9CsvotDAnjt49McE8tjFuTt2M4e5 lfCQ/bHGyUHXmnvLcnihms7/tup1UEA16K0bQ1mDux4SPivZ/QWWouYAM4oCmuQBa4ke HG5Ea8lJKCfreZF9g0KRIyD/m/DXSlF0mI9iHT/M9bZsKpdk4bCnCY90bfv6C6rhO/Hi 2dCXxEBV3K08PABXS5anlvm1CI4e0Yb8CTj2xx0QjHGrH9Jf0I6TligXi0s4pY/Ju1/z HwWg== 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=fdobeCzI/CD22Nkbsx1/8R3yNurmmcLKoiifkI1dTwM=; b=OS3NFeo810Mjp+ZjhC5tje5/VSBEGf/qIYVYg336BqX2/Ex/9j3R1wE4Z/+yYFnviU 5JZaAp59YNyKTCW2dPOp7SxJ/0NWNgF7kVWppbHkmqrtnRiT+Ctt+3n7CqtJ3q27hmF4 AbrglvyXIcLoCwfg34TsW9p4WtWrFmFCwP6auihcbUCmspw8i42AI+yFn7b+fdxjfFaF 1+LAqocU6MySSzn1s3eiH9/Alnf5GAm0dhpWndzhDrA1J9b5Z95BhHfdMfbUIrdNB9iS GdxfcrvxLhBB0kgcULM1xDE5p6IhPP6v1mOUNRhSbqOS4p8G2g+s2sw1daqpAI/Y0NgB R6Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=beG3vlgH; 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 n23si1422105ejr.457.2020.05.20.02.41.45; Wed, 20 May 2020 02:42:07 -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=beG3vlgH; 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 S1726839AbgETJkT (ORCPT + 99 others); Wed, 20 May 2020 05:40:19 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:21941 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726821AbgETJkS (ORCPT ); Wed, 20 May 2020 05:40:18 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1589967617; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=fdobeCzI/CD22Nkbsx1/8R3yNurmmcLKoiifkI1dTwM=; b=beG3vlgHoOs7vO/gZPC6vIaB9XR3JyYvfEgp9BD+1UBe2yfn1YT71QXmMh0E+0jrJtgjA+HY kdd8A/bgxqA9oCAVIMIElAhaFqkLwbM2nVrwvmJWgBZ74ODQgPuMZ+g9p48qyvqrwiKG1tHY OChHulskT9l1EI8JhJ1RMlxIPoc= X-Mailgun-Sending-Ip: 104.130.122.26 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 5ec4faf7.7f8ac7368148-smtp-out-n01; Wed, 20 May 2020 09:40:07 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id A8073C433CA; Wed, 20 May 2020 09:40:06 +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 1D43DC43387; Wed, 20 May 2020 09:40:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1D43DC43387 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 V6 3/5] rpmsg: glink: Add support for rpmsg glink chrdev Date: Wed, 20 May 2020 15:09:37 +0530 Message-Id: <1589967579-15559-4-git-send-email-aneela@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589967579-15559-1-git-send-email-aneela@codeaurora.org> References: <1589967579-15559-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 | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index ea2f33f..b85433c 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -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