* [PATCH 01/11] regmap: add support for bulk 64-bit reads and writes
2023-10-20 7:18 [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
@ 2023-10-20 7:18 ` Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 02/11] nvmem: regmap: do not use regmap_bulk_read Ahmad Fatoum
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 7:18 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The Linux implementation of regmap_bulk_read and regmap_bulk_write
supports 64-bit accesses. Have the barebox implementation follow suit.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/base/regmap/regmap.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index da20dc05828d..191217d20144 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -269,6 +269,10 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
return -EINVAL;
for (i = 0; i < val_count; i++) {
+
+#ifdef CONFIG_64BIT
+ u64 *u64 = val;
+#endif
u32 *u32 = val;
u16 *u16 = val;
u8 *u8 = val;
@@ -278,6 +282,11 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
goto out;
switch (map->format.val_bytes) {
+#ifdef CONFIG_64BIT
+ case 8:
+ u64[i] = v;
+ break;
+#endif
case 4:
u32[i] = v;
break;
@@ -335,6 +344,11 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg,
case 4:
ival = *(u32 *)(val + (i * val_bytes));
break;
+#ifdef CONFIG_64BIT
+ case 8:
+ ival = *(u64 *)(val + (i * val_bytes));
+ break;
+#endif
default:
ret = -EINVAL;
goto out;
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 02/11] nvmem: regmap: do not use regmap_bulk_read
2023-10-20 7:18 [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 01/11] regmap: add support for bulk 64-bit reads and writes Ahmad Fatoum
@ 2023-10-20 7:18 ` Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 03/11] regmap: move regmap.h content to linux/regmap.h Ahmad Fatoum
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 7:18 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
nvmem_regmap_read is only ever called with stride_size == value_size, so
reading one stride's worth with barebox' variant of regmap_bulk_read is
identical to just calling regmap_read a single time, so let's just do
that.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/nvmem/regmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvmem/regmap.c b/drivers/nvmem/regmap.c
index db0221bae325..313e92fb7da8 100644
--- a/drivers/nvmem/regmap.c
+++ b/drivers/nvmem/regmap.c
@@ -32,7 +32,7 @@ static int nvmem_regmap_read(void *ctx, unsigned offset, void *buf, size_t bytes
return -EINVAL;
for (i = roffset; i < roffset + rbytes; i += stride) {
- ret = regmap_bulk_read(map, i, &val, stride);
+ ret = regmap_read(map, i, &val);
if (ret) {
dev_err(regmap_get_device(map), "Can't read data%d (%d)\n", i, ret);
return ret;
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 03/11] regmap: move regmap.h content to linux/regmap.h
2023-10-20 7:18 [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 01/11] regmap: add support for bulk 64-bit reads and writes Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 02/11] nvmem: regmap: do not use regmap_bulk_read Ahmad Fatoum
@ 2023-10-20 7:18 ` Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 04/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 7:18 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
In preparation for changing the semantics of regmap_bulk_read and
regmap_bulk_write, move regmap.h to its Linux location and have the
existing top-level regmap.h just point at it.
No functional change.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/linux/regmap.h | 254 +++++++++++++++++++++++++++++++++++++++++
include/regmap.h | 249 +---------------------------------------
2 files changed, 255 insertions(+), 248 deletions(-)
create mode 100644 include/linux/regmap.h
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
new file mode 100644
index 000000000000..aacb80cfa235
--- /dev/null
+++ b/include/linux/regmap.h
@@ -0,0 +1,254 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __LINUX_REGMAP_H
+#define __LINUX_REGMAP_H
+
+#include <linux/compiler.h>
+#include <linux/types.h>
+
+enum regmap_endian {
+ /* Unspecified -> 0 -> Backwards compatible default */
+ REGMAP_ENDIAN_DEFAULT = 0,
+ REGMAP_ENDIAN_BIG,
+ REGMAP_ENDIAN_LITTLE,
+ REGMAP_ENDIAN_NATIVE,
+};
+
+/**
+ * Configuration for the register map of a device.
+ *
+ * @name: Optional name of the regmap. Useful when a device has multiple
+ * register regions.
+ *
+ * @reg_bits: Number of bits in a register address, mandatory.
+ * @reg_stride: The register address stride. Valid register addresses are a
+ * multiple of this value. If set to 0, a value of 1 will be
+ * used.
+ * @pad_bits: Number of bits of padding between register and value.
+ * @val_bits: Number of bits in a register value, mandatory.
+ *
+ * @write: Write operation.
+ * @read: Read operation. Data is returned in the buffer used to transmit
+ * data.
+ *
+ * @max_register: Optional, specifies the maximum valid register index.
+ *
+ * @read_flag_mask: Mask to be set in the top byte of the register when doing
+ * a read.
+ */
+struct regmap_config {
+ const char *name;
+
+ int reg_bits;
+ int reg_stride;
+ int pad_bits;
+ int val_bits;
+
+ unsigned int max_register;
+
+ enum regmap_endian reg_format_endian;
+ enum regmap_endian val_format_endian;
+
+ unsigned int read_flag_mask;
+ unsigned int write_flag_mask;
+};
+
+typedef int (*regmap_hw_write)(void *context, const void *data,
+ size_t count);
+typedef int (*regmap_hw_read)(void *context,
+ const void *reg_buf, size_t reg_size,
+ void *val_buf, size_t val_size);
+typedef int (*regmap_hw_reg_read)(void *context, unsigned int reg,
+ unsigned int *val);
+typedef int (*regmap_hw_reg_write)(void *context, unsigned int reg,
+ unsigned int val);
+
+/**
+ * struct regmap_bus - Description of a hardware bus for the register map
+ * infrastructure.
+ *
+ * @reg_write: Write a single register value to the given register address. This
+ * write operation has to complete when returning from the function.
+ * @reg_read: Read a single register value from a given register address.
+ * @read: Read operation. Data is returned in the buffer used to transmit
+ * data.
+ * @write: Write operation.
+ * @read_flag_mask: Mask to be set in the top byte of the register when doing
+ * a read.
+ * @reg_format_endian_default: Default endianness for formatted register
+ * addresses. Used when the regmap_config specifies DEFAULT. If this is
+ * DEFAULT, BIG is assumed.
+ * @val_format_endian_default: Default endianness for formatted register
+ * values. Used when the regmap_config specifies DEFAULT. If this is
+ * DEFAULT, BIG is assumed.
+ */
+struct regmap_bus {
+ regmap_hw_reg_write reg_write;
+ regmap_hw_reg_read reg_read;
+
+ int (*read)(void *context,
+ const void *reg_buf, size_t reg_size,
+ void *val_buf, size_t val_size);
+ int (*write)(void *context, const void *data,
+ size_t count);
+
+ u8 read_flag_mask;
+
+ enum regmap_endian reg_format_endian_default;
+ enum regmap_endian val_format_endian_default;
+};
+
+struct device;
+struct device_node;
+
+struct regmap *regmap_init(struct device *dev,
+ const struct regmap_bus *bus,
+ void *bus_context,
+ const struct regmap_config *config);
+
+struct clk;
+
+/**
+ * regmap_init_mmio_clk() - Initialise register map with register clock
+ *
+ * @dev: Device that will be interacted with
+ * @clk_id: register clock consumer ID
+ * @regs: Pointer to memory-mapped IO region
+ * @config: Configuration for register map
+ *
+ * The return value will be an ERR_PTR() on error or a valid pointer to
+ * a struct regmap.
+ */
+struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id,
+ void __iomem *regs,
+ const struct regmap_config *config);
+
+/**
+ * regmap_init_i2c() - Initialise i2c register map
+ *
+ * @i2c: Device that will be interacted with
+ * @config: Configuration for register map
+ *
+ * The return value will be an ERR_PTR() on error or a valid pointer
+ * to a struct regmap.
+ */
+struct i2c_client;
+struct regmap *regmap_init_i2c(struct i2c_client *i2c,
+ const struct regmap_config *config);
+
+struct regmap *regmap_init_i2c_smbus(struct i2c_client *client,
+ const struct regmap_config *config);
+
+/**
+ * regmap_init_spi() - Initialise spi register map
+ *
+ * @spi: Device that will be interacted with
+ * @config: Configuration for register map
+ *
+ * The return value will be an ERR_PTR() on error or a valid pointer
+ * to a struct regmap.
+ */
+struct spi_device;
+struct regmap *regmap_init_spi(struct spi_device *dev,
+ const struct regmap_config *config);
+
+/**
+ * regmap_init_mmio() - Initialise register map
+ *
+ * @dev: Device that will be interacted with
+ * @regs: Pointer to memory-mapped IO region
+ * @config: Configuration for register map
+ *
+ * The return value will be an ERR_PTR() on error or a valid pointer to
+ * a struct regmap.
+ */
+#define regmap_init_mmio(dev, regs, config) \
+ regmap_init_mmio_clk(dev, NULL, regs, config)
+
+
+int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk);
+void regmap_mmio_detach_clk(struct regmap *map);
+
+void regmap_exit(struct regmap *map);
+
+struct regmap *dev_get_regmap(struct device *dev, const char *name);
+struct device *regmap_get_device(struct regmap *map);
+
+int regmap_register_cdev(struct regmap *map, const char *name);
+
+/**
+ * regmap_multi_register_cdev() - Initialize cdev backed by multiple regmaps
+ *
+ * @map8: regmap for 8-bit wide accesses. NULL if such access
+ * should fail with -EINVAL
+ * @map16: regmap for 16-bit wide accesses. NULL if such access
+ * should fail with -EINVAL
+ * @map32: regmap for 32-bit wide accesses. NULL if such access
+ * should fail with -EINVAL
+ * @map64: regmap for 64-bit wide accesses. NULL if such access
+ * should fail with -EINVAL
+ *
+ * Registers a cdev that demultiplexes cdev accesses to one
+ * of the underlying regmaps according to the access size
+ * (e.g. mw -b => map8, mw -l => map32)
+ */
+int regmap_multi_register_cdev(struct regmap *map8,
+ struct regmap *map16,
+ struct regmap *map32,
+ struct regmap *map64);
+
+int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
+int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
+
+int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
+ size_t val_len);
+int regmap_bulk_write(struct regmap *map, unsigned int reg,
+ const void *val, size_t val_len);
+
+int regmap_get_val_bytes(struct regmap *map);
+int regmap_get_max_register(struct regmap *map);
+int regmap_get_reg_stride(struct regmap *map);
+
+int regmap_write_bits(struct regmap *map, unsigned int reg,
+ unsigned int mask, unsigned int val);
+int regmap_update_bits(struct regmap *map, unsigned int reg,
+ unsigned int mask, unsigned int val);
+
+static inline int regmap_set_bits(struct regmap *map,
+ unsigned int reg, unsigned int bits)
+{
+ return regmap_update_bits(map, reg, bits, bits);
+}
+
+static inline int regmap_clear_bits(struct regmap *map,
+ unsigned int reg, unsigned int bits)
+{
+ return regmap_update_bits(map, reg, bits, 0);
+}
+
+size_t regmap_size_bytes(struct regmap *map);
+
+/**
+ * regmap_read_poll_timeout - Poll until a condition is met or a timeout occurs
+ *
+ * @map: Regmap to read from
+ * @addr: Address to poll
+ * @val: Unsigned integer variable to read the value into
+ * @cond: Break condition (usually involving @val)
+ * @timeout_us: Timeout in us, 0 means never timeout
+ *
+ * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read
+ * error return value in case of a error read. In the two former cases,
+ * the last read value at @addr is stored in @val. Must not be called
+ * from atomic context if sleep_us or timeout_us are used.
+ *
+ * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
+ */
+#define regmap_read_poll_timeout(map, addr, val, cond, timeout_us) \
+({ \
+ int __ret, __tmp; \
+ __tmp = read_poll_timeout(regmap_read, __ret, __ret || (cond), \
+ timeout_us, (map), (addr), &(val)); \
+ __ret ?: __tmp; \
+})
+
+#endif /* __LINUX_REGMAP_H */
diff --git a/include/regmap.h b/include/regmap.h
index 98ac90523b07..f4a194f10433 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -2,253 +2,6 @@
#ifndef __REGMAP_H
#define __REGMAP_H
-#include <linux/compiler.h>
-#include <linux/types.h>
-
-enum regmap_endian {
- /* Unspecified -> 0 -> Backwards compatible default */
- REGMAP_ENDIAN_DEFAULT = 0,
- REGMAP_ENDIAN_BIG,
- REGMAP_ENDIAN_LITTLE,
- REGMAP_ENDIAN_NATIVE,
-};
-
-/**
- * Configuration for the register map of a device.
- *
- * @name: Optional name of the regmap. Useful when a device has multiple
- * register regions.
- *
- * @reg_bits: Number of bits in a register address, mandatory.
- * @reg_stride: The register address stride. Valid register addresses are a
- * multiple of this value. If set to 0, a value of 1 will be
- * used.
- * @pad_bits: Number of bits of padding between register and value.
- * @val_bits: Number of bits in a register value, mandatory.
- *
- * @write: Write operation.
- * @read: Read operation. Data is returned in the buffer used to transmit
- * data.
- *
- * @max_register: Optional, specifies the maximum valid register index.
- *
- * @read_flag_mask: Mask to be set in the top byte of the register when doing
- * a read.
- */
-struct regmap_config {
- const char *name;
-
- int reg_bits;
- int reg_stride;
- int pad_bits;
- int val_bits;
-
- unsigned int max_register;
-
- enum regmap_endian reg_format_endian;
- enum regmap_endian val_format_endian;
-
- unsigned int read_flag_mask;
- unsigned int write_flag_mask;
-};
-
-typedef int (*regmap_hw_write)(void *context, const void *data,
- size_t count);
-typedef int (*regmap_hw_read)(void *context,
- const void *reg_buf, size_t reg_size,
- void *val_buf, size_t val_size);
-typedef int (*regmap_hw_reg_read)(void *context, unsigned int reg,
- unsigned int *val);
-typedef int (*regmap_hw_reg_write)(void *context, unsigned int reg,
- unsigned int val);
-
-/**
- * struct regmap_bus - Description of a hardware bus for the register map
- * infrastructure.
- *
- * @reg_write: Write a single register value to the given register address. This
- * write operation has to complete when returning from the function.
- * @reg_read: Read a single register value from a given register address.
- * @read: Read operation. Data is returned in the buffer used to transmit
- * data.
- * @write: Write operation.
- * @read_flag_mask: Mask to be set in the top byte of the register when doing
- * a read.
- * @reg_format_endian_default: Default endianness for formatted register
- * addresses. Used when the regmap_config specifies DEFAULT. If this is
- * DEFAULT, BIG is assumed.
- * @val_format_endian_default: Default endianness for formatted register
- * values. Used when the regmap_config specifies DEFAULT. If this is
- * DEFAULT, BIG is assumed.
- */
-struct regmap_bus {
- regmap_hw_reg_write reg_write;
- regmap_hw_reg_read reg_read;
-
- int (*read)(void *context,
- const void *reg_buf, size_t reg_size,
- void *val_buf, size_t val_size);
- int (*write)(void *context, const void *data,
- size_t count);
-
- u8 read_flag_mask;
-
- enum regmap_endian reg_format_endian_default;
- enum regmap_endian val_format_endian_default;
-};
-
-struct device;
-struct device_node;
-
-struct regmap *regmap_init(struct device *dev,
- const struct regmap_bus *bus,
- void *bus_context,
- const struct regmap_config *config);
-
-struct clk;
-
-/**
- * regmap_init_mmio_clk() - Initialise register map with register clock
- *
- * @dev: Device that will be interacted with
- * @clk_id: register clock consumer ID
- * @regs: Pointer to memory-mapped IO region
- * @config: Configuration for register map
- *
- * The return value will be an ERR_PTR() on error or a valid pointer to
- * a struct regmap.
- */
-struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id,
- void __iomem *regs,
- const struct regmap_config *config);
-
-/**
- * regmap_init_i2c() - Initialise i2c register map
- *
- * @i2c: Device that will be interacted with
- * @config: Configuration for register map
- *
- * The return value will be an ERR_PTR() on error or a valid pointer
- * to a struct regmap.
- */
-struct i2c_client;
-struct regmap *regmap_init_i2c(struct i2c_client *i2c,
- const struct regmap_config *config);
-
-struct regmap *regmap_init_i2c_smbus(struct i2c_client *client,
- const struct regmap_config *config);
-
-/**
- * regmap_init_spi() - Initialise spi register map
- *
- * @spi: Device that will be interacted with
- * @config: Configuration for register map
- *
- * The return value will be an ERR_PTR() on error or a valid pointer
- * to a struct regmap.
- */
-struct spi_device;
-struct regmap *regmap_init_spi(struct spi_device *dev,
- const struct regmap_config *config);
-
-/**
- * regmap_init_mmio() - Initialise register map
- *
- * @dev: Device that will be interacted with
- * @regs: Pointer to memory-mapped IO region
- * @config: Configuration for register map
- *
- * The return value will be an ERR_PTR() on error or a valid pointer to
- * a struct regmap.
- */
-#define regmap_init_mmio(dev, regs, config) \
- regmap_init_mmio_clk(dev, NULL, regs, config)
-
-
-int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk);
-void regmap_mmio_detach_clk(struct regmap *map);
-
-void regmap_exit(struct regmap *map);
-
-struct regmap *dev_get_regmap(struct device *dev, const char *name);
-struct device *regmap_get_device(struct regmap *map);
-
-int regmap_register_cdev(struct regmap *map, const char *name);
-
-/**
- * regmap_multi_register_cdev() - Initialize cdev backed by multiple regmaps
- *
- * @map8: regmap for 8-bit wide accesses. NULL if such access
- * should fail with -EINVAL
- * @map16: regmap for 16-bit wide accesses. NULL if such access
- * should fail with -EINVAL
- * @map32: regmap for 32-bit wide accesses. NULL if such access
- * should fail with -EINVAL
- * @map64: regmap for 64-bit wide accesses. NULL if such access
- * should fail with -EINVAL
- *
- * Registers a cdev that demultiplexes cdev accesses to one
- * of the underlying regmaps according to the access size
- * (e.g. mw -b => map8, mw -l => map32)
- */
-int regmap_multi_register_cdev(struct regmap *map8,
- struct regmap *map16,
- struct regmap *map32,
- struct regmap *map64);
-
-int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
-int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
-
-int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
- size_t val_len);
-int regmap_bulk_write(struct regmap *map, unsigned int reg,
- const void *val, size_t val_len);
-
-int regmap_get_val_bytes(struct regmap *map);
-int regmap_get_max_register(struct regmap *map);
-int regmap_get_reg_stride(struct regmap *map);
-
-int regmap_write_bits(struct regmap *map, unsigned int reg,
- unsigned int mask, unsigned int val);
-int regmap_update_bits(struct regmap *map, unsigned int reg,
- unsigned int mask, unsigned int val);
-
-static inline int regmap_set_bits(struct regmap *map,
- unsigned int reg, unsigned int bits)
-{
- return regmap_update_bits(map, reg, bits, bits);
-}
-
-static inline int regmap_clear_bits(struct regmap *map,
- unsigned int reg, unsigned int bits)
-{
- return regmap_update_bits(map, reg, bits, 0);
-}
-
-size_t regmap_size_bytes(struct regmap *map);
-
-/**
- * regmap_read_poll_timeout - Poll until a condition is met or a timeout occurs
- *
- * @map: Regmap to read from
- * @addr: Address to poll
- * @val: Unsigned integer variable to read the value into
- * @cond: Break condition (usually involving @val)
- * @timeout_us: Timeout in us, 0 means never timeout
- *
- * Returns 0 on success and -ETIMEDOUT upon a timeout or the regmap_read
- * error return value in case of a error read. In the two former cases,
- * the last read value at @addr is stored in @val. Must not be called
- * from atomic context if sleep_us or timeout_us are used.
- *
- * This is modelled after the readx_poll_timeout macros in linux/iopoll.h.
- */
-#define regmap_read_poll_timeout(map, addr, val, cond, timeout_us) \
-({ \
- int __ret, __tmp; \
- __tmp = read_poll_timeout(regmap_read, __ret, __ret || (cond), \
- timeout_us, (map), (addr), &(val)); \
- __ret ?: __tmp; \
-})
+#include <linux/regmap.h>
#endif /* __REGMAP_H */
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 04/11] regmap: align regmap_bulk_read/write API with Linux
2023-10-20 7:18 [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
` (2 preceding siblings ...)
2023-10-20 7:18 ` [PATCH 03/11] regmap: move regmap.h content to linux/regmap.h Ahmad Fatoum
@ 2023-10-20 7:18 ` Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 05/11] mfd: syscon: do not include regmap.h from mfd/syscon.h Ahmad Fatoum
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 7:18 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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>
---
arch/arm/mach-imx/iim.c | 2 +-
drivers/base/regmap/regmap-multi.c | 6 +++---
drivers/base/regmap/regmap.c | 25 +++++++++++--------------
drivers/mfd/rn5t568.c | 2 +-
drivers/net/ksz_common.h | 2 +-
drivers/nvmem/bsec.c | 4 ++--
drivers/nvmem/ocotp.c | 8 ++++----
drivers/nvmem/regmap.c | 14 ++++++++++++--
drivers/nvmem/snvs_lpgpr.c | 6 +++---
drivers/rtc/rtc-pcf85363.c | 2 +-
include/linux/regmap.h | 10 ++++++++--
include/regmap.h | 29 +++++++++++++++++++++++++++++
12 files changed, 76 insertions(+), 34 deletions(-)
diff --git a/arch/arm/mach-imx/iim.c b/arch/arm/mach-imx/iim.c
index 8dc70d3caa26..90ca644c2e62 100644
--- a/arch/arm/mach-imx/iim.c
+++ b/arch/arm/mach-imx/iim.c
@@ -19,7 +19,7 @@
#include <malloc.h>
#include <of.h>
#include <io.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <regulator.h>
#include <linux/err.h>
diff --git a/drivers/base/regmap/regmap-multi.c b/drivers/base/regmap/regmap-multi.c
index e3f5b9aec1e4..74f3648eb439 100644
--- a/drivers/base/regmap/regmap-multi.c
+++ b/drivers/base/regmap/regmap-multi.c
@@ -5,7 +5,7 @@
#include <common.h>
#include <fcntl.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/bitfield.h>
#include <linux/export.h>
@@ -46,7 +46,7 @@ static ssize_t regmap_multi_cdev_read(struct cdev *cdev, void *buf, size_t count
return -EINVAL;
count = ALIGN_DOWN(count, rwsize);
- return regmap_bulk_read(map, offset, buf, count) ?: count;
+ return regmap_bulk_read(map, offset, buf, count / rwsize) ?: count;
}
static ssize_t regmap_multi_cdev_write(struct cdev *cdev, const void *buf, size_t count,
@@ -60,7 +60,7 @@ static ssize_t regmap_multi_cdev_write(struct cdev *cdev, const void *buf, size_
return -EINVAL;
count = ALIGN_DOWN(count, rwsize);
- return regmap_bulk_write(map, offset, buf, count) ?: count;
+ return regmap_bulk_write(map, offset, buf, count / rwsize) ?: count;
}
static struct cdev_operations regmap_multi_fops = {
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 191217d20144..4d896c677b28 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -12,7 +12,7 @@
*/
#include <common.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <malloc.h>
#include <linux/log2.h>
@@ -248,21 +248,17 @@ int regmap_write_bits(struct regmap *map, unsigned int reg,
* @map: Register map to read from
* @reg: First register to be read from
* @val: Pointer to store read value
- * @val_len: Size of data to read
+ * @val_count: Number of registers to read
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
- size_t val_len)
+ size_t val_count)
{
- size_t val_bytes = map->format.val_bytes;
- size_t val_count = val_len / val_bytes;
unsigned int v;
int ret, i;
- if (val_len % val_bytes)
- return -EINVAL;
if (!IS_ALIGNED(reg, map->reg_stride))
return -EINVAL;
if (val_count == 0)
@@ -312,20 +308,17 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
* @reg: Initial register to write to
* @val: Block of data to be written, laid out for direct transmission to the
* device
- * @val_len: Length of data pointed to by val.
+ * @val_len: Number of registers to write
*
* A value of zero will be returned on success, a negative errno will
* be returned in error cases.
*/
int regmap_bulk_write(struct regmap *map, unsigned int reg,
- const void *val, size_t val_len)
+ const void *val, size_t val_count)
{
size_t val_bytes = map->format.val_bytes;
- size_t val_count = val_len / val_bytes;
int ret, i;
- if (val_len % val_bytes)
- return -EINVAL;
if (!IS_ALIGNED(reg, map->reg_stride))
return -EINVAL;
if (val_count == 0)
@@ -388,9 +381,11 @@ static ssize_t regmap_cdev_read(struct cdev *cdev, void *buf, size_t count, loff
unsigned long flags)
{
struct regmap *map = container_of(cdev, struct regmap, cdev);
+ size_t val_bytes = map->format.val_bytes;
int ret;
- ret = regmap_bulk_read(map, offset, buf, count);
+ count = ALIGN_DOWN(count, val_bytes);
+ ret = regmap_bulk_read(map, offset, buf, count / val_bytes);
if (ret)
return ret;
@@ -401,9 +396,11 @@ static ssize_t regmap_cdev_write(struct cdev *cdev, const void *buf, size_t coun
unsigned long flags)
{
struct regmap *map = container_of(cdev, struct regmap, cdev);
+ size_t val_bytes = map->format.val_bytes;
int ret;
- ret = regmap_bulk_write(map, offset, buf, count);
+ count = ALIGN_DOWN(count, val_bytes);
+ ret = regmap_bulk_write(map, offset, buf, count / val_bytes);
if (ret)
return ret;
diff --git a/drivers/mfd/rn5t568.c b/drivers/mfd/rn5t568.c
index f649df944bf2..12de689734db 100644
--- a/drivers/mfd/rn5t568.c
+++ b/drivers/mfd/rn5t568.c
@@ -13,7 +13,7 @@
#include <i2c/i2c.h>
#include <init.h>
#include <of.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <reset_source.h>
#include <restart.h>
diff --git a/drivers/net/ksz_common.h b/drivers/net/ksz_common.h
index 995054d6e8c6..291488fe3485 100644
--- a/drivers/net/ksz_common.h
+++ b/drivers/net/ksz_common.h
@@ -3,7 +3,7 @@
#define NET_KSZ_COMMON_H_
#include <linux/swab.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/bitops.h>
#include <platform_data/ksz9477_reg.h>
diff --git a/drivers/nvmem/bsec.c b/drivers/nvmem/bsec.c
index c381ee0836e8..7f24063b9ed6 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;
diff --git a/drivers/nvmem/ocotp.c b/drivers/nvmem/ocotp.c
index c22e5d9585fa..641c825986cb 100644
--- a/drivers/nvmem/ocotp.c
+++ b/drivers/nvmem/ocotp.c
@@ -24,7 +24,7 @@
#include <io.h>
#include <of.h>
#include <clock.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/clk.h>
#include <machine_id.h>
#ifdef CONFIG_ARCH_IMX
@@ -622,7 +622,7 @@ static int imx_ocotp_read_mac(const struct imx_ocotp_data *data,
u8 buf[MAC_BYTES];
int ret;
- ret = regmap_bulk_read(map, offset, buf, MAC_BYTES);
+ ret = regmap_bulk_read(map, offset, buf, MAC_BYTES / 4);
if (ret < 0)
return ret;
@@ -649,7 +649,7 @@ static int imx_ocotp_set_mac(struct param_d *param, void *priv)
struct ocotp_priv_ethaddr *ethaddr = priv;
int ret;
- ret = regmap_bulk_read(ethaddr->map, ethaddr->offset, buf, MAC_BYTES);
+ ret = regmap_bulk_read(ethaddr->map, ethaddr->offset, buf, MAC_BYTES / 4);
if (ret < 0)
return ret;
@@ -662,7 +662,7 @@ static int imx_ocotp_set_mac(struct param_d *param, void *priv)
OCOTP_MAC_TO_HW);
return regmap_bulk_write(ethaddr->map, ethaddr->offset,
- buf, MAC_BYTES);
+ buf, MAC_BYTES / 4);
}
static struct regmap_bus imx_ocotp_regmap_bus = {
diff --git a/drivers/nvmem/regmap.c b/drivers/nvmem/regmap.c
index 313e92fb7da8..fa5405d7a86a 100644
--- a/drivers/nvmem/regmap.c
+++ b/drivers/nvmem/regmap.c
@@ -6,12 +6,22 @@
#include <errno.h>
#include <init.h>
#include <io.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/nvmem-provider.h>
static int nvmem_regmap_write(void *ctx, unsigned offset, const void *val, size_t bytes)
{
- return regmap_bulk_write(ctx, offset, val, bytes);
+ struct regmap *map = ctx;
+
+ /*
+ * eFuse writes going through this function may be irreversible,
+ * so expect users to observe alignment.
+ */
+ if (bytes % regmap_get_val_bytes(map))
+ return -EINVAL;
+
+ return regmap_bulk_write(map, offset, val,
+ bytes / regmap_get_val_bytes(map));
}
static int nvmem_regmap_read(void *ctx, unsigned offset, void *buf, size_t bytes)
diff --git a/drivers/nvmem/snvs_lpgpr.c b/drivers/nvmem/snvs_lpgpr.c
index dfbd5397d2f2..9bbee6d587a4 100644
--- a/drivers/nvmem/snvs_lpgpr.c
+++ b/drivers/nvmem/snvs_lpgpr.c
@@ -10,7 +10,7 @@
#include <of.h>
#include <of_device.h>
#include <malloc.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <mfd/syscon.h>
#include <linux/nvmem-provider.h>
@@ -61,7 +61,7 @@ static int snvs_lpgpr_write(void *ctx, unsigned offset, const void *val, size_t
return -EPERM;
return regmap_bulk_write(priv->regmap, dcfg->offset + offset, val,
- bytes);
+ bytes / 4);
}
static int snvs_lpgpr_read(void *ctx, unsigned offset, void *val, size_t bytes)
@@ -70,7 +70,7 @@ static int snvs_lpgpr_read(void *ctx, unsigned offset, void *val, size_t bytes)
const struct snvs_lpgpr_cfg *dcfg = priv->dcfg;
return regmap_bulk_read(priv->regmap, dcfg->offset + offset,
- val, bytes);
+ val, bytes / 4);
}
static int snvs_lpgpr_probe(struct device *dev)
diff --git a/drivers/rtc/rtc-pcf85363.c b/drivers/rtc/rtc-pcf85363.c
index 5b2c4e62b035..bcc251e1380e 100644
--- a/drivers/rtc/rtc-pcf85363.c
+++ b/drivers/rtc/rtc-pcf85363.c
@@ -16,7 +16,7 @@
#include <malloc.h>
#include <errno.h>
#include <i2c/i2c.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <rtc.h>
#include <linux/rtc.h>
#include <linux/bcd.h>
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index aacb80cfa235..690dc3b1dccb 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -199,10 +199,16 @@ int regmap_multi_register_cdev(struct regmap *map8,
int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);
int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
+#ifndef regmap_bulk_read
+#define regmap_bulk_read regmap_bulk_read
int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
- size_t val_len);
+ size_t val_count);
+#endif
+#ifndef regmap_bulk_write
+#define regmap_bulk_write regmap_bulk_write
int regmap_bulk_write(struct regmap *map, unsigned int reg,
- const void *val, size_t val_len);
+ const void *val, size_t val_count);
+#endif
int regmap_get_val_bytes(struct regmap *map);
int regmap_get_max_register(struct regmap *map);
diff --git a/include/regmap.h b/include/regmap.h
index f4a194f10433..f2c395a89654 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -2,6 +2,35 @@
#ifndef __REGMAP_H
#define __REGMAP_H
+#include <linux/compiler.h>
+#include <linux/types.h>
+
+extern void __compiletime_error("Last argument is now number of registers, not bytes. Fix "
+ "it and include <linux/regmap.h> instead")
+__regmap_bulk_api_changed(void);
+
+struct regmap;
+
+#ifndef regmap_bulk_read
+#define regmap_bulk_read regmap_bulk_read
+static inline int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
+ size_t val_bytes)
+{
+ __regmap_bulk_api_changed();
+ return -1;
+}
+#endif
+
+#ifndef regmap_bulk_write
+#define regmap_bulk_write regmap_bulk_write
+static inline int regmap_bulk_write(struct regmap *map, unsigned int reg,
+ const void *val, size_t val_bytes)
+{
+ __regmap_bulk_api_changed();
+ return -1;
+}
+#endif
+
#include <linux/regmap.h>
#endif /* __REGMAP_H */
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 05/11] mfd: syscon: do not include regmap.h from mfd/syscon.h
2023-10-20 7:18 [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
` (3 preceding siblings ...)
2023-10-20 7:18 ` [PATCH 04/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
@ 2023-10-20 7:18 ` Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 06/11] mfd: axp20x: remove dependency on regmap.h Ahmad Fatoum
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 7:18 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
mfd/syscon.h include regmap.h when a struct regmap forward declaration
would've sufficed. Let's forward declare and fix users of the header to
directly include linux/regmap.h where needed.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/mfd/syscon.c | 1 +
drivers/net/designware_starfive.c | 1 +
drivers/net/designware_stm32.c | 1 +
drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 1 +
drivers/phy/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.c | 1 +
drivers/serial/serial_clps711x.c | 1 +
drivers/watchdog/stpmic1_wdt.c | 1 +
include/mfd/syscon.h | 2 +-
11 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 16d78de2afed..3e12123b572e 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -16,6 +16,7 @@
#include <of_address.h>
#include <linux/err.h>
#include <linux/clk.h>
+#include <linux/regmap.h>
#include <mfd/syscon.h>
diff --git a/drivers/net/designware_starfive.c b/drivers/net/designware_starfive.c
index 9ab0de8be54f..aff2cc10e19c 100644
--- a/drivers/net/designware_starfive.c
+++ b/drivers/net/designware_starfive.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <init.h>
#include <linux/reset.h>
+#include <linux/regmap.h>
#include <linux/clk.h>
#include <mfd/syscon.h>
#include <soc/starfive/sysmain.h>
diff --git a/drivers/net/designware_stm32.c b/drivers/net/designware_stm32.c
index ffcd4a5b7618..54dabcc8d32a 100644
--- a/drivers/net/designware_stm32.c
+++ b/drivers/net/designware_stm32.c
@@ -11,6 +11,7 @@
#include <net.h>
#include <linux/clk.h>
#include <mfd/syscon.h>
+#include <linux/regmap.h>
#include "designware_eqos.h"
diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
index fe9f4fd32578..7349a92d567c 100644
--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
@@ -15,6 +15,7 @@
#include <linux/phy/phy.h>
#include <linux/clk.h>
#include <linux/err.h>
+#include <linux/regmap.h>
#include <mfd/syscon.h>
#include <regulator.h>
diff --git a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
index 5fbbe1a4e4b5..9676d8fe9998 100644
--- a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
+++ b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
@@ -17,6 +17,7 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/reset.h>
+#include <linux/regmap.h>
#include <mfd/syscon.h>
#include <linux/iopoll.h>
#include <dt-bindings/phy/phy.h>
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 917af927b609..c1e937ea2cb1 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -16,6 +16,7 @@
#include <init.h>
#include <malloc.h>
#include <mfd/syscon.h>
+#include <linux/regmap.h>
#include <of.h>
#include <of_address.h>
#include <pinctrl.h>
diff --git a/drivers/power/reset/syscon-poweroff.c b/drivers/power/reset/syscon-poweroff.c
index cdcc13268426..321bd1fc7be0 100644
--- a/drivers/power/reset/syscon-poweroff.c
+++ b/drivers/power/reset/syscon-poweroff.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <init.h>
#include <poweroff.h>
+#include <linux/regmap.h>
#include <mfd/syscon.h>
static struct regmap *map;
diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c
index 90b125c33519..61bea6169cb6 100644
--- a/drivers/power/reset/syscon-reboot.c
+++ b/drivers/power/reset/syscon-reboot.c
@@ -9,6 +9,7 @@
#include <init.h>
#include <restart.h>
#include <mfd/syscon.h>
+#include <linux/regmap.h>
struct syscon_reboot_context {
struct regmap *map;
diff --git a/drivers/serial/serial_clps711x.c b/drivers/serial/serial_clps711x.c
index 950d22c26cb1..2a284909bfa6 100644
--- a/drivers/serial/serial_clps711x.c
+++ b/drivers/serial/serial_clps711x.c
@@ -8,6 +8,7 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <mfd/syscon.h>
+#include <linux/regmap.h>
#define UARTDR 0x00
# define UARTDR_FRMERR (1 << 8)
diff --git a/drivers/watchdog/stpmic1_wdt.c b/drivers/watchdog/stpmic1_wdt.c
index 4bde4f4e203e..4a0519690aed 100644
--- a/drivers/watchdog/stpmic1_wdt.c
+++ b/drivers/watchdog/stpmic1_wdt.c
@@ -11,6 +11,7 @@
#include <linux/iopoll.h>
#include <poweroff.h>
#include <mfd/syscon.h>
+#include <linux/regmap.h>
#include <restart.h>
#include <reset_source.h>
diff --git a/include/mfd/syscon.h b/include/mfd/syscon.h
index 3ccfd7fb5b8a..f22d4e620b05 100644
--- a/include/mfd/syscon.h
+++ b/include/mfd/syscon.h
@@ -14,7 +14,7 @@
#ifndef __MFD_SYSCON_H__
#define __MFD_SYSCON_H__
-#include <regmap.h>
+struct regmap;
#ifdef CONFIG_MFD_SYSCON
void __iomem *syscon_base_lookup_by_phandle
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 06/11] mfd: axp20x: remove dependency on regmap.h
2023-10-20 7:18 [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
` (4 preceding siblings ...)
2023-10-20 7:18 ` [PATCH 05/11] mfd: syscon: do not include regmap.h from mfd/syscon.h Ahmad Fatoum
@ 2023-10-20 7:18 ` Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 07/11] mfd: pfuze: disable mfd/pfuze.h " Ahmad Fatoum
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 7:18 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
axp20x_read_variable_width() is not used in barebox and
struct regmap and struct regmap_config could just be forward-declared
avoiding the need to include regmap.h. Thus drop the function and
forward declare. Should the function be needed in future, it can be
added back.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/linux/mfd/axp20x.h | 26 +++-----------------------
1 file changed, 3 insertions(+), 23 deletions(-)
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index b406c019e449..93d303c45991 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -8,7 +8,6 @@
#ifndef __LINUX_MFD_AXP20X_H
#define __LINUX_MFD_AXP20X_H
-#include <regmap.h>
#include <poweroff.h>
enum axp20x_variants {
@@ -448,6 +447,9 @@ enum {
AXP813_REG_ID_MAX,
};
+struct regmap;
+struct regmap_config;
+
struct axp20x_dev {
struct device *dev;
struct regmap *regmap;
@@ -458,28 +460,6 @@ struct axp20x_dev {
struct poweroff_handler poweroff;
};
-/* generic helper function for reading 9-16 bit wide regs */
-static inline int axp20x_read_variable_width(struct regmap *regmap,
- unsigned int reg, unsigned int width)
-{
- unsigned int reg_val, result;
- int err;
-
- err = regmap_read(regmap, reg, ®_val);
- if (err)
- return err;
-
- result = reg_val << (width - 8);
-
- err = regmap_read(regmap, reg + 1, ®_val);
- if (err)
- return err;
-
- result |= reg_val;
-
- return result;
-}
-
/**
* axp20x_match_device(): Setup axp20x variant related fields
*
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 07/11] mfd: pfuze: disable mfd/pfuze.h dependency on regmap.h
2023-10-20 7:18 [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
` (5 preceding siblings ...)
2023-10-20 7:18 ` [PATCH 06/11] mfd: axp20x: remove dependency on regmap.h Ahmad Fatoum
@ 2023-10-20 7:18 ` Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 08/11] mfd: atmel-smc: remove dependency of mfd/syscon/atmel-smc.h " Ahmad Fatoum
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 7:18 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The only thing mfd/pfuze.h requires out of regmap.h is the forward
declaration of struct regmap. Just provide that and fix up the only
user that didn't already include regmap.h although requiring it.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/boards/phytec-som-imx8mq/board.c | 1 +
include/mfd/pfuze.h | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boards/phytec-som-imx8mq/board.c b/arch/arm/boards/phytec-som-imx8mq/board.c
index 5dbfaf13db60..45ed9cf5ad98 100644
--- a/arch/arm/boards/phytec-som-imx8mq/board.c
+++ b/arch/arm/boards/phytec-som-imx8mq/board.c
@@ -11,6 +11,7 @@
#include <linux/sizes.h>
#include <mach/imx/bbu.h>
#include <mfd/pfuze.h>
+#include <linux/regmap.h>
#include <envfs.h>
diff --git a/include/mfd/pfuze.h b/include/mfd/pfuze.h
index 4fb3863a723e..5cb0af939e06 100644
--- a/include/mfd/pfuze.h
+++ b/include/mfd/pfuze.h
@@ -3,7 +3,7 @@
#ifndef __INCLUDE_PFUZE_H
#define __INCLUDE_PFUZE_H
-#include <regmap.h>
+struct regmap;
#ifdef CONFIG_REGULATOR_PFUZE
/*
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 08/11] mfd: atmel-smc: remove dependency of mfd/syscon/atmel-smc.h on regmap.h
2023-10-20 7:18 [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
` (6 preceding siblings ...)
2023-10-20 7:18 ` [PATCH 07/11] mfd: pfuze: disable mfd/pfuze.h " Ahmad Fatoum
@ 2023-10-20 7:18 ` Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 09/11] mfd: atmel-smc: include needed headers directly Ahmad Fatoum
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 7:18 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
A forward declaration of struct regmap is all that the header requires
and all users already include regmap.h, so drop the include from the
header.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
include/linux/mfd/syscon/atmel-smc.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/mfd/syscon/atmel-smc.h b/include/linux/mfd/syscon/atmel-smc.h
index 881edefe4e9c..16d09ea497aa 100644
--- a/include/linux/mfd/syscon/atmel-smc.h
+++ b/include/linux/mfd/syscon/atmel-smc.h
@@ -13,7 +13,6 @@
#include <linux/kernel.h>
#include <of.h>
-#include <regmap.h>
#define ATMEL_SMC_SETUP(cs) (((cs) * 0x10))
#define ATMEL_HSMC_SETUP(layout, cs) \
@@ -93,6 +92,8 @@ struct atmel_smc_cs_conf {
u32 mode;
};
+struct regmap;
+
void atmel_smc_cs_conf_init(struct atmel_smc_cs_conf *conf);
int atmel_smc_cs_conf_set_timing(struct atmel_smc_cs_conf *conf,
unsigned int shift,
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 09/11] mfd: atmel-smc: include needed headers directly
2023-10-20 7:18 [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
` (7 preceding siblings ...)
2023-10-20 7:18 ` [PATCH 08/11] mfd: atmel-smc: remove dependency of mfd/syscon/atmel-smc.h " Ahmad Fatoum
@ 2023-10-20 7:18 ` Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 10/11] mfd: stm32-timers: remove dependency of mfd/stm32-timers.h on regmap.h Ahmad Fatoum
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 7:18 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
The file uses regmap accessors as well as GENMASK without including
the respective headers directly. Fix that.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/mfd/atmel-smc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mfd/atmel-smc.c b/drivers/mfd/atmel-smc.c
index 0eafbc06cd56..9432aa2c68ab 100644
--- a/drivers/mfd/atmel-smc.c
+++ b/drivers/mfd/atmel-smc.c
@@ -11,6 +11,8 @@
#include <linux/mfd/syscon/atmel-smc.h>
#include <linux/string.h>
#include <linux/export.h>
+#include <linux/regmap.h>
+#include <linux/bitops.h>
/**
* atmel_smc_cs_conf_init - initialize a SMC CS conf
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 10/11] mfd: stm32-timers: remove dependency of mfd/stm32-timers.h on regmap.h
2023-10-20 7:18 [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
` (8 preceding siblings ...)
2023-10-20 7:18 ` [PATCH 09/11] mfd: atmel-smc: include needed headers directly Ahmad Fatoum
@ 2023-10-20 7:18 ` Ahmad Fatoum
2023-10-20 7:18 ` [PATCH 11/11] treewide: switch regmap.h include to linux/regmap.h Ahmad Fatoum
2023-10-23 9:45 ` [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Sascha Hauer
11 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 7:18 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Drivers for the STM32 timer MFD and the PWM within it used regmap API
without directly including the regmap.h header. Fix that and replace
the regmap.h inclusion in mfd/stm32-timers.h with a forward declaration.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/mfd/stm32-timers.c | 1 +
drivers/pwm/pwm-stm32.c | 1 +
include/linux/mfd/stm32-timers.h | 3 ++-
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
index a7e9f53dbfbd..3b478001051b 100644
--- a/drivers/mfd/stm32-timers.c
+++ b/drivers/mfd/stm32-timers.c
@@ -11,6 +11,7 @@
#include <io.h>
#include <linux/bitfield.h>
#include <linux/mfd/stm32-timers.h>
+#include <linux/regmap.h>
#include <of.h>
#include <linux/reset.h>
diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c
index e73e9965576a..5c2029ab6ad6 100644
--- a/drivers/pwm/pwm-stm32.c
+++ b/drivers/pwm/pwm-stm32.c
@@ -14,6 +14,7 @@
#include <io.h>
#include <linux/bitfield.h>
#include <linux/mfd/stm32-timers.h>
+#include <linux/regmap.h>
#include <linux/math64.h>
#include <of.h>
#include <pwm.h>
diff --git a/include/linux/mfd/stm32-timers.h b/include/linux/mfd/stm32-timers.h
index 28fad44598f9..35aa0681baeb 100644
--- a/include/linux/mfd/stm32-timers.h
+++ b/include/linux/mfd/stm32-timers.h
@@ -8,7 +8,6 @@
#define _LINUX_STM32_GPTIMER_H_
#include <clock.h>
-#include <regmap.h>
#define TIM_CR1 0x00 /* Control Register 1 */
#define TIM_CR2 0x04 /* Control Register 2 */
@@ -88,6 +87,8 @@
#define TIM_BDTR_BKF_SHIFT 16
#define TIM_BDTR_BK2F_SHIFT 20
+struct regmap;
+
struct stm32_timers {
struct clk *clk;
struct regmap *regmap;
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 11/11] treewide: switch regmap.h include to linux/regmap.h
2023-10-20 7:18 [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
` (9 preceding siblings ...)
2023-10-20 7:18 ` [PATCH 10/11] mfd: stm32-timers: remove dependency of mfd/stm32-timers.h on regmap.h Ahmad Fatoum
@ 2023-10-20 7:18 ` Ahmad Fatoum
2023-10-23 9:45 ` [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Sascha Hauer
11 siblings, 0 replies; 13+ messages in thread
From: Ahmad Fatoum @ 2023-10-20 7:18 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Now that there are no longer any users of regmap.h in headers, let's
switch all users in the source files to linux/regmap.h.
That way, the only users of regmap.h whether directly or indirectly will
be out-of-tree code, which will fail with an error if they are dependent
on the old semantics of regmap_bulk_read and regmap_bulk_write.
After a transitory period, we can then drop regmap.h.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/boards/protonic-imx6/board.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-spi.c | 2 +-
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/axp20x-i2c.c | 2 +-
drivers/mfd/axp20x.c | 2 +-
drivers/mfd/mc13xxx.c | 2 +-
drivers/mfd/rk808.c | 2 +-
drivers/mfd/rohm-bd718x7.c | 2 +-
drivers/mfd/stpmic1.c | 2 +-
drivers/mfd/superio.c | 2 +-
drivers/mtd/nand/atmel/nand-controller.c | 2 +-
drivers/net/designware_imx8.c | 2 +-
drivers/net/designware_rockchip.c | 2 +-
drivers/net/ksz8873.c | 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/starfive-otp.c | 2 +-
drivers/pci/pci-layerscape.c | 2 +-
drivers/power/reset/syscon-reboot-mode.c | 2 +-
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/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 +-
79 files changed, 79 insertions(+), 79 deletions(-)
diff --git a/arch/arm/boards/protonic-imx6/board.c b/arch/arm/boards/protonic-imx6/board.c
index 2e101adc288e..5c5e7d615599 100644
--- a/arch/arm/boards/protonic-imx6/board.c
+++ b/arch/arm/boards/protonic-imx6/board.c
@@ -20,7 +20,7 @@
#include <mfd/syscon.h>
#include <net.h>
#include <of_device.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/arch/arm/mach-rockchip/dmc.c b/arch/arm/mach-rockchip/dmc.c
index a167be776540..e23eb9211051 100644
--- a/arch/arm/mach-rockchip/dmc.c
+++ b/arch/arm/mach-rockchip/dmc.c
@@ -11,7 +11,7 @@
#include <asm/memory.h>
#include <pbl.h>
#include <io.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <mfd/syscon.h>
#include <mach/rockchip/dmc.h>
#include <mach/rockchip/rk3399-regs.h>
diff --git a/arch/kvx/cpu/reset.c b/arch/kvx/cpu/reset.c
index df36764cb66b..a19399220ac1 100644
--- a/arch/kvx/cpu/reset.c
+++ b/arch/kvx/cpu/reset.c
@@ -7,7 +7,7 @@
#include <reset_source.h>
#include <mfd/syscon.h>
#include <restart.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <init.h>
#include <asm/ftu.h>
diff --git a/drivers/base/regmap/regmap-fmt.c b/drivers/base/regmap/regmap-fmt.c
index 47545f691901..e7f6a8da801d 100644
--- a/drivers/base/regmap/regmap-fmt.c
+++ b/drivers/base/regmap/regmap-fmt.c
@@ -12,7 +12,7 @@
*/
#include <common.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/log2.h>
#include <asm/unaligned.h>
diff --git a/drivers/base/regmap/regmap-i2c.c b/drivers/base/regmap/regmap-i2c.c
index a64570d8dcfb..13ba5866c02e 100644
--- a/drivers/base/regmap/regmap-i2c.c
+++ b/drivers/base/regmap/regmap-i2c.c
@@ -4,7 +4,7 @@
*/
#include <i2c/i2c.h>
-#include <regmap.h>
+#include <linux/regmap.h>
static int regmap_i2c_read(void *context,
diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index 4c6389689cd6..01b0a9963110 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -7,7 +7,7 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <io.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "internal.h"
diff --git a/drivers/base/regmap/regmap-spi.c b/drivers/base/regmap/regmap-spi.c
index cb6e6f2b3716..d15d59f6350e 100644
--- a/drivers/base/regmap/regmap-spi.c
+++ b/drivers/base/regmap/regmap-spi.c
@@ -6,7 +6,7 @@
//
// Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <spi/spi.h>
static int regmap_spi_write(void *context, const void *data, size_t count)
diff --git a/drivers/clk/at91/at91rm9200.c b/drivers/clk/at91/at91rm9200.c
index dbefcd92d32f..fe40ec788a1f 100644
--- a/drivers/clk/at91/at91rm9200.c
+++ b/drivers/clk/at91/at91rm9200.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
//
#include <driver.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <stdio.h>
#include <mfd/syscon.h>
diff --git a/drivers/clk/at91/at91sam9260.c b/drivers/clk/at91/at91sam9260.c
index 3348cc6637df..7d1d3ee5f34e 100644
--- a/drivers/clk/at91/at91sam9260.c
+++ b/drivers/clk/at91/at91sam9260.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <driver.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <stdio.h>
#include <mfd/syscon.h>
diff --git a/drivers/clk/at91/at91sam9g45.c b/drivers/clk/at91/at91sam9g45.c
index 95dc3d6e795b..035d36580c6e 100644
--- a/drivers/clk/at91/at91sam9g45.c
+++ b/drivers/clk/at91/at91sam9g45.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <driver.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <stdio.h>
#include <mfd/syscon.h>
diff --git a/drivers/clk/at91/at91sam9n12.c b/drivers/clk/at91/at91sam9n12.c
index bf170994532d..9a12341f942e 100644
--- a/drivers/clk/at91/at91sam9n12.c
+++ b/drivers/clk/at91/at91sam9n12.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <driver.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <stdio.h>
#include <mfd/syscon.h>
diff --git a/drivers/clk/at91/at91sam9rl.c b/drivers/clk/at91/at91sam9rl.c
index 19002c8dab56..bdec5cedca69 100644
--- a/drivers/clk/at91/at91sam9rl.c
+++ b/drivers/clk/at91/at91sam9rl.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <driver.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <stdio.h>
#include <mfd/syscon.h>
diff --git a/drivers/clk/at91/at91sam9x5.c b/drivers/clk/at91/at91sam9x5.c
index f9f45ed6e885..d052d67ffe93 100644
--- a/drivers/clk/at91/at91sam9x5.c
+++ b/drivers/clk/at91/at91sam9x5.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <driver.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <stdio.h>
#include <mfd/syscon.h>
diff --git a/drivers/clk/at91/clk-audio-pll.c b/drivers/clk/at91/clk-audio-pll.c
index e9a30b0516d4..780353ead1b4 100644
--- a/drivers/clk/at91/clk-audio-pll.c
+++ b/drivers/clk/at91/clk-audio-pll.c
@@ -37,7 +37,7 @@
#include <linux/clk.h>
#include <linux/clk/at91_pmc.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c
index e639fb3a1a65..190fc7d7e921 100644
--- a/drivers/clk/at91/clk-generated.c
+++ b/drivers/clk/at91/clk-generated.c
@@ -13,7 +13,7 @@
#include <linux/clk.h>
#include <linux/clk/at91_pmc.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/bitfield.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c
index b2c5007cf785..7f36fe7abb34 100644
--- a/drivers/clk/at91/clk-h32mx.c
+++ b/drivers/clk/at91/clk-h32mx.c
@@ -12,7 +12,7 @@
#include <linux/list.h>
#include <linux/clk.h>
#include <linux/clk/at91_pmc.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-i2s-mux.c b/drivers/clk/at91/clk-i2s-mux.c
index 5e7040a5b7be..97eb75a7fa1e 100644
--- a/drivers/clk/at91/clk-i2s-mux.c
+++ b/drivers/clk/at91/clk-i2s-mux.c
@@ -14,7 +14,7 @@
#include <linux/clk/at91_pmc.h>
#include <linux/overflow.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <soc/at91/atmel-sfr.h>
diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
index 38e72d653813..e0c8cf108ada 100644
--- a/drivers/clk/at91/clk-main.c
+++ b/drivers/clk/at91/clk-main.c
@@ -8,7 +8,7 @@
#include <linux/clk.h>
#include <linux/clk/at91_pmc.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
index 3e4836b66709..d20cea2b3481 100644
--- a/drivers/clk/at91/clk-master.c
+++ b/drivers/clk/at91/clk-master.c
@@ -9,7 +9,7 @@
#include <linux/clk/at91_pmc.h>
#include <linux/overflow.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c
index c768947647d4..ff98edef3fd2 100644
--- a/drivers/clk/at91/clk-peripheral.c
+++ b/drivers/clk/at91/clk-peripheral.c
@@ -9,7 +9,7 @@
#include <linux/clk.h>
#include <linux/clk/at91_pmc.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c
index d8ea566f4965..400132ad1fc4 100644
--- a/drivers/clk/at91/clk-pll.c
+++ b/drivers/clk/at91/clk-pll.c
@@ -10,7 +10,7 @@
#include <linux/clk.h>
#include <linux/clk/at91_pmc.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-plldiv.c b/drivers/clk/at91/clk-plldiv.c
index 2830b1672271..e39eb6a6543d 100644
--- a/drivers/clk/at91/clk-plldiv.c
+++ b/drivers/clk/at91/clk-plldiv.c
@@ -10,7 +10,7 @@
#include <linux/clk.h>
#include <linux/clk/at91_pmc.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c
index ec53f1addd5f..eebd96736f35 100644
--- a/drivers/clk/at91/clk-programmable.c
+++ b/drivers/clk/at91/clk-programmable.c
@@ -11,7 +11,7 @@
#include <linux/clk/at91_pmc.h>
#include <linux/overflow.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-sam9x60-pll.c b/drivers/clk/at91/clk-sam9x60-pll.c
index e94b3eec4192..3cd34350b9a7 100644
--- a/drivers/clk/at91/clk-sam9x60-pll.c
+++ b/drivers/clk/at91/clk-sam9x60-pll.c
@@ -11,7 +11,7 @@
#include <linux/clk.h>
#include <linux/clk/at91_pmc.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/bitfield.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c
index bc4285e4bf75..03f8ee2c6a5d 100644
--- a/drivers/clk/at91/clk-slow.c
+++ b/drivers/clk/at91/clk-slow.c
@@ -13,7 +13,7 @@
#include <linux/clk/at91_pmc.h>
#include <linux/overflow.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c
index 6df698637cf1..58ccbf145e57 100644
--- a/drivers/clk/at91/clk-smd.c
+++ b/drivers/clk/at91/clk-smd.c
@@ -11,7 +11,7 @@
#include <linux/clk/at91_pmc.h>
#include <linux/overflow.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c
index 9a15d5b04a74..6166622a3ca8 100644
--- a/drivers/clk/at91/clk-system.c
+++ b/drivers/clk/at91/clk-system.c
@@ -9,7 +9,7 @@
#include <linux/clk.h>
#include <linux/clk/at91_pmc.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
index 148befc8ac68..0a715037edbd 100644
--- a/drivers/clk/at91/clk-usb.c
+++ b/drivers/clk/at91/clk-usb.c
@@ -11,7 +11,7 @@
#include <linux/clk/at91_pmc.h>
#include <linux/overflow.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "pmc.h"
diff --git a/drivers/clk/at91/clk-utmi.c b/drivers/clk/at91/clk-utmi.c
index 1389983bde89..d3855b18f7b4 100644
--- a/drivers/clk/at91/clk-utmi.c
+++ b/drivers/clk/at91/clk-utmi.c
@@ -9,7 +9,7 @@
#include <linux/clk.h>
#include <linux/clk/at91_pmc.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <soc/at91/atmel-sfr.h>
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
index 70b71422ff04..fea931aa7c6c 100644
--- a/drivers/clk/at91/pmc.c
+++ b/drivers/clk/at91/pmc.c
@@ -9,7 +9,7 @@
#include <linux/overflow.h>
#include <of.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <dt-bindings/clock/at91.h>
diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c
index 5368b0dbc93a..9651b616c8d5 100644
--- a/drivers/clk/at91/sam9x60.c
+++ b/drivers/clk/at91/sam9x60.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <driver.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <stdio.h>
#include <mfd/syscon.h>
diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index 31c7259b91df..b25adafab91a 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <driver.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <stdio.h>
#include <mfd/syscon.h>
diff --git a/drivers/clk/at91/sama5d3.c b/drivers/clk/at91/sama5d3.c
index f9c89dccee60..fdd97e583424 100644
--- a/drivers/clk/at91/sama5d3.c
+++ b/drivers/clk/at91/sama5d3.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <driver.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <stdio.h>
#include <mfd/syscon.h>
diff --git a/drivers/clk/at91/sama5d4.c b/drivers/clk/at91/sama5d4.c
index 2d6fc6df97e5..8c6b2c1e2da7 100644
--- a/drivers/clk/at91/sama5d4.c
+++ b/drivers/clk/at91/sama5d4.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <driver.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <stdio.h>
#include <mfd/syscon.h>
diff --git a/drivers/clk/at91/sckc.c b/drivers/clk/at91/sckc.c
index 579fbf2479df..3b50c2b08c3a 100644
--- a/drivers/clk/at91/sckc.c
+++ b/drivers/clk/at91/sckc.c
@@ -15,7 +15,7 @@
#include <linux/clk/at91_pmc.h>
#include <linux/overflow.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c
index 3ef38b361bc4..d6ccfa6d151e 100644
--- a/drivers/clk/clk-stm32f4.c
+++ b/drivers/clk/clk-stm32f4.c
@@ -12,7 +12,7 @@
#include <of_address.h>
#include <linux/math64.h>
#include <linux/iopoll.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <mfd/syscon.h>
/*
diff --git a/drivers/clk/rockchip/clk-inverter.c b/drivers/clk/rockchip/clk-inverter.c
index 7cdcf15fd8d1..ea72d8c6b28a 100644
--- a/drivers/clk/rockchip/clk-inverter.c
+++ b/drivers/clk/rockchip/clk-inverter.c
@@ -10,7 +10,7 @@
#include <xfuncs.h>
#include <linux/barebox-wrapper.h>
#include <linux/clk.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/spinlock.h>
#include "clk.h"
diff --git a/drivers/clk/rockchip/clk-muxgrf.c b/drivers/clk/rockchip/clk-muxgrf.c
index f06fa6951448..e81761422f64 100644
--- a/drivers/clk/rockchip/clk-muxgrf.c
+++ b/drivers/clk/rockchip/clk-muxgrf.c
@@ -7,7 +7,7 @@
#include <xfuncs.h>
#include <linux/barebox-wrapper.h>
#include <linux/clk.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/spinlock.h>
#include "clk.h"
diff --git a/drivers/clk/rockchip/clk-pll.c b/drivers/clk/rockchip/clk-pll.c
index 736b87e32b3c..ee0603557567 100644
--- a/drivers/clk/rockchip/clk-pll.c
+++ b/drivers/clk/rockchip/clk-pll.c
@@ -17,7 +17,7 @@
#include <linux/barebox-wrapper.h>
#include "clk.h"
#include <xfuncs.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/iopoll.h>
#define PLL_MODE_WIDTH 2
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index 5c074f526aa0..aca107a45db7 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -17,7 +17,7 @@
#include <common.h>
#include <malloc.h>
#include <linux/clk.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <mfd/syscon.h>
#include <linux/spinlock.h>
#include <linux/rational.h>
diff --git a/drivers/clk/socfpga/clk-gate-a10.c b/drivers/clk/socfpga/clk-gate-a10.c
index a78732124eaf..b66fbcdb8c54 100644
--- a/drivers/clk/socfpga/clk-gate-a10.c
+++ b/drivers/clk/socfpga/clk-gate-a10.c
@@ -6,7 +6,7 @@
#include <common.h>
#include <io.h>
#include <malloc.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/clk.h>
#include <linux/clkdev.h>
#include <mach/socfpga/arria10-regs.h>
diff --git a/drivers/gpio/gpio-sx150x.c b/drivers/gpio/gpio-sx150x.c
index 320c76af060b..ff7e86d64402 100644
--- a/drivers/gpio/gpio-sx150x.c
+++ b/drivers/gpio/gpio-sx150x.c
@@ -19,7 +19,7 @@
#include <xfuncs.h>
#include <errno.h>
#include <i2c/i2c.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <gpio.h>
#include <of_device.h>
diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
index afe6a6682276..b5d309080529 100644
--- a/drivers/hab/hab.c
+++ b/drivers/hab/hab.c
@@ -7,7 +7,7 @@
#include <libfile.h>
#include <mach/imx/generic.h>
#include <hab.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <fs.h>
#include <mach/imx/iim.h>
#include <mach/imx/imx25-fusemap.h>
diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index 32d8a084e7aa..bf9ec3099450 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -16,7 +16,7 @@
#include <driver.h>
#include <io.h>
#include <linux/clk.h>
-#include <regmap.h>
+#include <linux/regmap.h>
struct __packed i2c_regs {
u32 control;
diff --git a/drivers/i2c/busses/i2c-rockchip.c b/drivers/i2c/busses/i2c-rockchip.c
index 23bf4a55d722..ce029d148f5e 100644
--- a/drivers/i2c/busses/i2c-rockchip.c
+++ b/drivers/i2c/busses/i2c-rockchip.c
@@ -15,7 +15,7 @@
#include <io.h>
#include <linux/clk.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/sizes.h>
struct i2c_regs {
diff --git a/drivers/i2c/busses/i2c-stm32.c b/drivers/i2c/busses/i2c-stm32.c
index ba0d4a51b527..1be52b3dd97f 100644
--- a/drivers/i2c/busses/i2c-stm32.c
+++ b/drivers/i2c/busses/i2c-stm32.c
@@ -9,7 +9,7 @@
#include <common.h>
#include <i2c/i2c.h>
#include <init.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/clk.h>
#include <linux/iopoll.h>
#include <linux/reset.h>
diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c
index 6b2796fda570..293c3d7f9d56 100644
--- a/drivers/memory/atmel-ebi.c
+++ b/drivers/memory/atmel-ebi.c
@@ -14,7 +14,7 @@
#include <init.h>
#include <driver.h>
#include <of_device.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <soc/at91/atmel-sfr.h>
#include <linux/time.h>
#include <linux/printk.h>
diff --git a/drivers/mfd/axp20x-i2c.c b/drivers/mfd/axp20x-i2c.c
index 578f7bfcf2a4..bfd93902b4dc 100644
--- a/drivers/mfd/axp20x-i2c.c
+++ b/drivers/mfd/axp20x-i2c.c
@@ -19,7 +19,7 @@
#include <i2c/i2c.h>
#include <module.h>
#include <linux/mfd/axp20x.h>
-#include <regmap.h>
+#include <linux/regmap.h>
static int axp20x_i2c_probe(struct device *dev)
{
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index c61a6e00242a..666b9ea98cae 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -23,7 +23,7 @@
#include <module.h>
#include <of.h>
#include <of_device.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <regulator.h>
#define AXP20X_OFF BIT(7)
diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c
index eadb845f6cb9..1e06a24b4539 100644
--- a/drivers/mfd/mc13xxx.c
+++ b/drivers/mfd/mc13xxx.c
@@ -11,7 +11,7 @@
#include <errno.h>
#include <malloc.h>
#include <of.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <i2c/i2c.h>
#include <spi/spi.h>
diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
index 1361bb710198..77493a7b5b92 100644
--- a/drivers/mfd/rk808.c
+++ b/drivers/mfd/rk808.c
@@ -21,7 +21,7 @@
#include <driver.h>
#include <poweroff.h>
#include <of.h>
-#include <regmap.h>
+#include <linux/regmap.h>
struct rk808_reg_data {
int addr;
diff --git a/drivers/mfd/rohm-bd718x7.c b/drivers/mfd/rohm-bd718x7.c
index 20c572b6d766..e317a29ce533 100644
--- a/drivers/mfd/rohm-bd718x7.c
+++ b/drivers/mfd/rohm-bd718x7.c
@@ -14,7 +14,7 @@
#include <driver.h>
#include <poweroff.h>
#include <of.h>
-#include <regmap.h>
+#include <linux/regmap.h>
static struct mfd_cell bd71837_mfd_cells[] = {
{ .name = "gpio-keys", },
diff --git a/drivers/mfd/stpmic1.c b/drivers/mfd/stpmic1.c
index 56ab68256639..9985673aa676 100644
--- a/drivers/mfd/stpmic1.c
+++ b/drivers/mfd/stpmic1.c
@@ -9,7 +9,7 @@
#include <i2c/i2c.h>
#include <init.h>
#include <of.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/mfd/stpmic1.h>
static const struct regmap_config stpmic1_regmap_i2c_config = {
diff --git a/drivers/mfd/superio.c b/drivers/mfd/superio.c
index bd16b79011db..16d0bba4506e 100644
--- a/drivers/mfd/superio.c
+++ b/drivers/mfd/superio.c
@@ -7,7 +7,7 @@
#include <common.h>
#include <superio.h>
-#include <regmap.h>
+#include <linux/regmap.h>
struct device *superio_func_add(struct superio_chip *siochip, const char *name)
{
diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c
index cb74b365c8e4..5188a11cbef6 100644
--- a/drivers/mtd/nand/atmel/nand-controller.c
+++ b/drivers/mtd/nand/atmel/nand-controller.c
@@ -57,7 +57,7 @@
#include <of.h>
#include <of_device.h>
#include <linux/iopoll.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <soc/at91/atmel-sfr.h>
#include "pmecc.h"
diff --git a/drivers/net/designware_imx8.c b/drivers/net/designware_imx8.c
index d81dd499ab29..cd66473acd09 100644
--- a/drivers/net/designware_imx8.c
+++ b/drivers/net/designware_imx8.c
@@ -3,7 +3,7 @@
#include <common.h>
#include <init.h>
#include <net.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <mfd/syscon.h>
#include <linux/clk.h>
diff --git a/drivers/net/designware_rockchip.c b/drivers/net/designware_rockchip.c
index 04f56ce881a4..04e2b7f12dfd 100644
--- a/drivers/net/designware_rockchip.c
+++ b/drivers/net/designware_rockchip.c
@@ -4,7 +4,7 @@
#include <init.h>
#include <dma.h>
#include <net.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <of_net.h>
#include <mfd/syscon.h>
#include <linux/iopoll.h>
diff --git a/drivers/net/ksz8873.c b/drivers/net/ksz8873.c
index 7e98ec492a71..03d353075451 100644
--- a/drivers/net/ksz8873.c
+++ b/drivers/net/ksz8873.c
@@ -8,7 +8,7 @@
#include <linux/mdio.h>
#include <net.h>
#include <of_device.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#define KSZ8873_CHIP_ID0 0x00
#define KSZ8873_CHIP_ID1 0x01
diff --git a/drivers/net/realtek-dsa/realtek-mdio.c b/drivers/net/realtek-dsa/realtek-mdio.c
index 6776609b0480..463757711198 100644
--- a/drivers/net/realtek-dsa/realtek-mdio.c
+++ b/drivers/net/realtek-dsa/realtek-mdio.c
@@ -20,7 +20,7 @@
*/
#include <of_device.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <clock.h>
#include <linux/gpio/consumer.h>
#include <linux/printk.h>
diff --git a/drivers/net/realtek-dsa/realtek-smi.c b/drivers/net/realtek-dsa/realtek-smi.c
index 8e6f0e2ad94f..f93024ace516 100644
--- a/drivers/net/realtek-dsa/realtek-smi.c
+++ b/drivers/net/realtek-dsa/realtek-smi.c
@@ -35,7 +35,7 @@
#include <clock.h>
#include <linux/gpio/consumer.h>
#include <driver.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/bitops.h>
#include <linux/if_bridge.h>
diff --git a/drivers/net/realtek-dsa/rtl8365mb.c b/drivers/net/realtek-dsa/rtl8365mb.c
index d8e8ac714deb..700773ffa657 100644
--- a/drivers/net/realtek-dsa/rtl8365mb.c
+++ b/drivers/net/realtek-dsa/rtl8365mb.c
@@ -96,7 +96,7 @@
#include <linux/spinlock.h>
#include <linux/printk.h>
#include <linux/export.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <net.h>
#include <linux/if_bridge.h>
diff --git a/drivers/net/realtek-dsa/rtl8366rb.c b/drivers/net/realtek-dsa/rtl8366rb.c
index 5449b9481cf7..26f036dfe570 100644
--- a/drivers/net/realtek-dsa/rtl8366rb.c
+++ b/drivers/net/realtek-dsa/rtl8366rb.c
@@ -17,7 +17,7 @@
#include <linux/if_bridge.h>
#include <linux/printk.h>
#include <linux/export.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include "realtek.h"
diff --git a/drivers/nvmem/starfive-otp.c b/drivers/nvmem/starfive-otp.c
index 91069dc78ebf..d22350b10ef2 100644
--- a/drivers/nvmem/starfive-otp.c
+++ b/drivers/nvmem/starfive-otp.c
@@ -13,7 +13,7 @@
#include <net.h>
#include <io.h>
#include <of.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <machine_id.h>
#include <linux/reset.h>
#include <linux/clk.h>
diff --git a/drivers/pci/pci-layerscape.c b/drivers/pci/pci-layerscape.c
index 168948047030..0fb742af9ad7 100644
--- a/drivers/pci/pci-layerscape.c
+++ b/drivers/pci/pci-layerscape.c
@@ -21,7 +21,7 @@
#include <linux/kernel.h>
#include <of_address.h>
#include <of_pci.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <magicvar.h>
#include <globalvar.h>
#include <mfd/syscon.h>
diff --git a/drivers/power/reset/syscon-reboot-mode.c b/drivers/power/reset/syscon-reboot-mode.c
index 9d379c9dda0e..7d44d9c07e96 100644
--- a/drivers/power/reset/syscon-reboot-mode.c
+++ b/drivers/power/reset/syscon-reboot-mode.c
@@ -7,7 +7,7 @@
#include <init.h>
#include <driver.h>
#include <of.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <mfd/syscon.h>
#include <linux/reboot-mode.h>
#include <linux/overflow.h>
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c
index e78b503d4f71..4b4c1743046f 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -6,7 +6,7 @@
#include <common.h>
#include <init.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <regulator.h>
struct anatop_regulator {
diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c
index fb689a6bfc94..80102e2c1028 100644
--- a/drivers/regulator/helpers.c
+++ b/drivers/regulator/helpers.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <common.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <regulator.h>
/**
diff --git a/drivers/regulator/pfuze.c b/drivers/regulator/pfuze.c
index 8426d6f25be2..3e8890b10cec 100644
--- a/drivers/regulator/pfuze.c
+++ b/drivers/regulator/pfuze.c
@@ -10,7 +10,7 @@
#include <errno.h>
#include <malloc.h>
#include <of.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <mfd/pfuze.h>
#include <i2c/i2c.h>
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index 8c96b99c9be5..adb02623143f 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -14,7 +14,7 @@
#include <init.h>
#include <i2c/i2c.h>
#include <of_device.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/regulator/of_regulator.h>
#include <regulator.h>
#include <linux/mfd/rk808.h>
diff --git a/drivers/regulator/stpmic1_regulator.c b/drivers/regulator/stpmic1_regulator.c
index c8b56e3a1a18..beab7f163d1d 100644
--- a/drivers/regulator/stpmic1_regulator.c
+++ b/drivers/regulator/stpmic1_regulator.c
@@ -5,7 +5,7 @@
#include <common.h>
#include <init.h>
#include <of_device.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/regulator/of_regulator.h>
#include <regulator.h>
#include <linux/mfd/stpmic1.h>
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 68fe8031e5fb..bf76858ef35c 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -17,7 +17,7 @@
#include <memory.h>
#include <of_address.h>
#include <of_device.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#define IMX7D_SRC_SCR 0x0C
#define IMX7D_ENABLE_M4 BIT(3)
diff --git a/drivers/remoteproc/stm32_rproc.c b/drivers/remoteproc/stm32_rproc.c
index b6a62634842f..31df7fb49558 100644
--- a/drivers/remoteproc/stm32_rproc.c
+++ b/drivers/remoteproc/stm32_rproc.c
@@ -13,7 +13,7 @@
#include <mach/stm32mp/smc.h>
#include <mfd/syscon.h>
#include <of_address.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/remoteproc.h>
#include <linux/reset.h>
diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c
index 20542c536b99..c6c38f48a828 100644
--- a/drivers/reset/reset-imx7.c
+++ b/drivers/reset/reset-imx7.c
@@ -14,7 +14,7 @@
#include <linux/err.h>
#include <linux/reset-controller.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <of_device.h>
struct imx7_src_signal {
diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
index 57d9dcc99d9a..b967947478b9 100644
--- a/drivers/soc/imx/gpcv2.c
+++ b/drivers/soc/imx/gpcv2.c
@@ -10,7 +10,7 @@
#include <of_device.h>
#include <common.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/clk.h>
#include <linux/reset.h>
#include <clock.h>
diff --git a/drivers/soc/rockchip/io-domain.c b/drivers/soc/rockchip/io-domain.c
index 5b32dad9ed6b..d31d38b1daf7 100644
--- a/drivers/soc/rockchip/io-domain.c
+++ b/drivers/soc/rockchip/io-domain.c
@@ -14,7 +14,7 @@
#include <of.h>
#include <linux/err.h>
#include <mfd/syscon.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <regulator.h>
#define MAX_SUPPLIES 16
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index f827c9fc8244..f032e2673eb6 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -10,7 +10,7 @@
#include <errno.h>
#include <init.h>
#include <io.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <spi/spi.h>
#include <linux/clk.h>
#include <linux/math64.h>
diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index ed0af241f87d..1d6604fee33a 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -38,7 +38,7 @@
#include <errno.h>
#include <init.h>
#include <io.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/clk.h>
diff --git a/drivers/usb/typec/tusb320.c b/drivers/usb/typec/tusb320.c
index eb6b492481a3..90a846b0fbcc 100644
--- a/drivers/usb/typec/tusb320.c
+++ b/drivers/usb/typec/tusb320.c
@@ -14,7 +14,7 @@
#include <linux/printk.h>
#include <linux/bitops.h>
#include <module.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <linux/usb/typec.h>
#include <linux/usb/typec_altmode.h>
diff --git a/drivers/watchdog/rn5t568_wdt.c b/drivers/watchdog/rn5t568_wdt.c
index 0357320822ff..2011e3e01c5f 100644
--- a/drivers/watchdog/rn5t568_wdt.c
+++ b/drivers/watchdog/rn5t568_wdt.c
@@ -8,7 +8,7 @@
#include <common.h>
#include <init.h>
#include <watchdog.h>
-#include <regmap.h>
+#include <linux/regmap.h>
#include <of.h>
#define RN5T568_WATCHDOG 0x0b
--
2.39.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux
2023-10-20 7:18 [PATCH 00/11] regmap: align regmap_bulk_read/write API with Linux Ahmad Fatoum
` (10 preceding siblings ...)
2023-10-20 7:18 ` [PATCH 11/11] treewide: switch regmap.h include to linux/regmap.h Ahmad Fatoum
@ 2023-10-23 9:45 ` Sascha Hauer
11 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2023-10-23 9:45 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
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 |
^ permalink raw reply [flat|nested] 13+ messages in thread