From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id B722F9E3 for ; Mon, 26 Jun 2017 22:54:03 +0200 (CEST) Received: by mail-wm0-f42.google.com with SMTP id 62so7945824wmw.1 for ; Mon, 26 Jun 2017 13:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=bVIyPwLu2Fc/xAMA2wsyju3VYRoAbOktBYuH86sX630=; b=toGidhYErt7/ZkItAkTDsNq0usCUkzwI3qoA0zdmq7TwcbaxzWyaCx4+ZghRXynNLb OzMU0o1tKESUeurRgVCHr8PWSzL3dFN5SDt8GmbJtySKu+a2ehgDDvanypEwstw+nPbf brSVty0e4iDjrC/yx8BnONxc7d25r8oN9W767pj1quaStB3RyGVi09qZHM8IzH9Rm2s7 oNX/FREifeRJomtZEOmaf7rzw1tli2UFu+BEU6MnRNpFM8a6YK47SeMIe7G9JpAwD5BJ ExDQFqQbla+oHoRk/WV6Y2SHUPj8XHgz6ukhnaU3nYsWje/hYhl0BDGVB8D0E6bgCBT9 b6Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=bVIyPwLu2Fc/xAMA2wsyju3VYRoAbOktBYuH86sX630=; b=A77dALvakwHSr/ihQUsHFIPrD4V62u8ublOnPT2Q+JAuKoiJCRUr+mbOXEzjk6HH3f qVG+TGi2bFJ7V6Grpm/FTQOnUbEXriHIunfxlxcYAlqHMFA7+3JTnHWDiMV5OWU3+FdT xxKFSrXum7YybIBkX5Uc2F2+sZbZOJjiYu5uR6b2lNXMRbg502Bm+WZ/fBNMIFwAfmPa 46FCzhORrVjMRWyReFbmWltI4s5ba5TQPdSxBwRrpWzJOhEvy8q40Rd01s7DSnjfbRXt 6MQ8hRgZkgStNQ8G539KMrdzK3D2HYVw5y26frMntBDbalaNvw2XvrNvH0M3L5P0FsvX at8A== X-Gm-Message-State: AKS2vOxFn0hWR0fsTxoakOGtfKjJtdAsQh0/SNsESt+M15o1FiuJfsXI /W6080ql9d1JTKBA X-Received: by 10.28.169.207 with SMTP id s198mr926606wme.8.1498510443209; Mon, 26 Jun 2017 13:54:03 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 201sm802753wmr.4.2017.06.26.13.54.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Jun 2017 13:54:02 -0700 (PDT) Date: Mon, 26 Jun 2017 22:53:54 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Bruce Richardson Cc: dev@dpdk.org, Jan Blunck Message-ID: <20170626205354.GN2344@bidouze.vm.6wind.com> References: <20170626153055.GA101992@bricha3-MOBL3.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170626153055.GA101992@bricha3-MOBL3.ger.corp.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v5 01/12] bus: add bus iterator to find a bus X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jun 2017 20:54:04 -0000 Hi Bruce, Thanks for reading. On Mon, Jun 26, 2017 at 04:30:55PM +0100, Bruce Richardson wrote: > On Mon, Jun 26, 2017 at 02:21:59AM +0200, Gaetan Rivet wrote: > > From: Jan Blunck > > > > This helper allows to iterate over all registered buses and find one > > matching data used as parameter. > > > > Signed-off-by: Jan Blunck > > Signed-off-by: Gaetan Rivet > > --- > > lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 + > > lib/librte_eal/common/eal_common_bus.c | 20 ++++++++++++ > > lib/librte_eal/common/include/rte_bus.h | 43 +++++++++++++++++++++++++ > > lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 + > > 4 files changed, 65 insertions(+) > > > > Two minor suggestions below. Otherwise: > > Acked-by: Bruce Richardson > > > diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map > > index 2e48a73..ed09ab2 100644 > > --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map > > +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map > > @@ -162,6 +162,7 @@ DPDK_17.02 { > > DPDK_17.05 { > > global: > > > > + rte_bus_find; > > rte_cpu_is_supported; > > rte_log_dump; > > rte_log_register; > > diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c > > index 8f9baf8..4619eb2 100644 > > --- a/lib/librte_eal/common/eal_common_bus.c > > +++ b/lib/librte_eal/common/eal_common_bus.c > > @@ -145,3 +145,23 @@ rte_bus_dump(FILE *f) > > } > > } > > } > > + > > +struct rte_bus * > > +rte_bus_find(rte_bus_cmp_t cmp, > > + const void *data, > > + const struct rte_bus *start) > > +{ > > + struct rte_bus *bus = NULL; > > + int started = start == NULL; > > Please put brackets around the "start == NULL" to improve readability. > My first reading of this I assumed it was doing multiple assignment of > both start and started to NULL. To make it extra clear, prefix the > comparison with "!!". > > > + > > + TAILQ_FOREACH(bus, &rte_bus_list, next) { > > + if (!started) { > > + if (bus == start) > > + started = 1; > > + continue; > > + } > > + if (cmp(bus, data) == 0) > > + break; > > + } > > + return bus; > > +} > > I also think the name "started" is confusing, and might be better as the > slighly longer "start_found". > Agreed on both account, it will be fixed in the next version. -- Gaëtan Rivet 6WIND