Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4445623imm; Mon, 14 May 2018 07:41:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp3b7RsRFqOdthL6kwESILa6OmechQUw4G0HhqteMLEvOmkK/KDbqcQqz8A9PhcR/uWb+gI X-Received: by 2002:a62:6756:: with SMTP id b83-v6mr10866364pfc.76.1526308866459; Mon, 14 May 2018 07:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526308866; cv=none; d=google.com; s=arc-20160816; b=MeKO6E4yWifil2d9CczShI3Xuzni048eJ3FgnsfV4qE+SB3sNYa7pmySvFPeB+jZBR nDnOkgbvyvWDdxjKPZ47XiljeK+1HbYrQ9wVBN15nvEErf61NwiuH/MmserM75W/U9zB jx91m+K6D3GDDZ3DNhB+2eOg7rc8NxlQEy32E5KYMdu26aYduquizvP2h2aYrdJP1T4J ZlqQYU3kSPfeoCmCQHnQ1NrBNXXrZKjYCUU8lyulRkDcTLECvGmUr16zGnhOhXqbq0HZ xDGHN0r1GXS6z4YxQ+PNmh9qOHb8BHWdjxmmy4B+qwfNh0wzfrox6aC/+c5I4+RHmdP4 Mf3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=HtEIpzCap1zNNNL28+mj3TBgIC/rs+FJt/5klYPbyvU=; b=TFvegXc5TMkRtVEMNdYGJbswlif6Fpaeq8SpjfjmZO2shfGxEGmZDjv7GgTqicyNi0 DbLuiTAS+HYHR0nz7ph8hUXgXlK/7U7rRtPMbCaq36RclMIvT+IQ0ARUHFPxK+nHjGZ5 jGxzM+I3iOiSUMGoMPhKdikLdJzZV7JAi6er1C+Q86M4GOkRjy3Vzx0XT9KFh4TzbKTN owIDh4HE/bYb7TjFikI0827bt5aWU8l1Tlqt/FUAQdzk6yeFT1hkwg6q7QLTBsifLq/P khUGbTCRQe/iursyIbnIGOAVRcdVf0gD49c9zm6cJnO11GynwNQyVVSXTMEhEmmtANmo 6Mmw== ARC-Authentication-Results: i=1; mx.google.com; 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 o9-v6si2237287pgp.508.2018.05.14.07.40.41; Mon, 14 May 2018 07:41:06 -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; 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 S932192AbeENOkI convert rfc822-to-8bit (ORCPT + 99 others); Mon, 14 May 2018 10:40:08 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:23687 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752343AbeENOkG (ORCPT ); Mon, 14 May 2018 10:40:06 -0400 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w4EEdKN0020406; Mon, 14 May 2018 16:40:04 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2hwp1t2rwx-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 14 May 2018 16:40:04 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2CB653A; Mon, 14 May 2018 14:40:04 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag3node3.st.com [10.75.127.9]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 078665822; Mon, 14 May 2018 14:40:04 +0000 (GMT) Received: from SFHDAG7NODE2.st.com (10.75.127.20) by SFHDAG3NODE3.st.com (10.75.127.9) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Mon, 14 May 2018 16:40:03 +0200 Received: from SFHDAG7NODE2.st.com ([fe80::d548:6a8f:2ca4:2090]) by SFHDAG7NODE2.st.com ([fe80::d548:6a8f:2ca4:2090%20]) with mapi id 15.00.1347.000; Mon, 14 May 2018 16:40:03 +0200 From: Loic PALLARDY To: Bjorn Andersson CC: "ohad@wizery.com" , "linux-remoteproc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Arnaud POULIQUEN , "benjamin.gaignard@linaro.org" Subject: RE: [PATCH v3 07/13] remoteproc: introduce rproc_find_carveout_by_name function Thread-Topic: [PATCH v3 07/13] remoteproc: introduce rproc_find_carveout_by_name function Thread-Index: AQHTsXm9BXRJDS4JpEaHD/3IhHRU+KQoZIWAgAdaddA= Date: Mon, 14 May 2018 14:40:03 +0000 Message-ID: <3fd160a950374b71a5e1db03b7c55d66@SFHDAG7NODE2.st.com> References: <1519921440-21356-1-git-send-email-loic.pallardy@st.com> <1519921440-21356-8-git-send-email-loic.pallardy@st.com> <20180510001903.GD29093@builder> In-Reply-To: <20180510001903.GD29093@builder> Accept-Language: fr-FR, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.75.127.51] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-14_03:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bjorn, Thanks for the review > -----Original Message----- > From: Bjorn Andersson [mailto:bjorn.andersson@linaro.org] > Sent: Thursday, May 10, 2018 2:19 AM > To: Loic PALLARDY > Cc: ohad@wizery.com; linux-remoteproc@vger.kernel.org; linux- > kernel@vger.kernel.org; Arnaud POULIQUEN ; > benjamin.gaignard@linaro.org > Subject: Re: [PATCH v3 07/13] remoteproc: introduce > rproc_find_carveout_by_name function > > On Thu 01 Mar 08:23 PST 2018, Loic Pallardy wrote: > > > This patch provides a new function to find a carveout according > > to a name. > > If match found, this function returns a pointer on the corresponding > > carveout (rproc_mem_entry structure). > > > > Signed-off-by: Loic Pallardy > > --- > > drivers/remoteproc/remoteproc_core.c | 43 > ++++++++++++++++++++++++++++++++++++ > > 1 file changed, 43 insertions(+) > > > > diff --git a/drivers/remoteproc/remoteproc_core.c > b/drivers/remoteproc/remoteproc_core.c > > index 91aa22b..7a500cb 100644 > > --- a/drivers/remoteproc/remoteproc_core.c > > +++ b/drivers/remoteproc/remoteproc_core.c > > @@ -216,6 +216,49 @@ void *rproc_da_to_va(struct rproc *rproc, u64 da, > int len) > > } > > EXPORT_SYMBOL(rproc_da_to_va); > > > > +/** > > + * rproc_find_carveout_by_name() - lookup the carveout region by a > name > > + * @rproc: handle of a remote processor > > + * @name,..: carveout name to find (standard printf format) > > + * > > + * Platform driver has the capability to register some pre-allacoted > carveout > > + * (physically contiguous memory regions) before rproc firmware loading > and > > + * associated resource table analysis. These regions may be dedicated > memory > > + * regions internal to the coprocessor or specified DDR region with specific > > + * attributes > > + * > > + * This function is a helper function with which we can go over the > > + * allocated carveouts and return associated region characteristics like > > + * coprocessor address, length or processor virtual address. > > + * > > + * The function returns a valid pointer on carveout entry on success > > + * or NULL on failure. > > The kerneldoc format for describing the return value is > > * Return: description Yes I'll update > > > + */ > > +struct rproc_mem_entry * > > +rproc_find_carveout_by_name(struct rproc *rproc, const char *name, ...) > > +{ > > + va_list args; > > + char _name[32]; > > + struct rproc_mem_entry *carveout, *mem = NULL; > > + > > + va_start(args, name); > > + snprintf(_name, sizeof(_name), name, args); > > + va_end(args); > > + > > + if (!name) > > + return NULL; > > If you would like for it to actually be valid to pass NULL for name, > then I think you should move this check to the top of the function. > > But I suspect that you're looking for (name[0] == '\0'), to check if we > where passed an empty string, e.g. from a resource table without > resource names. Good catch, I updated function prototype without changing associated test > > > + > > + list_for_each_entry(carveout, &rproc->carveouts, node) { > > + /* Compare carveout and requested names */ > > + if (!strcmp(carveout->name, name)) { > > + mem = carveout; > > + break; > > Just return carveout when you find it. Sure > > > + } > > + } > > + > > + return mem; > > +} > > + > > Regards, > Bjorn