Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933089AbcJLR0h (ORCPT ); Wed, 12 Oct 2016 13:26:37 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:4779 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754926AbcJLR01 (ORCPT ); Wed, 12 Oct 2016 13:26:27 -0400 From: Loic Pallardy To: , , CC: , , , Subject: [PATCH v3 13/20] remoteproc: core: Add vdev support to resource amending function Date: Wed, 12 Oct 2016 18:00:31 +0200 Message-ID: <1476288038-24909-14-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1476288038-24909-1-git-send-email-loic.pallardy@st.com> References: <1476288038-24909-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.201.23.23] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-12_09:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1286 Lines: 43 This patch offers the capability to amend existing RSC_VDEV resource in an existing resource table. Signed-off-by: Loic Pallardy --- drivers/remoteproc/remoteproc_core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 4297ee7..26fc647 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -985,6 +985,7 @@ static int rproc_update_resource_table_entry(struct rproc *rproc, struct fw_rsc_carveout *tblc, *newc; struct fw_rsc_devmem *tbld, *newd; struct fw_rsc_trace *tblt, *newt; + struct fw_rsc_vdev *tblv, *newv; int updated = true; int i; @@ -1029,6 +1030,20 @@ static int rproc_update_resource_table_entry(struct rproc *rproc, memcpy(tblt, newt, request->size); return updated; + case RSC_VDEV: + tblv = rsc; + newv = request->resource; + if (newv->id != tblv->id) + break; + + if (request->size > (sizeof(*tblv) + + tblv->num_of_vrings * sizeof(struct fw_rsc_vdev_vring) + + tblv->config_len)) + return -ENOSPC; + + memcpy(tblv, newv, request->size); + + return updated; default: dev_err(&rproc->dev, "Unsupported resource type: %d\n", -- 1.9.1