55c3c5d6fe76dcfb40ef751b5fd8ec592343bb65
[openwrt/staging/jow.git] /
1 From 1f7b4d87874624f4beb25253900a25306a193b8b Mon Sep 17 00:00:00 2001
2 From: Douglas Anderson <dianders@chromium.org>
3 Date: Fri, 11 Jun 2021 09:33:47 +0100
4 Subject: [PATCH] nvmem: core: constify nvmem_cell_read_variable_common()
5 return value
6
7 The caller doesn't modify the memory pointed to by the pointer so it
8 can be const.
9
10 Suggested-by: Stephen Boyd <swboyd@chromium.org>
11 Signed-off-by: Douglas Anderson <dianders@chromium.org>
12 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
13 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
14 Link: https://lore.kernel.org/r/20210611083348.20170-9-srinivas.kandagatla@linaro.org
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16 ---
17 drivers/nvmem/core.c | 10 +++++-----
18 1 file changed, 5 insertions(+), 5 deletions(-)
19
20 --- a/drivers/nvmem/core.c
21 +++ b/drivers/nvmem/core.c
22 @@ -1614,9 +1614,9 @@ int nvmem_cell_read_u64(struct device *d
23 }
24 EXPORT_SYMBOL_GPL(nvmem_cell_read_u64);
25
26 -static void *nvmem_cell_read_variable_common(struct device *dev,
27 - const char *cell_id,
28 - size_t max_len, size_t *len)
29 +static const void *nvmem_cell_read_variable_common(struct device *dev,
30 + const char *cell_id,
31 + size_t max_len, size_t *len)
32 {
33 struct nvmem_cell *cell;
34 int nbits;
35 @@ -1660,7 +1660,7 @@ int nvmem_cell_read_variable_le_u32(stru
36 u32 *val)
37 {
38 size_t len;
39 - u8 *buf;
40 + const u8 *buf;
41 int i;
42
43 buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len);
44 @@ -1691,7 +1691,7 @@ int nvmem_cell_read_variable_le_u64(stru
45 u64 *val)
46 {
47 size_t len;
48 - u8 *buf;
49 + const u8 *buf;
50 int i;
51
52 buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len);