From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
linux-aspeed@lists.ozlabs.org,
Liam Girdwood <lgirdwood@gmail.com>,
Tony Lindgren <tony@atomide.com>,
linux-wireless@vger.kernel.org,
Michael Turquette <mturquette@baylibre.com>,
Amit Kucheria <amitk@kernel.org>,
alsa-devel@alsa-project.org,
Adrian Hunter <adrian.hunter@intel.com>,
linux-clk@vger.kernel.org, Ping-Ke Shih <pkshih@realtek.com>,
Lars-Peter Clausen <lars@metafoo.de>,
openbmc@lists.ozlabs.org,
"Rafael J . Wysocki" <rafael@kernel.org>,
Magnus Damm <magnus.damm@gmail.com>,
Russell King <linux@armlinux.org.uk>,
linux-iio@vger.kernel.org,
Ludovic Desroches <ludovic.desroches@microchip.com>,
Joel Stanley <joel@jms.id.au>, Jakub Kicinski <kuba@kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-media@vger.kernel.org, linux-omap@vger.kernel.org,
Benoit Parrot <bparrot@ti.com>,
linux-gpio@vger.kernel.org, Mark Brown <broonie@kernel.org>,
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
Takashi Iwai <tiwai@suse.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Kalle Valo <kvalo@codeaurora.org>,
linux-arm-kernel@lists.infradead.org,
Eduardo Valentin <edubezval@gmail.com>,
Paul Walmsley <paul@pwsan.com>,
Rajendra Nayak <rnayak@codeaurora.org>,
Tero Kristo <kristo@kernel.org>, Andrew Jeffery <andrew@aj.id.au>,
Keerthy <j-keerthy@ti.com>,
linux-pm@vger.kernel.org, linux-mmc@vger.kernel.org,
Nicolas Ferre <nicolas.ferre@microchip.com>,
linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Stephen Boyd <sboyd@kernel.org>,
netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Jonathan Cameron <jic23@kernel.org>
Subject: Re: [PATCH 00/17] Non-const bitfield helper conversions
Date: Mon, 22 Nov 2021 18:50:19 +0100 [thread overview]
Message-ID: <YZvYW1ElW7ZYZNTC@piout.net> (raw)
In-Reply-To: <cover.1637592133.git.geert+renesas@glider.be>
On 22/11/2021 16:53:53+0100, Geert Uytterhoeven wrote:
> Hi all,
>
> <linux/bitfield.h> 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.
>
> I have already submitted a few conversions to the FIELD_{GET,PREP}()
> helpers that were fixes for real bugs:
> - [PATCH] mips: cm: Convert to bitfield API to fix out-of-bounds
> access
> https://lore.kernel.org/r/0471c545117c5fa05bd9c73005cda9b74608a61e.1635501373.git.geert+renesas@glider.be
> - [PATCH] drm/armada: Fix off-by-one error in
> armada_overlay_get_property()
> https://lore.kernel.org/r/5818c8b04834e6a9525441bc181580a230354b69.1635501237.git.geert+renesas@glider.be
>
> Plus several patches for normal conversions:
> - [PATCH] ARM: ptrace: Use bitfield helpers
> https://lore.kernel.org/r/a1445d3abb45cfc95cb1b03180fd53caf122035b.1637593297.git.geert+renesas@glider.be
> - [PATCH] MIPS: CPC: Use bitfield helpers
> https://lore.kernel.org/r/35f0f17e3d987afaa9cd09cdcb8131d42a53c3e1.1637593297.git.geert+renesas@glider.be
> - [PATCH] MIPS: CPS: Use bitfield helpers
> https://lore.kernel.org/r/8bd8b1b9a3787e594285addcf2057754540d0a5f.1637593297.git.geert+renesas@glider.be
> - [PATCH] crypto: sa2ul - Use bitfield helpers
> https://lore.kernel.org/r/ca89d204ef2e40193479db2742eadf0d9cf3c0ff.1637593297.git.geert+renesas@glider.be
> - [PATCH] dmaengine: stm32-mdma: Use bitfield helpers
> https://lore.kernel.org/r/36ceab242a594233dc7dc6f1dddb4ac32d1e846f.1637593297.git.geert+renesas@glider.be
> - [PATCH] intel_th: Use bitfield helpers
> https://lore.kernel.org/r/b1e4f027aa88acfbdfaa771b0920bd1d977828ba.1637593297.git.geert+renesas@glider.be
> - [PATCH] Input: palmas-pwrbutton - use bitfield helpers
> https://lore.kernel.org/r/f8831b88346b36fc6e01e0910d0db6c94287d2b4.1637593297.git.geert+renesas@glider.be
> - [PATCH] irqchip/mips-gic: Use bitfield helpers
> https://lore.kernel.org/r/74f9d126961a90d3e311b92a54870eaac5b3ae57.1637593297.git.geert+renesas@glider.be
> - [PATCH] mfd: mc13xxx: Use bitfield helpers
> https://lore.kernel.org/r/afa46868cf8c1666e9cbbbec42767ca2294b024d.1637593297.git.geert+renesas@glider.be
> - [PATCH] regulator: lp873x: Use bitfield helpers
> https://lore.kernel.org/r/44d60384b640c8586b4ca7edbc9287a34ce21c5b.1637593297.git.geert+renesas@glider.be
> - [PATCH] regulator: lp87565: Use bitfield helpers
> https://lore.kernel.org/r/941c2dfd5b5b124b8950bcce42db4c343dfe9821.1637593297.git.geert+renesas@glider.be
>
> 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.
> To avoid this limitation, the AT91 clock driver already has its own
> field_{prep,get}() macros.
>
My understanding was that this (being compile time only) was actually
done on purpose. Did I misunderstand?
> This patch series makes them available for general use, and converts
> several drivers to the existing FIELD_{GET,PREP}() and the new
> field_{get,prep}() helpers.
>
> I can take the first two patches through the reneas-clk tree for v5.17,
> but probably it is best for the remaining patches to be postponed to
> v5.18.
>
> Thanks for your comments!
>
> Geert Uytterhoeven (17):
> bitfield: Add non-constant field_{prep,get}() helpers
> clk: renesas: Use bitfield helpers
> [RFC] soc: renesas: Use bitfield helpers
> [RFC] ARM: OMAP2+: Use bitfield helpers
> [RFC] bus: omap_l3_noc: Use bitfield helpers
> [RFC] clk: ti: Use bitfield helpers
> [RFC] iio: st_sensors: Use bitfield helpers
> [RFC] iio: humidity: hts221: Use bitfield helpers
> [RFC] iio: imu: st_lsm6dsx: Use bitfield helpers
> [RFC] media: ti-vpe: cal: Use bitfield helpers
> [RFC] mmc: sdhci-of-aspeed: Use bitfield helpers
> [RFC] pinctrl: aspeed: Use bitfield helpers
> [RFC] pinctl: ti: iodelay: Use bitfield helpers
> [RFC] regulator: ti-abb: Use bitfield helpers
> [RFC] thermal/ti-soc-thermal: Use bitfield helpers
> [RFC] ALSA: ice1724: Use bitfield helpers
> [RFC] rtw89: Use bitfield helpers
>
> arch/arm/mach-omap2/clkt2xxx_dpllcore.c | 5 +-
> arch/arm/mach-omap2/cm2xxx.c | 11 ++-
> arch/arm/mach-omap2/cm2xxx_3xxx.h | 9 +--
> arch/arm/mach-omap2/cm33xx.c | 9 +--
> arch/arm/mach-omap2/cm3xxx.c | 7 +-
> arch/arm/mach-omap2/cminst44xx.c | 9 +--
> arch/arm/mach-omap2/powerdomains3xxx_data.c | 3 +-
> arch/arm/mach-omap2/prm.h | 2 -
> arch/arm/mach-omap2/prm2xxx.c | 4 +-
> arch/arm/mach-omap2/prm2xxx_3xxx.c | 7 +-
> arch/arm/mach-omap2/prm2xxx_3xxx.h | 9 +--
> arch/arm/mach-omap2/prm33xx.c | 53 +++++-------
> arch/arm/mach-omap2/prm3xxx.c | 3 +-
> arch/arm/mach-omap2/prm44xx.c | 53 ++++--------
> arch/arm/mach-omap2/vc.c | 12 +--
> arch/arm/mach-omap2/vp.c | 11 +--
> drivers/bus/omap_l3_noc.c | 4 +-
> drivers/clk/at91/clk-peripheral.c | 1 +
> drivers/clk/at91/pmc.h | 3 -
> drivers/clk/renesas/clk-div6.c | 6 +-
> drivers/clk/renesas/r8a779a0-cpg-mssr.c | 9 +--
> drivers/clk/renesas/rcar-gen3-cpg.c | 15 ++--
> drivers/clk/ti/apll.c | 25 +++---
> drivers/clk/ti/dpll3xxx.c | 81 ++++++++-----------
> .../iio/common/st_sensors/st_sensors_core.c | 5 +-
> drivers/iio/humidity/hts221_core.c | 8 +-
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 1 -
> .../iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 7 +-
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 45 +++++------
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 11 +--
> drivers/media/platform/ti-vpe/cal.h | 4 +-
> drivers/mmc/host/sdhci-of-aspeed.c | 5 +-
> drivers/net/wireless/realtek/rtw89/core.h | 38 ++-------
> drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c | 3 +-
> drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 3 +-
> drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c | 3 +-
> drivers/pinctrl/aspeed/pinctrl-aspeed.c | 5 +-
> drivers/pinctrl/aspeed/pinmux-aspeed.c | 6 +-
> drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 35 +++-----
> drivers/regulator/ti-abb-regulator.c | 7 +-
> drivers/soc/renesas/renesas-soc.c | 4 +-
> drivers/thermal/ti-soc-thermal/ti-bandgap.c | 11 ++-
> include/linux/bitfield.h | 30 +++++++
> sound/pci/ice1712/wm8766.c | 14 ++--
> sound/pci/ice1712/wm8776.c | 14 ++--
> 45 files changed, 263 insertions(+), 347 deletions(-)
>
> --
> 2.25.1
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: linux-aspeed@lists.ozlabs.org
Subject: [PATCH 00/17] Non-const bitfield helper conversions
Date: Mon, 22 Nov 2021 18:50:19 +0100 [thread overview]
Message-ID: <YZvYW1ElW7ZYZNTC@piout.net> (raw)
In-Reply-To: <cover.1637592133.git.geert+renesas@glider.be>
On 22/11/2021 16:53:53+0100, Geert Uytterhoeven wrote:
> Hi all,
>
> <linux/bitfield.h> 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.
>
> I have already submitted a few conversions to the FIELD_{GET,PREP}()
> helpers that were fixes for real bugs:
> - [PATCH] mips: cm: Convert to bitfield API to fix out-of-bounds
> access
> https://lore.kernel.org/r/0471c545117c5fa05bd9c73005cda9b74608a61e.1635501373.git.geert+renesas at glider.be
> - [PATCH] drm/armada: Fix off-by-one error in
> armada_overlay_get_property()
> https://lore.kernel.org/r/5818c8b04834e6a9525441bc181580a230354b69.1635501237.git.geert+renesas at glider.be
>
> Plus several patches for normal conversions:
> - [PATCH] ARM: ptrace: Use bitfield helpers
> https://lore.kernel.org/r/a1445d3abb45cfc95cb1b03180fd53caf122035b.1637593297.git.geert+renesas at glider.be
> - [PATCH] MIPS: CPC: Use bitfield helpers
> https://lore.kernel.org/r/35f0f17e3d987afaa9cd09cdcb8131d42a53c3e1.1637593297.git.geert+renesas at glider.be
> - [PATCH] MIPS: CPS: Use bitfield helpers
> https://lore.kernel.org/r/8bd8b1b9a3787e594285addcf2057754540d0a5f.1637593297.git.geert+renesas at glider.be
> - [PATCH] crypto: sa2ul - Use bitfield helpers
> https://lore.kernel.org/r/ca89d204ef2e40193479db2742eadf0d9cf3c0ff.1637593297.git.geert+renesas at glider.be
> - [PATCH] dmaengine: stm32-mdma: Use bitfield helpers
> https://lore.kernel.org/r/36ceab242a594233dc7dc6f1dddb4ac32d1e846f.1637593297.git.geert+renesas at glider.be
> - [PATCH] intel_th: Use bitfield helpers
> https://lore.kernel.org/r/b1e4f027aa88acfbdfaa771b0920bd1d977828ba.1637593297.git.geert+renesas at glider.be
> - [PATCH] Input: palmas-pwrbutton - use bitfield helpers
> https://lore.kernel.org/r/f8831b88346b36fc6e01e0910d0db6c94287d2b4.1637593297.git.geert+renesas at glider.be
> - [PATCH] irqchip/mips-gic: Use bitfield helpers
> https://lore.kernel.org/r/74f9d126961a90d3e311b92a54870eaac5b3ae57.1637593297.git.geert+renesas at glider.be
> - [PATCH] mfd: mc13xxx: Use bitfield helpers
> https://lore.kernel.org/r/afa46868cf8c1666e9cbbbec42767ca2294b024d.1637593297.git.geert+renesas at glider.be
> - [PATCH] regulator: lp873x: Use bitfield helpers
> https://lore.kernel.org/r/44d60384b640c8586b4ca7edbc9287a34ce21c5b.1637593297.git.geert+renesas at glider.be
> - [PATCH] regulator: lp87565: Use bitfield helpers
> https://lore.kernel.org/r/941c2dfd5b5b124b8950bcce42db4c343dfe9821.1637593297.git.geert+renesas at glider.be
>
> 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.
> To avoid this limitation, the AT91 clock driver already has its own
> field_{prep,get}() macros.
>
My understanding was that this (being compile time only) was actually
done on purpose. Did I misunderstand?
> This patch series makes them available for general use, and converts
> several drivers to the existing FIELD_{GET,PREP}() and the new
> field_{get,prep}() helpers.
>
> I can take the first two patches through the reneas-clk tree for v5.17,
> but probably it is best for the remaining patches to be postponed to
> v5.18.
>
> Thanks for your comments!
>
> Geert Uytterhoeven (17):
> bitfield: Add non-constant field_{prep,get}() helpers
> clk: renesas: Use bitfield helpers
> [RFC] soc: renesas: Use bitfield helpers
> [RFC] ARM: OMAP2+: Use bitfield helpers
> [RFC] bus: omap_l3_noc: Use bitfield helpers
> [RFC] clk: ti: Use bitfield helpers
> [RFC] iio: st_sensors: Use bitfield helpers
> [RFC] iio: humidity: hts221: Use bitfield helpers
> [RFC] iio: imu: st_lsm6dsx: Use bitfield helpers
> [RFC] media: ti-vpe: cal: Use bitfield helpers
> [RFC] mmc: sdhci-of-aspeed: Use bitfield helpers
> [RFC] pinctrl: aspeed: Use bitfield helpers
> [RFC] pinctl: ti: iodelay: Use bitfield helpers
> [RFC] regulator: ti-abb: Use bitfield helpers
> [RFC] thermal/ti-soc-thermal: Use bitfield helpers
> [RFC] ALSA: ice1724: Use bitfield helpers
> [RFC] rtw89: Use bitfield helpers
>
> arch/arm/mach-omap2/clkt2xxx_dpllcore.c | 5 +-
> arch/arm/mach-omap2/cm2xxx.c | 11 ++-
> arch/arm/mach-omap2/cm2xxx_3xxx.h | 9 +--
> arch/arm/mach-omap2/cm33xx.c | 9 +--
> arch/arm/mach-omap2/cm3xxx.c | 7 +-
> arch/arm/mach-omap2/cminst44xx.c | 9 +--
> arch/arm/mach-omap2/powerdomains3xxx_data.c | 3 +-
> arch/arm/mach-omap2/prm.h | 2 -
> arch/arm/mach-omap2/prm2xxx.c | 4 +-
> arch/arm/mach-omap2/prm2xxx_3xxx.c | 7 +-
> arch/arm/mach-omap2/prm2xxx_3xxx.h | 9 +--
> arch/arm/mach-omap2/prm33xx.c | 53 +++++-------
> arch/arm/mach-omap2/prm3xxx.c | 3 +-
> arch/arm/mach-omap2/prm44xx.c | 53 ++++--------
> arch/arm/mach-omap2/vc.c | 12 +--
> arch/arm/mach-omap2/vp.c | 11 +--
> drivers/bus/omap_l3_noc.c | 4 +-
> drivers/clk/at91/clk-peripheral.c | 1 +
> drivers/clk/at91/pmc.h | 3 -
> drivers/clk/renesas/clk-div6.c | 6 +-
> drivers/clk/renesas/r8a779a0-cpg-mssr.c | 9 +--
> drivers/clk/renesas/rcar-gen3-cpg.c | 15 ++--
> drivers/clk/ti/apll.c | 25 +++---
> drivers/clk/ti/dpll3xxx.c | 81 ++++++++-----------
> .../iio/common/st_sensors/st_sensors_core.c | 5 +-
> drivers/iio/humidity/hts221_core.c | 8 +-
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 1 -
> .../iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 7 +-
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 45 +++++------
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 11 +--
> drivers/media/platform/ti-vpe/cal.h | 4 +-
> drivers/mmc/host/sdhci-of-aspeed.c | 5 +-
> drivers/net/wireless/realtek/rtw89/core.h | 38 ++-------
> drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c | 3 +-
> drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 3 +-
> drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c | 3 +-
> drivers/pinctrl/aspeed/pinctrl-aspeed.c | 5 +-
> drivers/pinctrl/aspeed/pinmux-aspeed.c | 6 +-
> drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 35 +++-----
> drivers/regulator/ti-abb-regulator.c | 7 +-
> drivers/soc/renesas/renesas-soc.c | 4 +-
> drivers/thermal/ti-soc-thermal/ti-bandgap.c | 11 ++-
> include/linux/bitfield.h | 30 +++++++
> sound/pci/ice1712/wm8766.c | 14 ++--
> sound/pci/ice1712/wm8776.c | 14 ++--
> 45 files changed, 263 insertions(+), 347 deletions(-)
>
> --
> 2.25.1
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Tony Lindgren <tony@atomide.com>,
Russell King <linux@armlinux.org.uk>,
Rajendra Nayak <rnayak@codeaurora.org>,
Paul Walmsley <paul@pwsan.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Ludovic Desroches <ludovic.desroches@microchip.com>,
Tero Kristo <kristo@kernel.org>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
Benoit Parrot <bparrot@ti.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Andrew Jeffery <andrew@aj.id.au>,
Ulf Hansson <ulf.hansson@linaro.org>,
Joel Stanley <joel@jms.id.au>, Ping-Ke Shih <pkshih@realtek.com>,
Kalle Valo <kvalo@codeaurora.org>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Magnus Damm <magnus.damm@gmail.com>,
Eduardo Valentin <edubezval@gmail.com>,
Keerthy <j-keerthy@ti.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
linux-renesas-soc@vger.kernel.org, linux-iio@vger.kernel.org,
linux-media@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-pm@vger.kernel.org,
alsa-devel@alsa-project.org
Subject: Re: [PATCH 00/17] Non-const bitfield helper conversions
Date: Mon, 22 Nov 2021 18:50:19 +0100 [thread overview]
Message-ID: <YZvYW1ElW7ZYZNTC@piout.net> (raw)
In-Reply-To: <cover.1637592133.git.geert+renesas@glider.be>
On 22/11/2021 16:53:53+0100, Geert Uytterhoeven wrote:
> Hi all,
>
> <linux/bitfield.h> 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.
>
> I have already submitted a few conversions to the FIELD_{GET,PREP}()
> helpers that were fixes for real bugs:
> - [PATCH] mips: cm: Convert to bitfield API to fix out-of-bounds
> access
> https://lore.kernel.org/r/0471c545117c5fa05bd9c73005cda9b74608a61e.1635501373.git.geert+renesas@glider.be
> - [PATCH] drm/armada: Fix off-by-one error in
> armada_overlay_get_property()
> https://lore.kernel.org/r/5818c8b04834e6a9525441bc181580a230354b69.1635501237.git.geert+renesas@glider.be
>
> Plus several patches for normal conversions:
> - [PATCH] ARM: ptrace: Use bitfield helpers
> https://lore.kernel.org/r/a1445d3abb45cfc95cb1b03180fd53caf122035b.1637593297.git.geert+renesas@glider.be
> - [PATCH] MIPS: CPC: Use bitfield helpers
> https://lore.kernel.org/r/35f0f17e3d987afaa9cd09cdcb8131d42a53c3e1.1637593297.git.geert+renesas@glider.be
> - [PATCH] MIPS: CPS: Use bitfield helpers
> https://lore.kernel.org/r/8bd8b1b9a3787e594285addcf2057754540d0a5f.1637593297.git.geert+renesas@glider.be
> - [PATCH] crypto: sa2ul - Use bitfield helpers
> https://lore.kernel.org/r/ca89d204ef2e40193479db2742eadf0d9cf3c0ff.1637593297.git.geert+renesas@glider.be
> - [PATCH] dmaengine: stm32-mdma: Use bitfield helpers
> https://lore.kernel.org/r/36ceab242a594233dc7dc6f1dddb4ac32d1e846f.1637593297.git.geert+renesas@glider.be
> - [PATCH] intel_th: Use bitfield helpers
> https://lore.kernel.org/r/b1e4f027aa88acfbdfaa771b0920bd1d977828ba.1637593297.git.geert+renesas@glider.be
> - [PATCH] Input: palmas-pwrbutton - use bitfield helpers
> https://lore.kernel.org/r/f8831b88346b36fc6e01e0910d0db6c94287d2b4.1637593297.git.geert+renesas@glider.be
> - [PATCH] irqchip/mips-gic: Use bitfield helpers
> https://lore.kernel.org/r/74f9d126961a90d3e311b92a54870eaac5b3ae57.1637593297.git.geert+renesas@glider.be
> - [PATCH] mfd: mc13xxx: Use bitfield helpers
> https://lore.kernel.org/r/afa46868cf8c1666e9cbbbec42767ca2294b024d.1637593297.git.geert+renesas@glider.be
> - [PATCH] regulator: lp873x: Use bitfield helpers
> https://lore.kernel.org/r/44d60384b640c8586b4ca7edbc9287a34ce21c5b.1637593297.git.geert+renesas@glider.be
> - [PATCH] regulator: lp87565: Use bitfield helpers
> https://lore.kernel.org/r/941c2dfd5b5b124b8950bcce42db4c343dfe9821.1637593297.git.geert+renesas@glider.be
>
> 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.
> To avoid this limitation, the AT91 clock driver already has its own
> field_{prep,get}() macros.
>
My understanding was that this (being compile time only) was actually
done on purpose. Did I misunderstand?
> This patch series makes them available for general use, and converts
> several drivers to the existing FIELD_{GET,PREP}() and the new
> field_{get,prep}() helpers.
>
> I can take the first two patches through the reneas-clk tree for v5.17,
> but probably it is best for the remaining patches to be postponed to
> v5.18.
>
> Thanks for your comments!
>
> Geert Uytterhoeven (17):
> bitfield: Add non-constant field_{prep,get}() helpers
> clk: renesas: Use bitfield helpers
> [RFC] soc: renesas: Use bitfield helpers
> [RFC] ARM: OMAP2+: Use bitfield helpers
> [RFC] bus: omap_l3_noc: Use bitfield helpers
> [RFC] clk: ti: Use bitfield helpers
> [RFC] iio: st_sensors: Use bitfield helpers
> [RFC] iio: humidity: hts221: Use bitfield helpers
> [RFC] iio: imu: st_lsm6dsx: Use bitfield helpers
> [RFC] media: ti-vpe: cal: Use bitfield helpers
> [RFC] mmc: sdhci-of-aspeed: Use bitfield helpers
> [RFC] pinctrl: aspeed: Use bitfield helpers
> [RFC] pinctl: ti: iodelay: Use bitfield helpers
> [RFC] regulator: ti-abb: Use bitfield helpers
> [RFC] thermal/ti-soc-thermal: Use bitfield helpers
> [RFC] ALSA: ice1724: Use bitfield helpers
> [RFC] rtw89: Use bitfield helpers
>
> arch/arm/mach-omap2/clkt2xxx_dpllcore.c | 5 +-
> arch/arm/mach-omap2/cm2xxx.c | 11 ++-
> arch/arm/mach-omap2/cm2xxx_3xxx.h | 9 +--
> arch/arm/mach-omap2/cm33xx.c | 9 +--
> arch/arm/mach-omap2/cm3xxx.c | 7 +-
> arch/arm/mach-omap2/cminst44xx.c | 9 +--
> arch/arm/mach-omap2/powerdomains3xxx_data.c | 3 +-
> arch/arm/mach-omap2/prm.h | 2 -
> arch/arm/mach-omap2/prm2xxx.c | 4 +-
> arch/arm/mach-omap2/prm2xxx_3xxx.c | 7 +-
> arch/arm/mach-omap2/prm2xxx_3xxx.h | 9 +--
> arch/arm/mach-omap2/prm33xx.c | 53 +++++-------
> arch/arm/mach-omap2/prm3xxx.c | 3 +-
> arch/arm/mach-omap2/prm44xx.c | 53 ++++--------
> arch/arm/mach-omap2/vc.c | 12 +--
> arch/arm/mach-omap2/vp.c | 11 +--
> drivers/bus/omap_l3_noc.c | 4 +-
> drivers/clk/at91/clk-peripheral.c | 1 +
> drivers/clk/at91/pmc.h | 3 -
> drivers/clk/renesas/clk-div6.c | 6 +-
> drivers/clk/renesas/r8a779a0-cpg-mssr.c | 9 +--
> drivers/clk/renesas/rcar-gen3-cpg.c | 15 ++--
> drivers/clk/ti/apll.c | 25 +++---
> drivers/clk/ti/dpll3xxx.c | 81 ++++++++-----------
> .../iio/common/st_sensors/st_sensors_core.c | 5 +-
> drivers/iio/humidity/hts221_core.c | 8 +-
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 1 -
> .../iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 7 +-
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 45 +++++------
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 11 +--
> drivers/media/platform/ti-vpe/cal.h | 4 +-
> drivers/mmc/host/sdhci-of-aspeed.c | 5 +-
> drivers/net/wireless/realtek/rtw89/core.h | 38 ++-------
> drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c | 3 +-
> drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 3 +-
> drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c | 3 +-
> drivers/pinctrl/aspeed/pinctrl-aspeed.c | 5 +-
> drivers/pinctrl/aspeed/pinmux-aspeed.c | 6 +-
> drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 35 +++-----
> drivers/regulator/ti-abb-regulator.c | 7 +-
> drivers/soc/renesas/renesas-soc.c | 4 +-
> drivers/thermal/ti-soc-thermal/ti-bandgap.c | 11 ++-
> include/linux/bitfield.h | 30 +++++++
> sound/pci/ice1712/wm8766.c | 14 ++--
> sound/pci/ice1712/wm8776.c | 14 ++--
> 45 files changed, 263 insertions(+), 347 deletions(-)
>
> --
> 2.25.1
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2021-11-23 8:27 UTC|newest]
Thread overview: 118+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-22 15:53 [PATCH 00/17] Non-const bitfield helper conversions Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:53 ` [PATCH 01/17] bitfield: Add non-constant field_{prep,get}() helpers Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 16:32 ` Johannes Berg
2021-11-22 16:32 ` Johannes Berg
2021-11-22 16:32 ` Johannes Berg
2021-11-23 1:17 ` Jakub Kicinski
2021-11-23 1:17 ` Jakub Kicinski
2021-11-23 1:17 ` Jakub Kicinski
2021-11-23 8:36 ` [PATCH 01/17] bitfield: Add non-constant field_{prep, get}() helpers Geert Uytterhoeven
2021-11-23 8:36 ` [PATCH 01/17] bitfield: Add non-constant field_{prep,get}() helpers Geert Uytterhoeven
2021-11-23 8:36 ` [PATCH 01/17] bitfield: Add non-constant field_{prep, get}() helpers Geert Uytterhoeven
2021-11-23 16:24 ` [PATCH 01/17] bitfield: Add non-constant field_{prep,get}() helpers Johannes Berg
2021-11-23 16:24 ` Johannes Berg
2021-11-23 16:24 ` Johannes Berg
2021-11-23 23:49 ` Jakub Kicinski
2021-11-23 23:49 ` Jakub Kicinski
2021-11-23 23:49 ` Jakub Kicinski
2021-11-24 8:03 ` Johannes Berg
2021-11-24 8:03 ` Johannes Berg
2021-11-24 13:59 ` Jakub Kicinski
2021-11-24 13:59 ` Jakub Kicinski
2021-11-24 14:07 ` Johannes Berg
2021-11-24 14:07 ` Johannes Berg
2021-11-23 23:39 ` Jakub Kicinski
2021-11-23 23:39 ` Jakub Kicinski
2021-11-23 23:39 ` Jakub Kicinski
2021-11-23 1:52 ` Alex Elder
2021-11-23 1:52 ` Alex Elder
2021-11-23 1:52 ` Alex Elder
2021-11-23 8:38 ` [PATCH 01/17] bitfield: Add non-constant field_{prep, get}() helpers Geert Uytterhoeven
2021-11-23 8:38 ` [PATCH 01/17] bitfield: Add non-constant field_{prep,get}() helpers Geert Uytterhoeven
2021-11-23 8:38 ` [PATCH 01/17] bitfield: Add non-constant field_{prep, get}() helpers Geert Uytterhoeven
2021-11-23 8:30 ` Geert Uytterhoeven
2021-11-23 8:30 ` [PATCH 01/17] bitfield: Add non-constant field_{prep,get}() helpers Geert Uytterhoeven
2021-11-23 8:30 ` [PATCH 01/17] bitfield: Add non-constant field_{prep, get}() helpers Geert Uytterhoeven
2021-11-23 16:21 ` [PATCH 01/17] bitfield: Add non-constant field_{prep,get}() helpers Johannes Berg
2021-11-23 16:21 ` Johannes Berg
2021-11-23 16:21 ` Johannes Berg
2021-11-23 16:31 ` [PATCH 01/17] bitfield: Add non-constant field_{prep, get}() helpers Geert Uytterhoeven
2021-11-23 16:31 ` [PATCH 01/17] bitfield: Add non-constant field_{prep,get}() helpers Geert Uytterhoeven
2021-11-23 16:31 ` [PATCH 01/17] bitfield: Add non-constant field_{prep, get}() helpers Geert Uytterhoeven
2021-11-24 8:24 ` Kalle Valo
2021-11-24 8:24 ` [PATCH 01/17] bitfield: Add non-constant field_{prep,get}() helpers Kalle Valo
2021-11-22 15:53 ` [PATCH 02/17] clk: renesas: Use bitfield helpers Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:53 ` [PATCH/RFC 03/17] soc: " Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:53 ` [PATCH/RFC 04/17] ARM: OMAP2+: " Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:53 ` [PATCH/RFC 05/17] bus: omap_l3_noc: " Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:53 ` [PATCH/RFC 06/17] clk: ti: " Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:53 ` Geert Uytterhoeven
2021-11-22 15:54 ` [PATCH/RFC 07/17] iio: st_sensors: " Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-23 23:35 ` Linus Walleij
2021-11-23 23:35 ` Linus Walleij
2021-11-23 23:35 ` Linus Walleij
2021-11-22 15:54 ` [PATCH/RFC 08/17] iio: humidity: hts221: " Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-24 15:21 ` Jonathan Cameron
2021-11-24 15:21 ` Jonathan Cameron
2021-11-22 15:54 ` [PATCH/RFC 09/17] iio: imu: st_lsm6dsx: " Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` [PATCH/RFC 10/17] media: ti-vpe: cal: " Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` [PATCH/RFC 11/17] mmc: sdhci-of-aspeed: " Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` [PATCH/RFC 12/17] pinctrl: aspeed: " Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` [PATCH/RFC 13/17] pinctl: ti: iodelay: " Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 17:52 ` Alexandre Belloni
2021-11-22 17:52 ` Alexandre Belloni
2021-11-22 17:52 ` Alexandre Belloni
2021-11-22 15:54 ` [PATCH/RFC 14/17] regulator: ti-abb: " Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 16:31 ` Mark Brown
2021-11-22 16:31 ` Mark Brown
2021-11-22 16:31 ` Mark Brown
2021-11-22 15:54 ` [PATCH/RFC 15/17] thermal/ti-soc-thermal: " Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` [PATCH/RFC 16/17] ALSA: ice1724: " Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-23 11:24 ` Takashi Iwai
2021-11-23 11:24 ` Takashi Iwai
2021-11-23 11:24 ` Takashi Iwai
2021-11-22 15:54 ` [PATCH/RFC 17/17] rtw89: " Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 15:54 ` Geert Uytterhoeven
2021-11-22 18:38 ` Larry Finger
2021-11-22 18:38 ` Larry Finger
2021-11-22 18:38 ` Larry Finger
2021-11-22 17:50 ` Alexandre Belloni [this message]
2021-11-22 17:50 ` [PATCH 00/17] Non-const bitfield helper conversions Alexandre Belloni
2021-11-22 17:50 ` Alexandre Belloni
2021-11-23 8:20 ` Geert Uytterhoeven
2021-11-23 8:20 ` Geert Uytterhoeven
2021-11-23 8:20 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YZvYW1ElW7ZYZNTC@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=adrian.hunter@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=amitk@kernel.org \
--cc=andrew@aj.id.au \
--cc=bparrot@ti.com \
--cc=broonie@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=davem@davemloft.net \
--cc=edubezval@gmail.com \
--cc=geert+renesas@glider.be \
--cc=j-keerthy@ti.com \
--cc=jic23@kernel.org \
--cc=joel@jms.id.au \
--cc=kristo@kernel.org \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lorenzo.bianconi83@gmail.com \
--cc=ludovic.desroches@microchip.com \
--cc=magnus.damm@gmail.com \
--cc=mchehab@kernel.org \
--cc=mturquette@baylibre.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=openbmc@lists.ozlabs.org \
--cc=paul@pwsan.com \
--cc=pkshih@realtek.com \
--cc=rafael@kernel.org \
--cc=rnayak@codeaurora.org \
--cc=rui.zhang@intel.com \
--cc=sboyd@kernel.org \
--cc=tiwai@suse.com \
--cc=tony@atomide.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.