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.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 67CC0C43470 for ; Thu, 8 Apr 2021 11:25:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 339DA61105 for ; Thu, 8 Apr 2021 11:25:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231300AbhDHLZT (ORCPT ); Thu, 8 Apr 2021 07:25:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231145AbhDHLZR (ORCPT ); Thu, 8 Apr 2021 07:25:17 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA604C061761; Thu, 8 Apr 2021 04:25:06 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id p10so896211pld.0; Thu, 08 Apr 2021 04:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FNlHOXPoa1AVSwT64tviQKrmRjIP6/dQq2uo/ujEyXg=; b=qp0/Rap3zfkW7RSQHOmAvkMYTUBWY2+8Bgzvs/A9UQK+O/r/Viauo5Rl//pUypVAO6 s42eIVBlLZ9Req69nMeB27hCmZ3kJYLqgSZiM/Lwjsno4YP4wuaDIoV1lP5m0B6dn63Y XM5nfhiXlBQ/n2U49Jycba8gJaXHVy7hpX4jGJ3SXaisjZ1WoXqQBG8MNB5vwXFGxgR7 tqD1xhiWSQCmbvXlddzNLD9yaV0OHzlwgboQM0jBCvDZP4qsAY+8Ra8OOM5x/N8QOA+H wcKy5b4Tq48vPsym77APSy5tTXFS6ZDkogixZcZsqyC/mdw7N0zFcTxZcIE55NUN2hpk +KsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FNlHOXPoa1AVSwT64tviQKrmRjIP6/dQq2uo/ujEyXg=; b=pISWp2rNcXOuBq/y4ln6CPMwKtLPVOrD72H+xDzSgVtc4FgQ0YEVmhD9KMXqFUi3A9 YarCJwXP2T17CwWyyeDDz0MjQvbJjXzjfsRApwYX2G4eKO86nVDl11BuXu0AxRjSJkza Gw9maw8BlSkqa9Vn2QZjwsdfz8MKoSU9+JH76Gnp5eHHL+OkuGiksY1wXLWeFBlaFycX 5l4ygf/E7SJgRmHKkY3d5mW5hiqikraPAhMYUbCzw1jK44z7yGGPMSKA4G8uCtIsljIH 9LzAgVRCrr1heE8GMF6MVs1wFPQnkvPKKTQF9GiE53TlyCjvZ9hrUyjzqfFficfPkYKa Ohcg== X-Gm-Message-State: AOAM531/nEiGW1f76feGwYAds/z9SRT2IsJp4Y6JXwtSY9oPGa3eyloI vXHXF6oOL9H7TQi1WDqxVmrXuLgMZGC6/cQE/CVy3evo5MUgYfMW X-Google-Smtp-Source: ABdhPJzpmgt1Vn1p3ptTy+1Wh/v8DyxoLdx6FN8hIZR+wzDKv0ufwJ0Y3kqPjfzWUZqOGHy3WDJbZOZXTX9qGr9xsIs= X-Received: by 2002:a17:90a:156:: with SMTP id z22mr8250717pje.181.1617881106488; Thu, 08 Apr 2021 04:25:06 -0700 (PDT) MIME-Version: 1.0 References: <20210402090542.131194-1-marcan@marcan.st> <20210402090542.131194-12-marcan@marcan.st> <20210407210317.GB16198@willie-the-truck> In-Reply-To: From: Andy Shevchenko Date: Thu, 8 Apr 2021 14:24:50 +0300 Message-ID: Subject: Re: [PATCH v4 11/18] asm-generic/io.h: implement pci_remap_cfgspace using ioremap_np To: Hector Martin Cc: Will Deacon , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 8, 2021 at 2:01 PM Hector Martin wrote: > On 08/04/2021 06.03, Will Deacon wrote: > >> 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); > > Today I learned that this one is kosher in kernel code. Handy! Let's go > with that. It depends on the maintainer. Greg, for example, doesn't like this. I have no strong opinion (I use both variants on case-by-case basis), though I think in headers better to spell out all conditionals clearly. -- With Best Regards, Andy Shevchenko 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=-0.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 A690AC433B4 for ; Thu, 8 Apr 2021 11:26:50 +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 1C9BF6113C for ; Thu, 8 Apr 2021 11:26:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C9BF6113C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vrLjbOaFhaquwEQBiYzTRrFI0pPLDGOLizRqbga/Fj4=; b=OnMtCTSCfKu0htS9Gftexhb2S Mfq4qIbRxS7vKrln9flaEF2MY542h9c2kM1LYJ8SF5QqlJwSTaPBIPr2F2jznVPM4Gc5oS+yXQluJ cbe/0wpP5kaB+Lg9RnZy045ci9DlVXrU+AgG+xVIQFPaCjOJOIpNMNq1HdGUfTDWW+HdmmBpRQXyQ RF3sJhbXgqtoC7cCCKQ9gSJDWW/Pei5o3YYSustyOiXVmI/Idya3x7Rve0oxIH5zI7NgOQDdL4/7X ZhK0ZG/7tjgodjm35uRT0YjHq4h+1ZbMyQTEmzxkjDnk53mKQTMuff8VIBF6UV14NnCPLj3aERHah tzGSTWunA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lUSmh-007p4d-Mz; Thu, 08 Apr 2021 11:25:15 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lUSma-007p3N-K3 for linux-arm-kernel@lists.infradead.org; Thu, 08 Apr 2021 11:25:10 +0000 Received: by mail-pl1-x62e.google.com with SMTP id y2so873671plg.5 for ; Thu, 08 Apr 2021 04:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FNlHOXPoa1AVSwT64tviQKrmRjIP6/dQq2uo/ujEyXg=; b=qp0/Rap3zfkW7RSQHOmAvkMYTUBWY2+8Bgzvs/A9UQK+O/r/Viauo5Rl//pUypVAO6 s42eIVBlLZ9Req69nMeB27hCmZ3kJYLqgSZiM/Lwjsno4YP4wuaDIoV1lP5m0B6dn63Y XM5nfhiXlBQ/n2U49Jycba8gJaXHVy7hpX4jGJ3SXaisjZ1WoXqQBG8MNB5vwXFGxgR7 tqD1xhiWSQCmbvXlddzNLD9yaV0OHzlwgboQM0jBCvDZP4qsAY+8Ra8OOM5x/N8QOA+H wcKy5b4Tq48vPsym77APSy5tTXFS6ZDkogixZcZsqyC/mdw7N0zFcTxZcIE55NUN2hpk +KsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FNlHOXPoa1AVSwT64tviQKrmRjIP6/dQq2uo/ujEyXg=; b=h7Na5rqYw93WKYuGT80RgfzlqauBGcdClGCo5/obsai2gsbhflx7LpIs8dIZ1PMPcm XjvMuLq48/QyFTipSWrTA6h415nSDibG+AUGlO3/KtP5/+hZq+JeE+PPs8B8uRUeGGed e35aJ0EyUZdvImSFSgB9IxdiNWI2E7uR451scyIhZKR1daiyco/j9TWbpiC3SsSymgPz UmxDND2Tj+41fTmgVTWrdt3wISwmNQvdaE2/vNTY8DDx7pZUjG2eNlodKzUzpPTqo9oW iZmGiCa8d5dPsbW7qgE3KLOFfb0LhKbMS3qGHmGq/AMAd9wESrhUFq0PJR7eEjeP9HIB ukUg== X-Gm-Message-State: AOAM5307gmcWtMxcwpfehUcmzxhYpAtdx5sEpBnvhlg/J/286Outd+ZI poncuvcIrfvXKK+Hv4jFAnp14NTJfyrtImVJDQ8= X-Google-Smtp-Source: ABdhPJzpmgt1Vn1p3ptTy+1Wh/v8DyxoLdx6FN8hIZR+wzDKv0ufwJ0Y3kqPjfzWUZqOGHy3WDJbZOZXTX9qGr9xsIs= X-Received: by 2002:a17:90a:156:: with SMTP id z22mr8250717pje.181.1617881106488; Thu, 08 Apr 2021 04:25:06 -0700 (PDT) MIME-Version: 1.0 References: <20210402090542.131194-1-marcan@marcan.st> <20210402090542.131194-12-marcan@marcan.st> <20210407210317.GB16198@willie-the-truck> In-Reply-To: From: Andy Shevchenko Date: Thu, 8 Apr 2021 14:24:50 +0300 Message-ID: Subject: Re: [PATCH v4 11/18] asm-generic/io.h: implement pci_remap_cfgspace using ioremap_np To: Hector Martin Cc: Will Deacon , 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210408_122508_825843_DC69C8DC X-CRM114-Status: GOOD ( 16.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 Thu, Apr 8, 2021 at 2:01 PM Hector Martin wrote: > On 08/04/2021 06.03, Will Deacon wrote: > >> 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); > > Today I learned that this one is kosher in kernel code. Handy! Let's go > with that. It depends on the maintainer. Greg, for example, doesn't like this. I have no strong opinion (I use both variants on case-by-case basis), though I think in headers better to spell out all conditionals clearly. -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel