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=-3.7 required=3.0 tests=BAYES_00, 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 9A120C433FE for ; Wed, 9 Dec 2020 11:32:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 48A00235F7 for ; Wed, 9 Dec 2020 11:32:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729260AbgLILce convert rfc822-to-8bit (ORCPT ); Wed, 9 Dec 2020 06:32:34 -0500 Received: from aposti.net ([89.234.176.197]:33654 "EHLO aposti.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727970AbgLILce (ORCPT ); Wed, 9 Dec 2020 06:32:34 -0500 Date: Wed, 09 Dec 2020 11:31:41 +0000 From: Paul Cercueil Subject: Re: [PATCH 1/2] if_enabled.h: Add IF_ENABLED_OR_ELSE() =?UTF-8?Q?and=0D=0A?= IF_ENABLED() macros To: Linus Walleij Cc: Arnd Bergmann , od@zcrc.me, Linux ARM , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Message-Id: In-Reply-To: References: <20201208164821.2686082-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Hi Linus, Le mer. 9 déc. 2020 à 9:59, Linus Walleij a écrit : > On Tue, Dec 8, 2020 at 5:48 PM Paul Cercueil > wrote: > >> Introduce a new header , that brings two new >> macros: >> IF_ENABLED_OR_ELSE() and IF_ENABLED(). > > I understand what the patch is trying to do, but when we already have > IS_ENABLED() in this syntax becomes a big cognitive > confusion for the mind. > > At least the commit needs to explain why it doesn't work to use > IS_ENABLED() instead so that this is needed. You can use IS_ENABLED(). Then you'd write: field = IS_ENABLED(CONFIG_FOO) ? &my_ptr : NULL, the IF_ENABLED() macro makes it a bit cleaner by allowing you to write: field = IF_ENABLED(CONFIG_FOO, &my_ptr), Cheers, -Paul > Certainly the build failures must be possible to solve so that this > can live with the sibling IS_ENABLED() inside , > it can't be too hard. > > Yours, > Linus Walleij