f3829b3e17f4f6a1cfa0e8cac354bdf3d29cb8e4
[openwrt/staging/neocturne.git] /
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
5
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.
11
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
14 not.
15
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>
20 ---
21 include/linux/nvmem-consumer.h | 10 +---------
22 include/linux/nvmem-provider.h | 19 ++++++++++++++++++-
23 2 files changed, 19 insertions(+), 10 deletions(-)
24
25 --- a/include/linux/nvmem-consumer.h
26 +++ b/include/linux/nvmem-consumer.h
27 @@ -18,15 +18,7 @@ struct device_node;
28 /* consumer cookie */
29 struct nvmem_cell;
30 struct nvmem_device;
31 -
32 -struct nvmem_cell_info {
33 - const char *name;
34 - unsigned int offset;
35 - unsigned int bytes;
36 - unsigned int bit_offset;
37 - unsigned int nbits;
38 - struct device_node *np;
39 -};
40 +struct nvmem_cell_info;
41
42 /**
43 * struct nvmem_cell_lookup - cell lookup entry
44 --- a/include/linux/nvmem-provider.h
45 +++ b/include/linux/nvmem-provider.h
46 @@ -14,7 +14,6 @@
47 #include <linux/gpio/consumer.h>
48
49 struct nvmem_device;
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 {
55 };
56
57 /**
58 + * struct nvmem_cell_info - NVMEM cell description
59 + * @name: Name.
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.
65 + */
66 +struct nvmem_cell_info {
67 + const char *name;
68 + unsigned int offset;
69 + unsigned int bytes;
70 + unsigned int bit_offset;
71 + unsigned int nbits;
72 + struct device_node *np;
73 +};
74 +
75 +/**
76 * struct nvmem_config - NVMEM device configuration
77 *
78 * @dev: Parent device.