From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A306C0650F for ; Thu, 8 Aug 2019 07:31:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 54CD52184E for ; Thu, 8 Aug 2019 07:31:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731178AbfHHHbN (ORCPT ); Thu, 8 Aug 2019 03:31:13 -0400 Received: from verein.lst.de ([213.95.11.211]:44048 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730887AbfHHHbN (ORCPT ); Thu, 8 Aug 2019 03:31:13 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id CC7D768B02; Thu, 8 Aug 2019 09:31:09 +0200 (CEST) Date: Thu, 8 Aug 2019 09:31:09 +0200 From: Christoph Hellwig To: Logan Gunthorpe Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org, Bjorn Helgaas , Christian Koenig , Jason Gunthorpe , Sagi Grimberg , Keith Busch , Jens Axboe , Dan Williams , Eric Pilmore , Stephen Bates Subject: Re: [PATCH v2 03/14] PCI/P2PDMA: Add constants for not-supported result upstream_bridge_distance() Message-ID: <20190808073109.GC29852@lst.de> References: <20190730163545.4915-1-logang@deltatee.com> <20190730163545.4915-4-logang@deltatee.com> <20190807055455.GA6627@lst.de> <4b0c012a-c3a1-a1c0-b098-8b350963aed1@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4b0c012a-c3a1-a1c0-b098-8b350963aed1@deltatee.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Wed, Aug 07, 2019 at 09:58:06AM -0600, Logan Gunthorpe wrote: > We only calculate it at the same time as we calculate the distance. This > is necessary because, to calculate the type, we have to walk the tree > and check the ACS bits. If we separated it, we'd have to walk the tree > twice in a very similar way just to determine both the distance and the > mapping type. Calculating it together makes perfect sense. What I find odd is the overloading of a single return value. Why not return the map type as the return value, and the distance as a by reference argument to keep them properly separated?