7c6fe22b5f3a69e94d8c4681a75f1f02044bad1c
[openwrt/staging/stintel.git] /
1 From 814c978f02db17f16e6aa2efa2a929372f06da09 Mon Sep 17 00:00:00 2001
2 From: Miquel Raynal <miquel.raynal@bootlin.com>
3 Date: Tue, 4 Apr 2023 18:21:44 +0100
4 Subject: [PATCH] nvmem: Add macro to register nvmem layout drivers
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Provide a module_nvmem_layout_driver() macro at the end of the
10 nvmem-provider.h header to reduce the boilerplate when registering nvmem
11 layout drivers.
12
13 Suggested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
14 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
15 Acked-by: Rafał Miłecki <rafal@milecki.pl>
16 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
17 Link: https://lore.kernel.org/r/20230404172148.82422-37-srinivas.kandagatla@linaro.org
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 ---
20 include/linux/nvmem-provider.h | 6 ++++++
21 1 file changed, 6 insertions(+)
22
23 --- a/include/linux/nvmem-provider.h
24 +++ b/include/linux/nvmem-provider.h
25 @@ -9,6 +9,7 @@
26 #ifndef _LINUX_NVMEM_PROVIDER_H
27 #define _LINUX_NVMEM_PROVIDER_H
28
29 +#include <linux/device/driver.h>
30 #include <linux/err.h>
31 #include <linux/errno.h>
32 #include <linux/gpio/consumer.h>
33 @@ -242,4 +243,9 @@ nvmem_layout_get_match_data(struct nvmem
34 }
35
36 #endif /* CONFIG_NVMEM */
37 +
38 +#define module_nvmem_layout_driver(__layout_driver) \
39 + module_driver(__layout_driver, nvmem_layout_register, \
40 + nvmem_layout_unregister)
41 +
42 #endif /* ifndef _LINUX_NVMEM_PROVIDER_H */