Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp906159rbb; Sun, 25 Feb 2024 09:14:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVUNI5dNKURMuUf1uEYvUgVvA5W4xV+N88OpAkBrqm1hnq31fIpesIJo0UaM4ns4aP0RUpalEYT+ZPxCnRZK83Y9qfYr5KWAZEjQSYSlA== X-Google-Smtp-Source: AGHT+IF7h4e1RVP6RKy0hIGSypqSKx8rc2LKmzBDaBm7S+JSvar7cCzPaYsluovHV/WXmu5Fu7Nf X-Received: by 2002:aa7:d513:0:b0:564:470f:dbc8 with SMTP id y19-20020aa7d513000000b00564470fdbc8mr3308304edq.28.1708881271942; Sun, 25 Feb 2024 09:14:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708881271; cv=pass; d=google.com; s=arc-20160816; b=GyozHnDS2a/LwH/UaFmG3gI8SLWxGvUwrU8WlFcbmiIGElwtj6weTMIUTYZHQdliEX eOt/dGzTtQX7+wVEapDPrfP+/Eople9z0+7tWIiVKJwwMrTkAZ0z/a8Lh34FVvQ1hspY 5+DSW9bEfRLtPbQ7M33W3dHBtvHU9gKo5kU+07HH/OsK/dSBIGIk9WFAa/sveTlmuOzf M8tyX76tZJbQRs/jcJwSTnBvSaaqL4cD9ZQhPZUW6VaIqmqmV9m9ZTbjQlSyZJ1wko7E fu7ZJxUlqOkifi1lkhJG9uCkaw0pQHDpzIc75Z0fKgeZRIK+rfZbR5wQ/9k7UOkuFYvo 50oA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=0eZgSeXgV3xfMa5j0GZq4dgMO8aNM+WGN0zJZjS5h1g=; fh=99deIoyvm1nGqpySX1IWdz3ZXws9YcxdH2pYZhIEENo=; b=IlDqwCZGyTSUO4DvzC5J+CHdEDjLC7HE1sk3g5B+4rY5bAJA3GKtSpCvrWwx26nYwI zfnOxInOBtCrbnHKLW03pc4cRXhCbn5r9l0qaPsaG6jUgGWkyM3E6LQqcxPUe3te+PCN q0ZdTCbTMM7MZGuqaJrUiUjkSQ0Y1zTIxJNpdbUwabJW1pEqPC3Tshs5VbkC1hpubqsf gOVljbk0uRVbj/3JRV+ZJxg77kiLWVXvkC0AxiowQVBJ+ldG77g41f1esNyWJUgsODKi 6yr5v7z1RovWXClsQsmLMJ2B95qc8qJj2jkxFTh6Gm4LTo090dzk/nMkSGipHNoOsO4F CVsA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=DpqlcBhM; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-80223-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80223-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b7-20020aa7cd07000000b00563cf3114d0si1307042edw.426.2024.02.25.09.14.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 09:14:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80223-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=DpqlcBhM; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-80223-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80223-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B2FE31F2197F for ; Sun, 25 Feb 2024 17:14:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 89F06199B8; Sun, 25 Feb 2024 17:14:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="DpqlcBhM" Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E78CD18AF9 for ; Sun, 25 Feb 2024 17:14:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708881257; cv=none; b=LjfezynKV522AOiBMmXwKWQmZwXatnXIFeDzDtXrRmO9zvWWKdP+0saZSab4OIKHNxGKjz5GzmcFexNa9GlF6Erdf/y7ArO6TvGMb4T1jgSu7JJCX1uqhBVRvV22/JxEga1RYmZV302GfZ1DJNvsyZvaT7qTTz7GewGhJ5kgwY0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708881257; c=relaxed/simple; bh=WWHe62jqpP7qRkfkrLQuEDOnSdiAq/+HGLtVLP+TA+c=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=X4goSVlzZ6nguYp+uwVqo/EyW6IsKpekpOaC+zqjNsPOSNH2sW71vy/juLvGG8+/sUTQJqrYnJ2pfum4eV+7rbd5peKxysazVJZVDZIQtQt9YepvpE/Jgh1FYWG7ImBDRRzSIzbeEDJd/8xV//0d5kJjeEsRXgFCTHFiCAIhE/w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=DpqlcBhM; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a3f893ad5f4so334598866b.2 for ; Sun, 25 Feb 2024 09:14:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1708881254; x=1709486054; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0eZgSeXgV3xfMa5j0GZq4dgMO8aNM+WGN0zJZjS5h1g=; b=DpqlcBhMhLvtUpYRG+XScFGBv00VhXEQ5QUMSjnWXs3FaOF6AyB3DWV0wfs2oQbZJ4 9QRGb99QBH79/DE/uZ7vLv94zt0ApT5kYvA7/znY+RlgUA/GnGFC7FuxIvhHCK/tiFeT mymG87sOzZpru/vrlHCq5K2UXkvUqNCWLaeoQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708881254; x=1709486054; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0eZgSeXgV3xfMa5j0GZq4dgMO8aNM+WGN0zJZjS5h1g=; b=GfbuJWzIR4kV3bIrfSd3UYtIb+A23oUd5KEHL1q/tWDEiaw6MjRBtGZQAAgqBz3CPq 4KmtNiKvS3AvZ5hBVwJh9Z5e4FfTOGW0AR31Re962jLeA6xHjgVIvL1OerYAwxRda+7o mugxp8uEs1aa1tpKymyX038nH8st2s8vj/3xWpQ2e1hgg+0P1Vlg7PsQ1pcDpilJR87c RqUUTpngSj6j73dJZADuQsoPp4vpG8DAskIkD2h6I6uhk81WYpnw2cx9RDHGKUNOBcwp b8BcFgY90dPlG9hUM2q/MCxD8y/K/uFjnkDTulsIys5AqIwPWs5377qdCPA063wCiEfq SWjw== X-Gm-Message-State: AOJu0Yy3D4O1zaoc8gzG+WeJsBSYyJkqtrfK9hXPLfGf+zoYVNVZlKnt 962mesPxJ+Y9h4F0YBUcuYbZKufaQ+SaXfCRCpEkwKlLZtA/h0pdC1W27fJDBpvYkfrTdnT04W+ SeMFTUQ== X-Received: by 2002:a17:906:f55:b0:a3b:eaa3:ecc4 with SMTP id h21-20020a1709060f5500b00a3beaa3ecc4mr3239790ejj.60.1708881254184; Sun, 25 Feb 2024 09:14:14 -0800 (PST) Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com. [209.85.208.54]) by smtp.gmail.com with ESMTPSA id qk8-20020a170906d9c800b00a3f1cb81dc6sm1618674ejb.84.2024.02.25.09.14.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 25 Feb 2024 09:14:13 -0800 (PST) Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-564fc495d83so2607748a12.0 for ; Sun, 25 Feb 2024 09:14:13 -0800 (PST) X-Received: by 2002:a17:906:4f01:b0:a43:1201:6287 with SMTP id t1-20020a1709064f0100b00a4312016287mr1617440eju.73.1708881252681; Sun, 25 Feb 2024 09:14:12 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <0fff52305e584036a777f440b5f474da@AcuMS.aculab.com> In-Reply-To: From: Linus Torvalds Date: Sun, 25 Feb 2024 09:13:56 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH next v2 08/11] minmax: Add min_const() and max_const() To: David Laight Cc: "linux-kernel@vger.kernel.org" , Netdev , "dri-devel@lists.freedesktop.org" , Jens Axboe , "Matthew Wilcox (Oracle)" , Christoph Hellwig , "linux-btrfs@vger.kernel.org" , Andrew Morton , Andy Shevchenko , "David S . Miller" , Dan Carpenter , Jani Nikula Content-Type: text/plain; charset="UTF-8" On Sun, 25 Feb 2024 at 08:53, David Laight wrote: > > The expansions of min() and max() contain statement expressions so are > not valid for static intialisers. > min_const() and max_const() are expressions so can be used for static > initialisers. I hate the name. Naming shouldn't be about an implementation detail, particularly not an esoteric one like the "C constant expression" rule. That can be useful for some internal helper functions or macros, but not for something that random people are supposed to USE. Telling some random developer that inside an array size declaration or a static initializer you need to use "max_const()" because it needs to syntactically be a constant expression, and our regular "max()" function isn't that, is just *horrid*. No, please just use the traditional C model of just using ALL CAPS for macro names that don't act like a function. Yes, yes, that may end up requiring getting rid of some current users of #define MIN(a,b) ((a)<(b) ? (a):(b)) but dammit, we don't actually have _that_ many of them, and why should we have random drivers doing that anyway? Linus