kernel: backport NVMEM changes queued for v6.8
[openwrt/staging/stintel.git] / target / linux / generic / backport-5.15 / 834-v6.8-0003-nvmem-Simplify-the-add_cells-hook.patch
1 From 1b7c298a4ecbc28cc6ee94005734bff55eb83d22 Mon Sep 17 00:00:00 2001
2 From: Miquel Raynal <miquel.raynal@bootlin.com>
3 Date: Fri, 15 Dec 2023 11:15:30 +0000
4 Subject: [PATCH] nvmem: Simplify the ->add_cells() hook
5
6 The layout entry is not used and will anyway be made useless by the new
7 layout bus infrastructure coming next, so drop it. While at it, clarify
8 the kdoc entry.
9
10 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
11 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
12 Link: https://lore.kernel.org/r/20231215111536.316972-5-srinivas.kandagatla@linaro.org
13 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
14 ---
15 drivers/nvmem/core.c | 2 +-
16 drivers/nvmem/layouts/onie-tlv.c | 3 +--
17 drivers/nvmem/layouts/sl28vpd.c | 3 +--
18 include/linux/nvmem-provider.h | 8 +++-----
19 4 files changed, 6 insertions(+), 10 deletions(-)
20
21 --- a/drivers/nvmem/core.c
22 +++ b/drivers/nvmem/core.c
23 @@ -817,7 +817,7 @@ static int nvmem_add_cells_from_layout(s
24 int ret;
25
26 if (layout && layout->add_cells) {
27 - ret = layout->add_cells(&nvmem->dev, nvmem, layout);
28 + ret = layout->add_cells(&nvmem->dev, nvmem);
29 if (ret)
30 return ret;
31 }
32 --- a/drivers/nvmem/layouts/onie-tlv.c
33 +++ b/drivers/nvmem/layouts/onie-tlv.c
34 @@ -182,8 +182,7 @@ static bool onie_tlv_crc_is_valid(struct
35 return true;
36 }
37
38 -static int onie_tlv_parse_table(struct device *dev, struct nvmem_device *nvmem,
39 - struct nvmem_layout *layout)
40 +static int onie_tlv_parse_table(struct device *dev, struct nvmem_device *nvmem)
41 {
42 struct onie_tlv_hdr hdr;
43 size_t table_len, data_len, hdr_len;
44 --- a/drivers/nvmem/layouts/sl28vpd.c
45 +++ b/drivers/nvmem/layouts/sl28vpd.c
46 @@ -80,8 +80,7 @@ static int sl28vpd_v1_check_crc(struct d
47 return 0;
48 }
49
50 -static int sl28vpd_add_cells(struct device *dev, struct nvmem_device *nvmem,
51 - struct nvmem_layout *layout)
52 +static int sl28vpd_add_cells(struct device *dev, struct nvmem_device *nvmem)
53 {
54 const struct nvmem_cell_info *pinfo;
55 struct nvmem_cell_info info = {0};
56 --- a/include/linux/nvmem-provider.h
57 +++ b/include/linux/nvmem-provider.h
58 @@ -156,9 +156,8 @@ struct nvmem_cell_table {
59 *
60 * @name: Layout name.
61 * @of_match_table: Open firmware match table.
62 - * @add_cells: Will be called if a nvmem device is found which
63 - * has this layout. The function will add layout
64 - * specific cells with nvmem_add_one_cell().
65 + * @add_cells: Called to populate the layout using
66 + * nvmem_add_one_cell().
67 * @fixup_cell_info: Will be called before a cell is added. Can be
68 * used to modify the nvmem_cell_info.
69 * @owner: Pointer to struct module.
70 @@ -172,8 +171,7 @@ struct nvmem_cell_table {
71 struct nvmem_layout {
72 const char *name;
73 const struct of_device_id *of_match_table;
74 - int (*add_cells)(struct device *dev, struct nvmem_device *nvmem,
75 - struct nvmem_layout *layout);
76 + int (*add_cells)(struct device *dev, struct nvmem_device *nvmem);
77 void (*fixup_cell_info)(struct nvmem_device *nvmem,
78 struct nvmem_layout *layout,
79 struct nvmem_cell_info *cell);