From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 5D9791DB54C for ; Sun, 28 Dec 2025 22:50:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766962210; cv=none; b=I37uFFAi9/VKHL6p+0bD3H5yvjP7ryWmZPz7Eg8ij+ydc+yLrzm3D+iYcbA0c+/eYEyfk0SpnxVgJYrDJ5YZ2fa18UrHM4RHVhlqWqviutmz9TVF58D9gPBR0WKkDWjUka1ViVTWwf61WcZcHYaKGumxR3gWOjuMk2wHSvZzjtc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766962210; c=relaxed/simple; bh=9KgZlOWCyyz97q21E9W8EANe41Dc0IJ33MJtTZbxqmI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kht8GQ7JUdsROZSYJmsh7YCd8hKLY71UwvZsHDLmiYcUOx3eURQIaAGbTH1ruCkvxZ7EKf91yj5bihxjFp1E2HDZTtvseJTHz5lI8fWnmlRa55ogwL7mHJNUrs6qgH3W9TowMrKjY4jj21JyOn08MPwL8d2OZIl9KYVgFqtdz2w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WrvU2ZKk; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WrvU2ZKk" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-42fb5810d39so5066455f8f.2 for ; Sun, 28 Dec 2025 14:50:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766962207; x=1767567007; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=dLa9rIWMcGJ8cd3NrQlUFNZ6zmYa0bxNCj5XPgKm3rs=; b=WrvU2ZKkHWaMlv7oRkd+S+QEtyC1YuhJKXO7LueTJvIn//5dwNhQ4G8JtP2icFhnPx Gz4/ji3vdh/OTs91Ww+RboZbn9yTv0bdQCUtdEDeffvUG6mJAZpUywRn4THuOIsQlWku wSpjJgwH3siDX0WafPL4SJFBMeaFj93tfsHooD4ra27hvT2UZdYtr76tks1s+1EPIGMe /5Y8CtNk5G84L5xS21viUSTYS5jyXajv95Tj2typ46M9gB6LPYA74QkiWXlR6ldxVKUi diEpWgSyO+pI88uWaTW6oH1XBjTw3A4LpcaBn6bb8DMRux2uTTAJ2YTtbyLO7x1a8Iob l4UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766962207; x=1767567007; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dLa9rIWMcGJ8cd3NrQlUFNZ6zmYa0bxNCj5XPgKm3rs=; b=Ol6ISyOwpEuvXFV/BZ+R90cdX0b1GUEAFGyxPgpBJG3GbFBNBlOPUHp6Tc6PkiFqNb r6i+RuT5DV/42P2Gzx9WteHl4ADKmonnv7G/h7pU+HmhPk4om5Aj414JRAIDMI6Si93j ktqZausgrKu8592CRxvMi1DgO1XHyi/6wGotoT9O+RDbfJeXP2n3cs4pVZOPnLvavTYg 2RPDqmZGaYqZVJzo20YuxVy2sDSDJSthyDnL1zFQOX77Cz9k+g/ZtJXqrAqSFUKEMQa0 4jKTKTyDrLttFrIH7WAToAYSvG1m6Zm+VRDxehcSS6s4oZzVe68HCujKJ3ZSbD6B8lkP 7TwQ== X-Forwarded-Encrypted: i=1; AJvYcCUaVV8WUJ7g940b6IOOKJyzbLAtsStjgw5cOpTLw/+6AxepHoQhHbgKHH72KJmrzh45w5LldZa03LYR4IM=@vger.kernel.org X-Gm-Message-State: AOJu0YyBJCb/bQjb53d5q2JOqjcww0Dr25KV0L9HLaspFKTu53a5WrDv PlVzpwMjtsEofgfWfD7zxEgPjOeAwe0jqj2lTINZUBm/nxICE9Any7vm X-Gm-Gg: AY/fxX4tj7aUPemsoKcDbzjRZpQt+IwBUPR5CvBPIFaZ8z1jiid0GBuBxND8CwMeaVW WKk4BHaqHj2UiBrmVzu/PCqInMz0E1YaibPCOPKfi/UGc0Ws987aBCihz+GGQKuTGdOxJEsEcO0 I4cLhyDZsTDfWsYm67kmfP26C/ufDCeP1Z1UL6uq6gguGZszza179X70K8BoPHuhwZuUTlDSW7+ Ymq/pFf7tS6fybJIuiNHqDo4EXEsFQEn1pNd1oEXgzePsWaa4/EowWFo+h+f9mDOjwQJ7Mfwdzm 5Cf+WVRS3IadvsRCCrQm3D6xptfNoMNZXBK7QFC/sIm4yzC4kndbxZoW6sTCRf5fZfiJbWWTpgr 1zAK89dP8sPiwWvSFuX6jWjcfMWfshrdP8POFLRr9RTn4wDhV3rrKXk/SsAu97PKHKBG2GePNYe 0SeRzgoc2nnwRL4FzhtF4pHiTUNPUdKwFLTTok9BytTehx0VSAWgNi X-Google-Smtp-Source: AGHT+IGDmQFJXpTex84Sjvl3OcjyzaSsuGGpBNcSV45EAoewFsb1Yr42jHw1dToXppS6Ot5xXmfiDQ== X-Received: by 2002:adf:f70b:0:b0:432:5c43:64 with SMTP id ffacd0b85a97d-4325c4302c7mr23626302f8f.41.1766962206674; Sun, 28 Dec 2025 14:50:06 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324eab33f5sm59078509f8f.41.2025.12.28.14.50.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Dec 2025 14:50:06 -0800 (PST) Date: Sun, 28 Dec 2025 22:50:04 +0000 From: David Laight To: Andy Shevchenko Cc: Jonathan Cameron , Yury Norov , Rasmus Villemoes , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Geert Uytterhoeven , Alexandre Belloni , Crt Mori , Richard Genoud , Luo Jie , Peter Zijlstra , Jakub Kicinski , netdev@vger.kernel.org, "David S . Miller" , Mika Westerberg , Andreas Noever , Yehezkel Bernat , Nicolas Frattaroli Subject: Re: [PATCH v2 08/16] bitfield: Simplify __BF_FIELD_CHECK_REG() Message-ID: <20251228225004.69a6972f@pumpkin> In-Reply-To: References: <20251212193721.740055-1-david.laight.linux@gmail.com> <20251212193721.740055-9-david.laight.linux@gmail.com> <20251217102618.0000465f@huawei.com> <20251217223155.52249236@pumpkin> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 28 Dec 2025 20:53:45 +0200 Andy Shevchenko wrote: > On Wed, Dec 17, 2025 at 10:31:55PM +0000, David Laight wrote: > > On Wed, 17 Dec 2025 10:26:18 +0000 > > Jonathan Cameron wrote: > > > On Fri, 12 Dec 2025 19:37:13 +0000 > > > david.laight.linux@gmail.com wrote: > > ... > > > > > + BUILD_BUG_ON_MSG((mask) + 0U + 0UL + 0ULL > \ > > > > + ~0ULL >> (64 - 8 * sizeof (reg)), \ > > > > > > Trivial. sizeof(reg) is much more comment syntax in kernel code. > > (common) > > > > Hmm. sizeof is an operator not a function. > > Its argument is either a variable/expression or a bracketed type > > (I don't usually put variables in brackets). > > So 'sizeof(reg)' is nearly as bad as 'return(reg)'. > > Yet, it's a style used de facto in the Linux kernel. I am with Jonathan on this. Not hard to change :-) There is a more interesting question as to whether that check is needed at all? It is only really the sanity checks (and the fact that __builtin_ffs() is sub-optimal) that stop the functions being 'reasonable' for non-constant values. David