From patchwork Mon Dec 18 22:02:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Lew X-Patchwork-Id: 10121961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C23D360327 for ; Mon, 18 Dec 2017 22:03:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B384526CFC for ; Mon, 18 Dec 2017 22:03:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A866D28B44; Mon, 18 Dec 2017 22:03:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47C2A26CFC for ; Mon, 18 Dec 2017 22:03:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759580AbdLRWDN (ORCPT ); Mon, 18 Dec 2017 17:03:13 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:51838 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934191AbdLRWC0 (ORCPT ); Mon, 18 Dec 2017 17:02:26 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id EB5826024A; Mon, 18 Dec 2017 22:02:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1513634545; bh=sXpAY8CHvO9Xf+VBQEU/vuwmvyHYUZNCsynt7joEB4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KfXBx9eHH6UfUYYkjnAucGtKg0JW9hfAmqqwwS9Su18XTYjTpuBbo3FlwuKCRlhk3 QxEKvTZC4uRVOnphVpSBSrKh2lxcVHs3wv282eztsEs6GC5Ul0+niKfavDv9todZ+t 51ac25hAXJ5ih4olXy2da9IV8lf9SJybh6e8gww4= 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 D992460710; Mon, 18 Dec 2017 22:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1513634545; bh=sXpAY8CHvO9Xf+VBQEU/vuwmvyHYUZNCsynt7joEB4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KfXBx9eHH6UfUYYkjnAucGtKg0JW9hfAmqqwwS9Su18XTYjTpuBbo3FlwuKCRlhk3 QxEKvTZC4uRVOnphVpSBSrKh2lxcVHs3wv282eztsEs6GC5Ul0+niKfavDv9todZ+t 51ac25hAXJ5ih4olXy2da9IV8lf9SJybh6e8gww4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D992460710 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, robh+dt@kernel.org, andy.gross@linaro.org, david.brown@linaro.org 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 5/6] rpmsg: Introduce rpmsg_get_rproc_name Date: Mon, 18 Dec 2017 14:02:13 -0800 Message-Id: <1513634534-22861-6-git-send-email-clew@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1513634534-22861-1-git-send-email-clew@codeaurora.org> References: <1513634534-22861-1-git-send-email-clew@codeaurora.org> Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for client's to query the edge name their channel is registered for. This is useful for clients who share the same channel identifier across different remote procs. Signed-off-by: Chris Lew --- drivers/rpmsg/rpmsg_core.c | 21 +++++++++++++++++++++ drivers/rpmsg/rpmsg_internal.h | 3 +++ include/linux/rpmsg.h | 10 ++++++++++ 3 files changed, 34 insertions(+) diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c index dffa3aab7178..d6ebd678b089 100644 --- a/drivers/rpmsg/rpmsg_core.c +++ b/drivers/rpmsg/rpmsg_core.c @@ -78,6 +78,27 @@ struct rpmsg_endpoint *rpmsg_create_ept(struct rpmsg_device *rpdev, } EXPORT_SYMBOL(rpmsg_create_ept); + +/** + * rpmsg_get_rproc_name() - Return the name of the rproc for this device + * @rpdev: rpmsg channel device + * + * Expose the rproc name for clients who open the same channel across different + * rprocs and need to differentiate during their probe. + * + * Returns char string on success and NULL on failure. + */ +const char *rpmsg_get_rproc_name(struct rpmsg_device *rpdev) +{ + if (WARN_ON(!rpdev)) + return NULL; + + if (!rpdev->ops->get_rproc_name) + return NULL; + + return rpdev->ops->get_rproc_name(rpdev); +} + /** * rpmsg_destroy_ept() - destroy an existing rpmsg endpoint * @ept: endpoing to destroy diff --git a/drivers/rpmsg/rpmsg_internal.h b/drivers/rpmsg/rpmsg_internal.h index 0cf9c7e2ee83..83a028b6883f 100644 --- a/drivers/rpmsg/rpmsg_internal.h +++ b/drivers/rpmsg/rpmsg_internal.h @@ -31,6 +31,7 @@ * @create_ept: create backend-specific endpoint, requried * @announce_create: announce presence of new channel, optional * @announce_destroy: announce destruction of channel, optional + * @get_rproc_name: return name of the rproc for this device, optional * * Indirection table for the operations that a rpmsg backend should implement. * @announce_create and @announce_destroy are optional as the backend might @@ -43,6 +44,8 @@ struct rpmsg_device_ops { int (*announce_create)(struct rpmsg_device *ept); int (*announce_destroy)(struct rpmsg_device *ept); + + const char *(*get_rproc_name)(struct rpmsg_device *rpdev); }; /** diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h index 10d6ae8bbb7d..167982dc5b4f 100644 --- a/include/linux/rpmsg.h +++ b/include/linux/rpmsg.h @@ -160,6 +160,8 @@ int rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst, unsigned int rpmsg_poll(struct rpmsg_endpoint *ept, struct file *filp, poll_table *wait); +const char *rpmsg_get_rproc_name(struct rpmsg_device *dev); + #else static inline int register_rpmsg_device(struct rpmsg_device *dev) @@ -267,6 +269,14 @@ static inline unsigned int rpmsg_poll(struct rpmsg_endpoint *ept, return 0; } +static inline const char *rpmsg_get_rproc_name(struct rpmsg_device *rpdev) +{ + /* This shouldn't be possible */ + WARN_ON(1); + + return NULL; +} + #endif /* IS_ENABLED(CONFIG_RPMSG) */ /* use a macro to avoid include chaining to get THIS_MODULE */