From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f173.google.com (mail-pf0-f173.google.com [209.85.192.173]) by dpdk.org (Postfix) with ESMTP id E1359271 for ; Wed, 28 Jun 2017 01:35:22 +0200 (CEST) Received: by mail-pf0-f173.google.com with SMTP id s66so23838559pfs.1 for ; Tue, 27 Jun 2017 16:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=41s22mGTMpdytsbIQCpAR1WlL4vkR9aKHqY1XkeOd3s=; b=e+gimS5NbC+b5r6zROxQOTYKeYbRnOFFKux6VpCwvrAqaeHUUSor2SFFTzOGqTQVgF 9/vp4sKiXVY3o/o7Uuu1FXnE+A3R/T2Or94WoEIhJezFCs/WaZn5W2qBNU9HPZD+Ed5k 8+wJHxQzClaKHaXJfkKjAIg+vvC6FFd6PNOs3BpdA2GjOd7ccQiH9to7RkqRKcqB9Mac EDep0Nxv/kgbNfSc98w/NOLPXNRUJj9G2AAJCtLJI0HlLgUlLOS9hxgqoBKfqPXdAaJI XP7Yko+HIfRDq2SG8z12FPxKgBHoaIquNx2O24dFHUhzmYxrpYtKaaYn2ZlHZKiAQY4P z/eA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=41s22mGTMpdytsbIQCpAR1WlL4vkR9aKHqY1XkeOd3s=; b=Cq1U7H8eboax6sNAI03A6ILTDy0Sn8ZaSEDXwFTeU3OaOk7aRBGjkZ/vlohjreXNFA 60UV55OTx5MYXsHLUipkdIbyfFb+suFxwBYzQvMB98FV7L8NboAv0ldz40JuFNfSl31s rMGsD/A96l72degFU/Vra8LbmFZg7lrWg/ITYLO+o1gVI3+m0FelBkI8A8K5XNr/lx5b 8SBkTiEVUSV5mJpv4zS2+m65ff1egDNGX7WPE649nfjrhvPF6r0jrRIdNzwSDZXxINaf COZjGC1rfZsnv5pZrIRd76Gemow0IkIoQzyyEhpI1rm7tLx3DrXEVoiP2q4JsnLiO4Lr eKCQ== X-Gm-Message-State: AKS2vOyAS/6PpJphAB9KKz/omVDnCrGnbtLQ8sXcnH9mpYd5hua+JtRG 1qsDk37Tu3kwCqNoZIXEyQ== X-Received: by 10.99.164.25 with SMTP id c25mr7769974pgf.37.1498606522069; Tue, 27 Jun 2017 16:35:22 -0700 (PDT) Received: from xeon-e3 (76-14-207-240.or.wavecable.com. [76.14.207.240]) by smtp.gmail.com with ESMTPSA id x25sm668053pfi.58.2017.06.27.16.35.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Jun 2017 16:35:22 -0700 (PDT) Date: Tue, 27 Jun 2017 16:35:14 -0700 From: Stephen Hemminger To: Gaetan Rivet Cc: dev@dpdk.org Message-ID: <20170627163514.2ed2ec6b@xeon-e3> In-Reply-To: <5fe2e5fb2759d1f6d3f86e5dfae5c3fc177299da.1498577192.git.gaetan.rivet@6wind.com> References: <5fe2e5fb2759d1f6d3f86e5dfae5c3fc177299da.1498577192.git.gaetan.rivet@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 09/11] pci: implement find_device bus operation 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: Tue, 27 Jun 2017 23:35:23 -0000 On Tue, 27 Jun 2017 18:11:16 +0200 Gaetan Rivet wrote: > + int start_found = !!(start == NULL); > + > + FOREACH_DEVICE_ON_PCIBUS(dev) { > + if (!start_found) { > + if (&dev->device == start) > + start_found = 1; > + continue; > + } > + if (cmp(&dev->device, data) == 0) > + return &dev->device; > + } > + return NULL; > +} > + Why is start_found not a boolean? Do you really need start_found at all? Why not just reuse existing pointer? FOREACH_DEVICE_ON_PCIBUS(dev) { if (start) { if (&dev->device == start) start = NULL continue; } if (cmp(&dev->device, data) == 0) return &dev->device; } return NULL; }