[PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux

Sascha Hauer sha at pengutronix.de
Mon Oct 23 02:45:07 PDT 2023


On Fri, Oct 20, 2023 at 09:18:42AM +0200, Ahmad Fatoum wrote:
> Since its inception in 2016, barebox regmap_bulk_read and
> regmap_bulk_write expected the last argument to be the total
> length of data to access in bytes.
> 
> Its namesake Linux version has the same prototype, but interprets the
> last argument as number of elements to write, i.e.
> bytes / regmap_get_val_bytes(map).
> 
> This went unnoticed so far, because barebox users are either using
> 1-byte regmaps, the code was written specifically for barebox
> or the code is yet unused such as the KSZ switch 64-bit accessors.
> 
> Avoid nasty future surprises by switching implementation and users
> to the Linux interpretation of the last argument. As courtesy for
> out-of-tree board code, we poison the symbol when regmap.h is included,
> so out of tree code doesn't silently run into the inverse issue.
> 
> AFAICS, this doesn't fix any bugs, so it doesn't need to go into master.
> 
> Ahmad Fatoum (11):
>   regmap: add support for bulk 64-bit reads and writes
>   nvmem: regmap: do not use regmap_bulk_read
>   regmap: move regmap.h content to linux/regmap.h
>   regmap: align regmap_bulk_read/write API with Linux
>   mfd: syscon: do not include regmap.h from mfd/syscon.h
>   mfd: axp20x: remove dependency on regmap.h
>   mfd: pfuze: disable mfd/pfuze.h dependency on regmap.h
>   mfd: atmel-smc: remove dependency of mfd/syscon/atmel-smc.h on
>     regmap.h
>   mfd: atmel-smc: include needed headers directly
>   mfd: stm32-timers: remove dependency of mfd/stm32-timers.h on regmap.h
>   treewide: switch regmap.h include to linux/regmap.h

Applied, thanks

Sascha

> 
>  arch/arm/boards/phytec-som-imx8mq/board.c     |   1 +
>  arch/arm/boards/protonic-imx6/board.c         |   2 +-
>  arch/arm/mach-imx/iim.c                       |   2 +-
>  arch/arm/mach-rockchip/dmc.c                  |   2 +-
>  arch/kvx/cpu/reset.c                          |   2 +-
>  drivers/base/regmap/regmap-fmt.c              |   2 +-
>  drivers/base/regmap/regmap-i2c.c              |   2 +-
>  drivers/base/regmap/regmap-mmio.c             |   2 +-
>  drivers/base/regmap/regmap-multi.c            |   6 +-
>  drivers/base/regmap/regmap-spi.c              |   2 +-
>  drivers/base/regmap/regmap.c                  |  39 ++-
>  drivers/clk/at91/at91rm9200.c                 |   2 +-
>  drivers/clk/at91/at91sam9260.c                |   2 +-
>  drivers/clk/at91/at91sam9g45.c                |   2 +-
>  drivers/clk/at91/at91sam9n12.c                |   2 +-
>  drivers/clk/at91/at91sam9rl.c                 |   2 +-
>  drivers/clk/at91/at91sam9x5.c                 |   2 +-
>  drivers/clk/at91/clk-audio-pll.c              |   2 +-
>  drivers/clk/at91/clk-generated.c              |   2 +-
>  drivers/clk/at91/clk-h32mx.c                  |   2 +-
>  drivers/clk/at91/clk-i2s-mux.c                |   2 +-
>  drivers/clk/at91/clk-main.c                   |   2 +-
>  drivers/clk/at91/clk-master.c                 |   2 +-
>  drivers/clk/at91/clk-peripheral.c             |   2 +-
>  drivers/clk/at91/clk-pll.c                    |   2 +-
>  drivers/clk/at91/clk-plldiv.c                 |   2 +-
>  drivers/clk/at91/clk-programmable.c           |   2 +-
>  drivers/clk/at91/clk-sam9x60-pll.c            |   2 +-
>  drivers/clk/at91/clk-slow.c                   |   2 +-
>  drivers/clk/at91/clk-smd.c                    |   2 +-
>  drivers/clk/at91/clk-system.c                 |   2 +-
>  drivers/clk/at91/clk-usb.c                    |   2 +-
>  drivers/clk/at91/clk-utmi.c                   |   2 +-
>  drivers/clk/at91/pmc.c                        |   2 +-
>  drivers/clk/at91/sam9x60.c                    |   2 +-
>  drivers/clk/at91/sama5d2.c                    |   2 +-
>  drivers/clk/at91/sama5d3.c                    |   2 +-
>  drivers/clk/at91/sama5d4.c                    |   2 +-
>  drivers/clk/at91/sckc.c                       |   2 +-
>  drivers/clk/clk-stm32f4.c                     |   2 +-
>  drivers/clk/rockchip/clk-inverter.c           |   2 +-
>  drivers/clk/rockchip/clk-muxgrf.c             |   2 +-
>  drivers/clk/rockchip/clk-pll.c                |   2 +-
>  drivers/clk/rockchip/clk.c                    |   2 +-
>  drivers/clk/socfpga/clk-gate-a10.c            |   2 +-
>  drivers/gpio/gpio-sx150x.c                    |   2 +-
>  drivers/hab/hab.c                             |   2 +-
>  drivers/i2c/busses/i2c-cadence.c              |   2 +-
>  drivers/i2c/busses/i2c-rockchip.c             |   2 +-
>  drivers/i2c/busses/i2c-stm32.c                |   2 +-
>  drivers/memory/atmel-ebi.c                    |   2 +-
>  drivers/mfd/atmel-smc.c                       |   2 +
>  drivers/mfd/axp20x-i2c.c                      |   2 +-
>  drivers/mfd/axp20x.c                          |   2 +-
>  drivers/mfd/mc13xxx.c                         |   2 +-
>  drivers/mfd/rk808.c                           |   2 +-
>  drivers/mfd/rn5t568.c                         |   2 +-
>  drivers/mfd/rohm-bd718x7.c                    |   2 +-
>  drivers/mfd/stm32-timers.c                    |   1 +
>  drivers/mfd/stpmic1.c                         |   2 +-
>  drivers/mfd/superio.c                         |   2 +-
>  drivers/mfd/syscon.c                          |   1 +
>  drivers/mtd/nand/atmel/nand-controller.c      |   2 +-
>  drivers/net/designware_imx8.c                 |   2 +-
>  drivers/net/designware_rockchip.c             |   2 +-
>  drivers/net/designware_starfive.c             |   1 +
>  drivers/net/designware_stm32.c                |   1 +
>  drivers/net/ksz8873.c                         |   2 +-
>  drivers/net/ksz_common.h                      |   2 +-
>  drivers/net/realtek-dsa/realtek-mdio.c        |   2 +-
>  drivers/net/realtek-dsa/realtek-smi.c         |   2 +-
>  drivers/net/realtek-dsa/rtl8365mb.c           |   2 +-
>  drivers/net/realtek-dsa/rtl8366rb.c           |   2 +-
>  drivers/nvmem/bsec.c                          |   4 +-
>  drivers/nvmem/ocotp.c                         |   8 +-
>  drivers/nvmem/regmap.c                        |  16 +-
>  drivers/nvmem/snvs_lpgpr.c                    |   6 +-
>  drivers/nvmem/starfive-otp.c                  |   2 +-
>  drivers/pci/pci-layerscape.c                  |   2 +-
>  drivers/phy/rockchip/phy-rockchip-inno-usb2.c |   1 +
>  .../rockchip/phy-rockchip-naneng-combphy.c    |   1 +
>  drivers/pinctrl/pinctrl-rockchip.c            |   1 +
>  drivers/power/reset/syscon-poweroff.c         |   1 +
>  drivers/power/reset/syscon-reboot-mode.c      |   2 +-
>  drivers/power/reset/syscon-reboot.c           |   1 +
>  drivers/pwm/pwm-stm32.c                       |   1 +
>  drivers/regulator/anatop-regulator.c          |   2 +-
>  drivers/regulator/helpers.c                   |   2 +-
>  drivers/regulator/pfuze.c                     |   2 +-
>  drivers/regulator/rk808-regulator.c           |   2 +-
>  drivers/regulator/stpmic1_regulator.c         |   2 +-
>  drivers/remoteproc/imx_rproc.c                |   2 +-
>  drivers/remoteproc/stm32_rproc.c              |   2 +-
>  drivers/reset/reset-imx7.c                    |   2 +-
>  drivers/rtc/rtc-pcf85363.c                    |   2 +-
>  drivers/serial/serial_clps711x.c              |   1 +
>  drivers/soc/imx/gpcv2.c                       |   2 +-
>  drivers/soc/rockchip/io-domain.c              |   2 +-
>  drivers/spi/spi-fsl-dspi.c                    |   2 +-
>  drivers/spi/spi-nxp-fspi.c                    |   2 +-
>  drivers/usb/typec/tusb320.c                   |   2 +-
>  drivers/watchdog/rn5t568_wdt.c                |   2 +-
>  drivers/watchdog/stpmic1_wdt.c                |   1 +
>  include/linux/mfd/axp20x.h                    |  26 +-
>  include/linux/mfd/stm32-timers.h              |   3 +-
>  include/linux/mfd/syscon/atmel-smc.h          |   3 +-
>  include/linux/regmap.h                        | 260 ++++++++++++++++++
>  include/mfd/pfuze.h                           |   2 +-
>  include/mfd/syscon.h                          |   2 +-
>  include/regmap.h                              | 256 ++---------------
>  110 files changed, 436 insertions(+), 376 deletions(-)
>  create mode 100644 include/linux/regmap.h
> 
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list