Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp920603pxf; Wed, 7 Apr 2021 15:06:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzy7HWATVL2PtKDUWmtLVjh6Nsd0llVNSbSb/i1MXwbtlZAVCKBygJNEfMtZe1GFklm/kc1 X-Received: by 2002:a17:90b:315:: with SMTP id ay21mr5191090pjb.72.1617833167142; Wed, 07 Apr 2021 15:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617833167; cv=none; d=google.com; s=arc-20160816; b=PVM0zaBAMCKPcluWUK/3Rv0PgZuYHfXaUXflmUz7PWTEIO3DLs8PgjM3liCnzQYXh6 p722mR7MQKTdC+04/kIjRY0yqWaBTnqiE6JTtFcTT9SCG1XfP7z3R/tYkQ22q7RgriJX PQsnfVF4FXVJUapEd31ccal3DsMQk4sbETgISdDKCTqw6mxgCP6CGxaADWkIosO7T4Nx KF3tB1RzmBZCu3BqYUYnQU0rXgHD5czW5o8oXw12otBkWU4USMKJMGl3tQ0Rse0/oi0C fWzaDxcmdoU9O61yF6qyVeKK+AUl2ARNQgUeWRRr8SBXz9JXi3Kbi2YJFoyCuvHQrwmY 4vBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Nqg8JI5jVEx/eGpC42iNfw992aOLQ2d42CRgkYrg42U=; b=vdUbOMEslN192mINvCzlRfi2c+es0Dcr9/RGTdPA5S+geuXe2exyZyJV9FqC3KvQjQ TAjQADmAPHF49ExWeNajwWG4Yppfc1ry4MSxR8AIKqE4NF3N0S4L5m/GpGcYT6O2yUYt cFal5ZFXqmYjq0hzp643ZLX/jibgju8YjdHpTM6FnTy/lNPSf1vhEHgsOJ3RvQlP9y0O OjzbGNp4QGkBVJho75y4h8ZMreduM9v/0isgnG0Xb1+facrTJ0qTse6Hl6Op1lAFxtgg STgjd4mAheof/od+1/jGFlqgFhrdSt4YAUPyGhCHt+b1qJQXEduN0nwf8o/tuAoW4iiz Uamw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aSQCD3KS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k18si702461pll.324.2021.04.07.15.05.54; Wed, 07 Apr 2021 15:06:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aSQCD3KS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231757AbhDGVDf (ORCPT + 99 others); Wed, 7 Apr 2021 17:03:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:36018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230142AbhDGVDf (ORCPT ); Wed, 7 Apr 2021 17:03:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1D5E6610CA; Wed, 7 Apr 2021 21:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617829405; bh=QazZLBnfh7mh8f3Fj68kQd7sXfjGSgTDndIHosthxL0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aSQCD3KSoBzBp2essdxE7F30l8Eu/UfwUFDLbXBKcCLcNFS2TuqDN2tJvw9ryqkj9 8670l+ApuQ6VwuBNZBOy2qQeMlQgIZw7rqndfcbOfz+ZeRTnCPpNrfg8wPDQTxw35l ciziAvNWlZSM7xG3zZrsAyS7d4e9q81xMbFzrADvu0qdSySyHAeEsRq7VegSJc9D8o cTYkG21eY+5sEVgMogCjiFE+C4JFJc4acYHoNMMp1IZEqRJfNxc1RKjEbJXWsVS65R WNFihv7onIOI98CEYKTbGE5k7+siFsDWuFTveRXc44htKxsgAwlCa/IxTRMi8E9HIE jS2GSbE6ZRZOA== Date: Wed, 7 Apr 2021 22:03:17 +0100 From: Will Deacon To: Andy Shevchenko Cc: Hector Martin , linux-arm Mailing List , Marc Zyngier , Rob Herring , Arnd Bergmann , Olof Johansson , Krzysztof Kozlowski , Mark Kettenis , Tony Lindgren , Mohamed Mediouni , Stan Skowronek , Alexander Graf , Linus Walleij , Mark Rutland , Jonathan Corbet , Catalin Marinas , Christoph Hellwig , "David S. Miller" , devicetree , Linux Documentation List , Linux-Arch , Linux Kernel Mailing List Subject: Re: [PATCH v4 11/18] asm-generic/io.h: implement pci_remap_cfgspace using ioremap_np Message-ID: <20210407210317.GB16198@willie-the-truck> References: <20210402090542.131194-1-marcan@marcan.st> <20210402090542.131194-12-marcan@marcan.st> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 07, 2021 at 04:27:42PM +0300, Andy Shevchenko wrote: > On Fri, Apr 2, 2021 at 12:07 PM Hector Martin wrote: > > > > Now that we have ioremap_np(), we can make pci_remap_cfgspace() default > > to it, falling back to ioremap() on platforms where it is not available. > > > > Remove the arm64 implementation, since that is now redundant. Future > > cleanups should be able to do the same for other arches, and eventually > > make the generic pci_remap_cfgspace() unconditional. > > ... > > > + void __iomem *ret = ioremap_np(offset, size); > > + > > + if (!ret) > > + ret = ioremap(offset, size); > > + > > + return ret; > > Usually negative conditions are worse for cognitive functions of human beings. > (On top of that some patterns are applied) > > I would rewrite above as > > void __iomem *ret; > > ret = ioremap_np(offset, size); > if (ret) > return ret; > > return ioremap(offset, size); Looks like it might be one of those rare occasions where the GCC ternary if extension thingy comes in handy: return ioremap_np(offset, size) ?: ioremap(offset, size); but however it's done, the logic looks good to me and thanks Hector for updating this: Acked-by: Will Deacon Will