diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-10-20 09:18:46 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-10-23 11:44:50 +0200 |
commit | 87105780935f288703c4235aa32415e757795879 (patch) | |
tree | 9f1a83a50887c836f68bde44b09a9704509f0e0d /drivers/nvmem/bsec.c | |
parent | c82c12ef34706d365059399c8a7d0a583f3123d0 (diff) | |
download | barebox-87105780935f288703c4235aa32415e757795879.tar.gz barebox-87105780935f288703c4235aa32415e757795879.tar.xz |
regmap: align regmap_bulk_read/write API with Linux
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.
Files with regmap.h replaced by linux/regmap.h added and no other changes
are already compatible with the new definitions. All other files are
adapted to the new definition through division by the value size in
bytes.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20231020071853.2826528-5-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/nvmem/bsec.c')
-rw-r--r-- | drivers/nvmem/bsec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvmem/bsec.c b/drivers/nvmem/bsec.c index c381ee0836..7f24063b9e 100644 --- a/drivers/nvmem/bsec.c +++ b/drivers/nvmem/bsec.c @@ -13,7 +13,7 @@ #include <net.h> #include <io.h> #include <of.h> -#include <regmap.h> +#include <linux/regmap.h> #include <mach/stm32mp/bsec.h> #include <machine_id.h> #include <linux/nvmem-provider.h> @@ -82,7 +82,7 @@ static void stm32_bsec_set_unique_machine_id(struct regmap *map) int ret; ret = regmap_bulk_read(map, BSEC_OTP_SERIAL * 4, - unique_id, sizeof(unique_id)); + unique_id, sizeof(unique_id) / 4); if (ret) return; |