1 From ec9c08a1cb8dc5e8e003f95f5f62de41dde235bb Mon Sep 17 00:00:00 2001
2 From: Miquel Raynal <miquel.raynal@bootlin.com>
3 Date: Fri, 15 Dec 2023 11:15:29 +0000
4 Subject: [PATCH] nvmem: Create a header for internal sharing
6 Before adding all the NVMEM layout bus infrastructure to the core, let's
7 move the main nvmem_device structure in an internal header, only
8 available to the core. This way all the additional code can be added in
9 a dedicated file in order to keep the current core file tidy.
11 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
12 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
13 Link: https://lore.kernel.org/r/20231215111536.316972-4-srinivas.kandagatla@linaro.org
14 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16 drivers/nvmem/core.c | 24 +-----------------------
17 drivers/nvmem/internals.h | 35 +++++++++++++++++++++++++++++++++++
18 2 files changed, 36 insertions(+), 23 deletions(-)
19 create mode 100644 drivers/nvmem/internals.h
21 --- a/drivers/nvmem/core.c
22 +++ b/drivers/nvmem/core.c
24 #include <linux/of_device.h>
25 #include <linux/slab.h>
27 -struct nvmem_device {
28 - struct module *owner;
38 - enum nvmem_type type;
39 - struct bin_attribute eeprom;
40 - struct device *base_dev;
41 - struct list_head cells;
42 - const struct nvmem_keepout *keepout;
43 - unsigned int nkeepout;
44 - nvmem_reg_read_t reg_read;
45 - nvmem_reg_write_t reg_write;
46 - struct gpio_desc *wp_gpio;
47 - struct nvmem_layout *layout;
50 +#include "internals.h"
52 #define to_nvmem_device(d) container_of(d, struct nvmem_device, dev)
55 +++ b/drivers/nvmem/internals.h
57 +/* SPDX-License-Identifier: GPL-2.0 */
59 +#ifndef _LINUX_NVMEM_INTERNALS_H
60 +#define _LINUX_NVMEM_INTERNALS_H
62 +#include <linux/device.h>
63 +#include <linux/nvmem-consumer.h>
64 +#include <linux/nvmem-provider.h>
66 +struct nvmem_device {
67 + struct module *owner;
69 + struct list_head node;
78 + enum nvmem_type type;
79 + struct bin_attribute eeprom;
80 + struct device *base_dev;
81 + struct list_head cells;
82 + const struct nvmem_keepout *keepout;
83 + unsigned int nkeepout;
84 + nvmem_reg_read_t reg_read;
85 + nvmem_reg_write_t reg_write;
86 + struct gpio_desc *wp_gpio;
87 + struct nvmem_layout *layout;
91 +#endif /* ifndef _LINUX_NVMEM_INTERNALS_H */