From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) (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 008F026ED3E for ; Wed, 19 Nov 2025 14:50:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763563835; cv=none; b=sWYSI/C7D7sBRSMieSuP5ov0LZecPV9/51YI/LT8tznKZFa99pTOedUowa0aE3yiHEQPGOsAdRkczbKF3j5FktPyfUkUUJwHp+NEACLAfXaTt0KIS0cJ0V+99V4XkssRZpAGcsvyFgrVW5BCmUvur++XFEr8pYNNfJFLkkXgaG4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763563835; c=relaxed/simple; bh=1Wruu9gggvjosYoKum2V+cZ9fCd6dFFd/5SKcpbFf7A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=R3KHJqCLqdgXKVav/Ysuve1i5fAOq0SZyfDGwy6BBUvbdXe26XXPwJ5iWPo33aFQQoCKa5EOiPzDJrSzGB6rbN1Q0T29HuU/g4H2MiNIGDHBAR/PGDvyRp3COvM7eZJeSZfFF1+pFHWMczF/BBh2GREz0kgQFJel2wYkAUGMUEc= 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=SsmAN0H0; arc=none smtp.client-ip=209.85.219.43 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="SsmAN0H0" Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-88051279e87so72247906d6.3 for ; Wed, 19 Nov 2025 06:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763563832; x=1764168632; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=UEa5dU5h8VTkStggLA2EFBcu8SFqsu0VyRflw3qSQbY=; b=SsmAN0H0dW4pniwEPfi7ntnomTvrnK0bOh98GRqlM66jfMIRrCCmEP2AvXC3HRRCmV 7g/qWz/7yxs1plOWoLSgEZFqXqMOfVAES46UCC3gAbXavKi2qNkqks9VPXfNYmkzGuFd Q5I9V127jwdVG17TFwwx5snj3oIsqDAQ4U3ZDMIjFeJBPC1kDbDek9H08MwcYqowfH2y OG+QJJFzNqeD0YdjzmGTC9LhWa1frGuIlT1/8whm+I2RPHXYOfLqG7/tExznEqIkOaLF MVab0MlufwIXjF/3XH8b7kl/bcvgJoS2Kb6Zaia++StlKQIiiuC3nKR94iY+PKgXA6a8 5wbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763563832; x=1764168632; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UEa5dU5h8VTkStggLA2EFBcu8SFqsu0VyRflw3qSQbY=; b=jdxNsjeRPGPtnUVLyLF/BluIFOS+TojaZkcn9KIESGn9y8WkSK37VsgAjU2z+LL/rB m5zBU0g3V73gG9Czaq0Wv10/ujzUlc85U8tK9McpH0wALmiIrmlzogyY1e//MMR38cHV 5emuMBXMk6aqfupbnqLpGRADfvTkUiqAvbKXuY0NTsfiDuypWfZqyOpCfYxBeZUcYyif G14OiQQAP3CpZ+9YR1WPg0Al86sv6oAUUXUTp43rhOgxYM4uOQHow1csRbOG0HUf0kaU xkbtswIc9DToUnjuKyIflaeMIsn6kiRCmokugx6saxKkcZNyI7Od30IKDSN9UEjibcbx nOJw== X-Forwarded-Encrypted: i=1; AJvYcCXqeLDqNVljquVO/iGEJGJFM1aYgls5Dgmbh5alr71p0tJF13AlZnHL79mXQBQtpIS8nkIQGXfLzaSrVlM=@vger.kernel.org X-Gm-Message-State: AOJu0YxNvTpAiDxCYzfrdE0UNvTdO4vfes7L0EEImoyMBrZmFwEGyFnm kkSSwGadoMEFvZDPZM2uC6bK/7mpFJTW5vVbvUSJ53aoEMfb3NuvtQeO X-Gm-Gg: ASbGncvp5pRvWvvMnLj9+zTW+axsjWUj2q/wMehmKn8T/VVZvXRXLu+D2tkF8BG1o34 mZDKXsdgD+G/1Y08HwrVyZ20mEFAyiLX3d8xLn1WjzJRR27TndghcrOrk7Vpuk+ik/cG4GG5DTd pseQHlf9JA64PCsMnqjoqWZj6SEo7386lF3MmoGTI4KNJ0gBMt4Hyq4qzv34LMWtEoTttdgpXwS Bct7RWM3yVIwEvMZdXVXDCap22VKUW7M7zkq8BX5MSs1gRywtOnNPGpwKsUsxIMDboD3UTvmiBw gC87b7hg3LX7J1nxs54FZYXB2FI/8zo2hhsT5awcKN3KQociLW4KAdThHyWu1heM7XF7DNqmQO6 AF3THJfS+74nZN5L1JTm8fVzwusYpLkl5ExzfIRVSn2XljNecAgNMj9ZJAd+PW8XNp1jYosTb+Q g4J8Sqby+r2f22Z7IgGA== X-Google-Smtp-Source: AGHT+IEl27VY0Fzg06WvTYKsPnTaG3CI8XR1O4Jx2OOSNMzexShqbizbMp95FvmlDbVG54xJ6MBR9A== X-Received: by 2002:a05:6214:529d:b0:882:49f4:da25 with SMTP id 6a1803df08f44-8829269e07bmr301776726d6.39.1763563831679; Wed, 19 Nov 2025 06:50:31 -0800 (PST) Received: from localhost ([12.22.141.131]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-882862d04e1sm135929226d6.7.2025.11.19.06.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Nov 2025 06:50:31 -0800 (PST) Date: Wed, 19 Nov 2025 09:50:30 -0500 From: Yury Norov To: Geert Uytterhoeven Cc: Michael Turquette , Stephen Boyd , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Giovanni Cabiddu , Herbert Xu , David Miller , Linus Walleij , Bartosz Golaszewski , Joel Stanley , Andrew Jeffery , Crt Mori , Jonathan Cameron , Lars-Peter Clausen , Jacky Huang , Shan-Chun Hung , Rasmus Villemoes , Jaroslav Kysela , Takashi Iwai , Johannes Berg , Jakub Kicinski , Alex Elder , David Laight , Vincent Mailhol , Jason Baron , Borislav Petkov , Tony Luck , Michael Hennerich , Kim Seer Paller , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Richard Genoud , Cosmin Tanislav , Biju Das , Jianping Shen , Nathan Chancellor , Nick Desaulniers , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-crypto@vger.kernel.org, linux-edac@vger.kernel.org, qat-linux@intel.com, linux-gpio@vger.kernel.org, linux-aspeed@lists.ozlabs.org, linux-iio@vger.kernel.org, linux-sound@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 00/26] Non-const bitfield helpers Message-ID: References: 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-Disposition: inline In-Reply-To: On Thu, Nov 06, 2025 at 11:45:02AM -0500, Yury Norov wrote: > On Thu, Nov 06, 2025 at 02:33:48PM +0100, Geert Uytterhoeven wrote: > > Hi all, > > > > contains various helpers for accessing bitfields, as > > typically used in hardware registers for memory-mapped I/O blocks. > > These helpers ensure type safety, and deduce automatically shift values > > from mask values, avoiding mistakes due to inconsistent shifts and > > masks, and leading to a reduction in source code size. > > > > The existing FIELD_{GET,PREP}() macros are limited to compile-time > > constants. However, it is very common to prepare or extract bitfield > > elements where the bitfield mask is not a compile-time constant (e.g. it > > comes from a table, or is created by shifting a compile-time constant). > > To avoid this limitation, the AT91 clock driver introduced its own > > field_{prep,get}() macros. During the past four years, these have been > > copied to multiple drivers, and more copies are on their way[1], leading > > to the obvious review comment "please move this to ". > > > > Hence this series > > 1. Takes preparatory steps in drivers definining local > > field_{get,prep}() macros (patches 1-11), > > 2. Introduces __FIELD_{PREP,GET}() helpers to avoid clang W=1 warnings > > (patch 12), > > 3. Makes field_{prep,get}() available for general use (patch 13), > > 4. Converts drivers with local variants to the common helpers (patches > > 14-24), > > 5. Converts a few Renesas drivers to the existing FIELD_{GET,PREP}() > > and the new field_{get,prep}() helpers (patches 25-26). > > > > Alternatives would be to use the typed {u*,be*,le*,...}_{get,encode}_bits() > > macros instead (which currently do not work with non-constant masks > > either, and the first attempt to change that generates much worse code), > > or to store the low bit and width of the mask instead (which would > > require changing all code that passes masks directly, and also generates > > worse code). > > Everyone please send your tags. I'm going to merge it in > bitmap-for-next before Monday. Fortunately I didn't specify the exact Monday. :) Now it's in my tree for local testing: https://github.com/norov/linux/tree/field-prep-for-6.19 Will move in bitmap-for-next shortly. Thanks, Yury