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=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 2547EC433ED for ; Wed, 7 Apr 2021 21:03:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E7AF4611CC for ; Wed, 7 Apr 2021 21:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231854AbhDGVDj (ORCPT ); Wed, 7 Apr 2021 17:03:39 -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 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=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 643A0C433B4 for ; Wed, 7 Apr 2021 21:05:37 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E8EAA610CA for ; Wed, 7 Apr 2021 21:05:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8EAA610CA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rw2z+Q0LbjOdgBN71tH+u0Ndz5cqpgZBG/H8j9qmV78=; b=aNwvZYPaHLfBCj8NxOeOnkHb8 hoYCjR1jM9klfgUvpCZa7YfnAHoJ6AVKOfUWLrGyBCSKZD8aIsF38/eqrPKOai1HFFG0spR/oxF4R CXyIv8V9OnsOL84lDGx+L5EcM+2fYLmIL4Tz7j2wf7caCvZPDNfLXAoH3VQk8vQqjV81jzRXLy/6I WPw7jgP3+BxS5TV7lcD6nVIVuozBdry6TSt64A2rHiFn3JjE0Zo4jDv9ImZenx/LkElCj2c3bWhrU rUTtUeU/RqTOwlwa+fyeP5oAExKlWJ1vg4rU0yXwvzFlDH18kJaCNQNMZPP4n0pI55OboqVXFH+Dv z3Q6EX/+w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUFKl-0060w0-9Y; Wed, 07 Apr 2021 21:03:31 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUFKg-0060vF-KN for linux-arm-kernel@lists.infradead.org; Wed, 07 Apr 2021 21:03:28 +0000 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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210407_220326_907803_DF163DB2 X-CRM114-Status: GOOD ( 21.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel