1 From fbd03d27776c6121a483921601418e3c8f0ff37e Mon Sep 17 00:00:00 2001
2 From: Michael Walle <michael@walle.cc>
3 Date: Mon, 6 Feb 2023 13:43:47 +0000
4 Subject: [PATCH] nvmem: core: move struct nvmem_cell_info to nvmem-provider.h
6 struct nvmem_cell_info is used to describe a cell. Thus this should
7 really be in the nvmem-provider's header. There are two (unused) nvmem
8 access methods which use the nvmem_cell_info to describe the cell to be
9 accesses. One can argue, that they will create a cell before accessing,
10 thus they are both a provider and a consumer.
12 struct nvmem_cell_info will get used more and more by nvmem-providers,
13 don't force them to also include the consumer header, although they are
16 Signed-off-by: Michael Walle <michael@walle.cc>
17 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
18 Link: https://lore.kernel.org/r/20230206134356.839737-14-srinivas.kandagatla@linaro.org
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 include/linux/nvmem-consumer.h | 10 +---------
22 include/linux/nvmem-provider.h | 19 ++++++++++++++++++-
23 2 files changed, 19 insertions(+), 10 deletions(-)
25 --- a/include/linux/nvmem-consumer.h
26 +++ b/include/linux/nvmem-consumer.h
27 @@ -18,15 +18,7 @@ struct device_node;
32 -struct nvmem_cell_info {
34 - unsigned int offset;
36 - unsigned int bit_offset;
38 - struct device_node *np;
40 +struct nvmem_cell_info;
43 * struct nvmem_cell_lookup - cell lookup entry
44 --- a/include/linux/nvmem-provider.h
45 +++ b/include/linux/nvmem-provider.h
47 #include <linux/gpio/consumer.h>
50 -struct nvmem_cell_info;
51 typedef int (*nvmem_reg_read_t)(void *priv, unsigned int offset,
52 void *val, size_t bytes);
53 typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset,
54 @@ -48,6 +47,24 @@ struct nvmem_keepout {
58 + * struct nvmem_cell_info - NVMEM cell description
60 + * @offset: Offset within the NVMEM device.
61 + * @bytes: Length of the cell.
62 + * @bit_offset: Bit offset if cell is smaller than a byte.
63 + * @nbits: Number of bits.
64 + * @np: Optional device_node pointer.
66 +struct nvmem_cell_info {
68 + unsigned int offset;
70 + unsigned int bit_offset;
72 + struct device_node *np;
76 * struct nvmem_config - NVMEM device configuration
78 * @dev: Parent device.