Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp795657iol; Thu, 9 Jun 2022 14:17:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfAuv772FqqK0y3R00AAD+MLrhWEK8pnDnbPM8G1HswEyWXiPfHzeLy0Af/3CNtRuzvwpR X-Received: by 2002:a17:906:2cc3:b0:70d:b6c8:f83b with SMTP id r3-20020a1709062cc300b0070db6c8f83bmr33711595ejr.770.1654809423381; Thu, 09 Jun 2022 14:17:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654809423; cv=none; d=google.com; s=arc-20160816; b=m8oOd6FkxgZ12rt5grKTwLBpEsqaAYHqG73o2Dc+B8ZjDKnA85rBuJD8oTzUR8f9qO 4hliyaPHx+2/iBkgpc4SS/GMXC0Upm0parI7443EmF8VKVOZDet2FljG+Ui2e6ln3ga0 hoaxLVXb4G/y7TX7uymCU0QHIcbpVSaU6KJiMjLl6Dmh/vZdHih2FFZOsvb/7X8B98rM XWw6JdF7hhuVqi6XUqmAOeGVSY1VEw1TO08KE9uDHZl/mCwo2ZQgpyqSAtvtL9N1Bl/a MQ12HzOUQTr9rJm/grZn7zIPvtzqbtDIU3XvKh5lXls/xLq6ndS3TeYsjxIfmwKAfY/q qVyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=S78m/HToLKVYUdCMUpb8rjXXCKKli+oy2FiVRaWYDoM=; b=bMpTbHwoABI+hziNBTWqdDRFQSZNmQlriZCSQ6iyr4Dj1VS8eIiGghjjZ4eas9qxO0 YjR+1968/gnWkNmKgtvtK+/nCD/BeZAnfU7Kvpqvxcdtcc4JtQFFB2bR/ZhfUOOHFjjX CVLFMt71cbCRkE5ciZQzGU0RBP8vonax44AK54ohAGLzvAS59wSoyBENB0Jv/PkRQ7FU 4Qxj7Mp00JDtz/Ut6MdPv85oDBQaASevsWRFkgObBJDQ2+hYRy61FnXIN61hWORIqiFn WdVb+Cc6cqnnD0xnQ+KwLmKkbWQMIv7GijPcmoAbhgGVn9ezk4FRdM0Ccl4o5dnbmoe2 RROA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Lc2XA2kv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020a170906974f00b00705973ded91si4671010ejy.453.2022.06.09.14.16.37; Thu, 09 Jun 2022 14:17:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Lc2XA2kv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245413AbiFIUmf (ORCPT + 99 others); Thu, 9 Jun 2022 16:42:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbiFIUmd (ORCPT ); Thu, 9 Jun 2022 16:42:33 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00FDA95B0 for ; Thu, 9 Jun 2022 13:42:31 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id m32-20020a05600c3b2000b0039756bb41f2so131930wms.3 for ; Thu, 09 Jun 2022 13:42:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=S78m/HToLKVYUdCMUpb8rjXXCKKli+oy2FiVRaWYDoM=; b=Lc2XA2kvQBTNpbMTy6vnVXSiAivZF+r6bVkqOSzMQU+zEPSTuTJgaoEEPM917VBxyl g9wmjNlYAF68Mu+Or0yjSvSsmKrm/MwWeSN/+MFlBKCHoL2tmLZDKb2GboXBd51VPR3d QfOhxS+ti3ntwyylu6eMoZjKbIHttYHWR+s87RxensDozIJDfpnYJjeyPVZR6I3wzMgx +fnY22H4phCPJUSdwcdsIoiqmUF1gpfhL+h6ER3va/8O45QuAVodSP1wMwVYPBzTsi5S S6T1mVX5MWOqn/sg/ac8z3kJCnC6deYfp4EaUonemED2jk1wdnqW7GzJ/GPcEwpClu8F TnYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=S78m/HToLKVYUdCMUpb8rjXXCKKli+oy2FiVRaWYDoM=; b=W/bvSOfHx4cU9nPBPCs8ErpJE+4siXzJk+SA2/YXOI0A7i7de2IVOrT2rxAsf9PI0t Oc4GkLiKCFwcRVGMQ55IV1Mor0cd5VyYRgKKUjxHs98EcVli+GyN9fOvofmMzRmkWc7E +vbBAt1RFQKUS1cRQlN8H+u4yFnr5MGjKAF/ruHTUaUUAN5+DRp1mShRxvPpQqm1fbRe U2UtMDY0pYE9WPwYkgja/CmHQ03J3c6hFKAeZiuWOfABzlccZcnfW8h7qWQorhKqmnd7 HIIM0I3x+TXeFa5t8H4Q91cRWgSTChpHWG79rczS+EjOXazKezfvPcbpisTVizXtAVk2 YfMw== X-Gm-Message-State: AOAM530WH9YKNjLZh4s81kiqdtqn0rODPYHutaUy5L5lo3Z5iM/ygVCR UsIs7vo3wOAGPV3Lh32X7IuzwOkTGous X-Received: by 2002:a05:600c:1d91:b0:39c:544b:abdd with SMTP id p17-20020a05600c1d9100b0039c544babddmr5118392wms.70.1654807350251; Thu, 09 Jun 2022 13:42:30 -0700 (PDT) Received: from localhost.localdomain ([46.53.253.10]) by smtp.gmail.com with ESMTPSA id l21-20020a1ced15000000b003942a244ed1sm350391wmh.22.2022.06.09.13.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:42:29 -0700 (PDT) Date: Thu, 9 Jun 2022 23:42:27 +0300 From: Alexey Dobriyan To: linux-kernel@vger.kernel.org Cc: viro@zeniv.linux.org.uk, ndesaulniers@google.com, nathan@kernel.org, jstitt007@gmail.com, akpm@linux-foundation.org Subject: Re: + include-uapi-linux-swabh-move-explicit-cast-outside-ternary.patch added to mm-nonmm-unstable branch Message-ID: References: <20220609172933.D8187C34114@smtp.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220609172933.D8187C34114@smtp.kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 09, 2022 at 10:29:33AM -0700, Andrew Morton wrote: > A cast inside __builtin_constant_p doesn't do anything since it should > evaluate as constant at compile time irrespective of this cast. Instead, > I moved this cast outside the ternary to ensure the return type is as > expected. > --- a/include/uapi/linux/swab.h~include-uapi-linux-swabh-move-explicit-cast-outside-ternary > +++ a/include/uapi/linux/swab.h > @@ -102,7 +102,7 @@ static inline __attribute_const__ __u32 > #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) > #else > #define __swab16(x) \ > - (__builtin_constant_p((__u16)(x)) ? \ > + (__u16)(__builtin_constant_p(x) ? \ This cast is necessary. > ___constant_swab16(x) : \ > __fswab16(x)) > #endif > @@ -115,7 +115,7 @@ static inline __attribute_const__ __u32 > #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) > #else > #define __swab32(x) \ > - (__builtin_constant_p((__u32)(x)) ? \ > + (__u32)(__builtin_constant_p(x) ? \ > ___constant_swab32(x) : \ > __fswab32(x)) > #endif > @@ -128,7 +128,7 @@ static inline __attribute_const__ __u32 > #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x)) > #else > #define __swab64(x) \ > - (__builtin_constant_p((__u64)(x)) ? \ > + (__u64)(__builtin_constant_p(x) ? \ > ___constant_swab64(x) : \ > __fswab64(x)) These two aren't? typeof(c ? u32 : u32) is u32.