]> Git Repo - linux.git/blob - drivers/nvmem/nvmem.h
efi/x86: add headroom to decompressor BSS to account for setup block
[linux.git] / drivers / nvmem / nvmem.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2
3 #ifndef _DRIVERS_NVMEM_H
4 #define _DRIVERS_NVMEM_H
5
6 #include <linux/device.h>
7 #include <linux/fs.h>
8 #include <linux/kref.h>
9 #include <linux/list.h>
10 #include <linux/nvmem-consumer.h>
11 #include <linux/nvmem-provider.h>
12 #include <linux/gpio/consumer.h>
13
14 struct nvmem_device {
15         struct module           *owner;
16         struct device           dev;
17         int                     stride;
18         int                     word_size;
19         int                     id;
20         struct kref             refcnt;
21         size_t                  size;
22         bool                    read_only;
23         int                     flags;
24         enum nvmem_type         type;
25         struct bin_attribute    eeprom;
26         struct device           *base_dev;
27         struct list_head        cells;
28         nvmem_reg_read_t        reg_read;
29         nvmem_reg_write_t       reg_write;
30         struct gpio_desc        *wp_gpio;
31         void *priv;
32 };
33
34 #define to_nvmem_device(d) container_of(d, struct nvmem_device, dev)
35 #define FLAG_COMPAT             BIT(0)
36
37 #ifdef CONFIG_NVMEM_SYSFS
38 const struct attribute_group **nvmem_sysfs_get_groups(
39                                         struct nvmem_device *nvmem,
40                                         const struct nvmem_config *config);
41 int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem,
42                               const struct nvmem_config *config);
43 void nvmem_sysfs_remove_compat(struct nvmem_device *nvmem,
44                               const struct nvmem_config *config);
45 #else
46 static inline const struct attribute_group **nvmem_sysfs_get_groups(
47                                         struct nvmem_device *nvmem,
48                                         const struct nvmem_config *config)
49 {
50         return NULL;
51 }
52
53 static inline int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem,
54                                       const struct nvmem_config *config)
55 {
56         return -ENOSYS;
57 }
58 static inline void nvmem_sysfs_remove_compat(struct nvmem_device *nvmem,
59                               const struct nvmem_config *config)
60 {
61 }
62 #endif /* CONFIG_NVMEM_SYSFS */
63
64 #endif /* _DRIVERS_NVMEM_H */
This page took 0.035325 seconds and 4 git commands to generate.