Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp735775imm; Fri, 27 Jul 2018 05:20:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeDU/8nCIjsuM6bg+7dS6xykhTtPAdMJ1dRYljZ1OgInEwGkINJkPfLo2H7b8WCav1Ef0Yu X-Received: by 2002:a63:5922:: with SMTP id n34-v6mr5930059pgb.113.1532694012501; Fri, 27 Jul 2018 05:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532694012; cv=none; d=google.com; s=arc-20160816; b=PiKcAebe/IkmIAbfwGhKCTEYOR+E1OvrH+pRSI2HB9l01SAlCCovZx/RY99RCN7NAM H5voMzacg0USnfYV9/smawmM6csAKshjbt4yr91fjsxwmGFTj9HTNW4n/Sb9jNsRejXx 0ayy9Motz6Q81aBgqIjrMl6vmyg1DtIRLlVikRU97v6W04bqIQLmnVeYUI6hpUZtIwHZ Cv75qdDBAFmlm0L21IUHa8WzqQKaRgny5dLiIs5hsddAayXJnR37bNlcQQL5ZVp8DCuC Sw6VEiVmh4l8Ah2hXeJ0RI+5ZBi1nzLT7UTz/bkMV3RnKWDNE458B7nab8cQDKlm1d4V T39Q== 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=/8CA7gn8o2sALNLLZnurmU7GolSYzFWY2sdIFNOHkYY=; b=k5uw3HHBFPaTGxI2yRYM2vr4vE2CQM9Nt19ntCcoAlGpGKWiyAyHHqvgyA1fh8vcgU D73nMfs/tVFGQZkln11wKyo2xrYay2J0IBu7/YETMGSEHRw+5fc+9XxiQkS7sM7oAqWY L955SLJUe2euAO9vYYoCQSKG2cgVqKqa8WYz57mrGqjmCU4YBNBXf4CAe3gIy/hGhJte Tt1MsOkRp2MvwMhrGFQyA+9aKWnpyDUf6MDi9bfk+NlIR7VJaC1hdy2M25jfOXQGUpFo zkpsQLpHWbYxHBe46Gdz5WmiqYFuECCqs4akoy7QbZKgtkHCwr6Ydwr2i9/t8A80sa06 pVTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ZnMh6ors; dkim=pass header.i=@codeaurora.org header.s=default header.b=ZbEV8k2x; 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 p33-v6si3384516pld.318.2018.07.27.05.19.58; Fri, 27 Jul 2018 05:20:12 -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=ZnMh6ors; dkim=pass header.i=@codeaurora.org header.s=default header.b=ZbEV8k2x; 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 S2388652AbeG0NkX (ORCPT + 99 others); Fri, 27 Jul 2018 09:40:23 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:46266 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730488AbeG0NkW (ORCPT ); Fri, 27 Jul 2018 09:40:22 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0115D60B11; Fri, 27 Jul 2018 12:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532693922; bh=gciUH9DwatZcOHGV9vSkKlvuQIZMiKJWEmVVfrbJ+xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZnMh6orsCkJlL1sjTuN3CMlNCNk9pwfz2PM79KUjBApDq4vwxvUH4SoNjzhd90rxt Mih/Tn980IdlazPqhnBOg8PznDf5XcgPxGRWaZrtl5ubkln/pTlo4yCwsO9FYgEyUL vjy31KTOJGyyIIP6/00iPxX4TXRAElBGd4jBJxDg= 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 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 AED9C60B83; Fri, 27 Jul 2018 12:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532693921; bh=gciUH9DwatZcOHGV9vSkKlvuQIZMiKJWEmVVfrbJ+xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZbEV8k2xGbo3VbfeWiFQsM+UjHNTpqxC0ZsgBx316SsjeBmWJO5HMnhZH9N8+jxm8 UdCPD1bgNZ6Ya2jHgYb25ZvBCpk7Xq17G7Gs18CDYAODyWidrWofP+VNalWz6omGJd 2Am7QMBAAq1/1D4YJxKIfr5w4DrPHCsXKJSZ1feg= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AED9C60B83 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, robh+dt@kernel.org, arnaud.pouliquen@st.com, andy.gross@linaro.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Arun Kumar Neelakantam Subject: [PATCH V4 5/9] rpmsg: glink: Add support for rpmsg glink chrdev Date: Fri, 27 Jul 2018 17:47:25 +0530 Message-Id: <1532693849-7037-6-git-send-email-aneela@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1532693849-7037-1-git-send-email-aneela@codeaurora.org> References: <1532693849-7037-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 f43341d..9f3d026 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); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project