Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2591316ybg; Fri, 31 Jul 2020 04:48:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkaIb2m2iPPULJI4f9DIoh6VRWZ3oL0ZE4rJx6mNvFQQSI2mFryX8hmm+1ywswzVF6LPFn X-Received: by 2002:a50:e046:: with SMTP id g6mr3630700edl.210.1596196096526; Fri, 31 Jul 2020 04:48:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596196096; cv=none; d=google.com; s=arc-20160816; b=sC3y84lNvcOaW0rK92zu0haTV32V1oQU//GVlzQA2b3/5z742Vv/76kbt4PZKUL4qz Btci08W7sUWoiiHk8nGsRgDdPl00wCURNtt87nxYjB5XfYA/LEXhBYAnJeO2CyxIwj6+ ueDqyQdSrVPyJ4Lsd5mjCHTosCrNJenGG3Dasz33SY8lriyJpBuKtJ2aF/cPKJYejM6h m5Hk72V/u11t0PuLejK07C4HiUZ61DsTB1cruCzN/unJwK8l1sWIXIiIa0ebsXBQMus0 VIjSHTi3S8oC5G/AmYUYNLfQPh99IYnw+4Yrx9ChNN1XouE7D4uNFtUQpoqNjxBCcIe0 3TbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=kMfl9Sr0LMliL5b6+fSDTyEPWpdoi90a8Uixu9L/D/s=; b=zOCiBDVAn0D2WPzXbR+ZLkM/XOurYbZO+ubyWQyT8TIl9mZWXUxm0zpHotMZE3X2Fh keiujAb7Q2d99VmHgwuL45yInfHOKo8IXcmkgIwGefBzXMR1BgGHXEwmVzK9ovdvqCjK aDtSnOW7xj5mn3/6Ep+xhGtq6xF+nj8MsnocQa1eztRhzKTOnoIrYGiCBrx316cL/QVs xhiJ+Q9gVN8lClQoMJSgvkPUIWVCDbKGeavR1XALyB4eXFRjwGb8m/rOvoxcUrKI1WS9 z5QRH1BpZl2D+wGaNAXYlK8BQxYe1H2WAwecGL9FfPFZH4wEG70GD7qtsELd1RKZqvzz X6oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=QwfB4JOC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i22si5124826edr.232.2020.07.31.04.47.53; Fri, 31 Jul 2020 04:48:16 -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=pass header.i=@st.com header.s=STMicroelectronics header.b=QwfB4JOC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732791AbgGaLrr (ORCPT + 99 others); Fri, 31 Jul 2020 07:47:47 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:15016 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732577AbgGaLrq (ORCPT ); Fri, 31 Jul 2020 07:47:46 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06VBbakN031318; Fri, 31 Jul 2020 13:47:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=kMfl9Sr0LMliL5b6+fSDTyEPWpdoi90a8Uixu9L/D/s=; b=QwfB4JOCNci96YYkgBfBGxfs7CiNi4hXiPjYx59HL4qrjVqxxCpOsfAgPDNeeFITmVCd S30ezkBB5O1byywFgvJ2VC2k0Mc9nkK2X6giqjz0hgRSZqNxOIpJXHOqGCkmqKq2CBGg 1/bnuRijMe1OsYW2FKlcJxoarWcSYf0+qbp8yx7NAIGuw84ee9Xbef01GbWX+4lewi40 YuPKAXdjnfAGsimjoB2ykEXDIARJj8/csfqLI7rH3CDOZOMpl9XBgp+VUwU5Zm/F4Yu/ DXt/pS/Vzq5eXG+0MLeJ/1FFOt5Ire+9wAvl7cY3wdLKZg9HK/y4eNnpWO9exLul+vUL 5A== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32g9v9xgrt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Jul 2020 13:47:44 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 96A7510002A; Fri, 31 Jul 2020 13:47:43 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag3node1.st.com [10.75.127.7]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 8BF2B221061; Fri, 31 Jul 2020 13:47:43 +0200 (CEST) Received: from localhost (10.75.127.46) by SFHDAG3NODE1.st.com (10.75.127.7) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 31 Jul 2020 13:47:43 +0200 From: Arnaud Pouliquen To: Bjorn Andersson , Ohad Ben-Cohen , Mathieu Poirier CC: , , , Subject: [PATCH 3/9] rpmsg: virtio: add rpmsg channel device ops Date: Fri, 31 Jul 2020 13:47:26 +0200 Message-ID: <20200731114732.12815-4-arnaud.pouliquen@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200731114732.12815-1-arnaud.pouliquen@st.com> References: <20200731114732.12815-1-arnaud.pouliquen@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG1NODE3.st.com (10.75.127.3) To SFHDAG3NODE1.st.com (10.75.127.7) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-31_04:2020-07-31,2020-07-31 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement the create and release of the RPMsg channel for the RPMsg virtio bus. Signed-off-by: Arnaud Pouliquen --- drivers/rpmsg/virtio_rpmsg_bus.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index 736bc7b9dea8..910d30818901 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c @@ -176,6 +176,12 @@ static int virtio_rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst); static int virtio_rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst, void *data, int len); +static struct rpmsg_device * + virtio_rpmsg_create_channel(struct rpmsg_device *rpdev, + struct rpmsg_channel_info *chinfo); +static int virtio_rpmsg_release_channel(struct rpmsg_device *rpdev, + struct rpmsg_channel_info *chinfo); + static const struct rpmsg_endpoint_ops virtio_endpoint_ops = { .destroy_ept = virtio_rpmsg_destroy_ept, @@ -372,6 +378,8 @@ static int virtio_rpmsg_announce_destroy(struct rpmsg_device *rpdev) } static const struct rpmsg_device_ops virtio_rpmsg_ops = { + .create_channel = virtio_rpmsg_create_channel, + .release_channel = virtio_rpmsg_release_channel, .create_ept = virtio_rpmsg_create_ept, .announce_create = virtio_rpmsg_announce_create, .announce_destroy = virtio_rpmsg_announce_destroy, @@ -439,6 +447,25 @@ __rpmsg_create_channel(struct virtproc_info *vrp, return rpdev; } +static struct rpmsg_device * + virtio_rpmsg_create_channel(struct rpmsg_device *rpdev, + struct rpmsg_channel_info *chinfo) +{ + struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev); + struct virtproc_info *vrp = vch->vrp; + + return __rpmsg_create_channel(vrp, chinfo); +} + +static int virtio_rpmsg_release_channel(struct rpmsg_device *rpdev, + struct rpmsg_channel_info *chinfo) +{ + struct virtio_rpmsg_channel *vch = to_virtio_rpmsg_channel(rpdev); + struct virtproc_info *vrp = vch->vrp; + + return rpmsg_unregister_device(&vrp->vdev->dev, chinfo); +} + /* super simple buffer "allocator" that is just enough for now */ static void *get_a_tx_buf(struct virtproc_info *vrp) { -- 2.17.1