Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nvmem: Move of_nvmem_layout_get_container() in another header

nvmem-consumer.h is included by consumer devices, extracting data from
NVMEM devices whereas nvmem-provider.h is included by devices providing
NVMEM content.

The only users of of_nvmem_layout_get_container() outside of the core
are layout drivers, so better move its prototype to nvmem-provider.h.

While we do so, we also move the kdoc associated with the function to
the header rather than the .c file.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231215111536.316972-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Miquel Raynal and committed by
Greg Kroah-Hartman
4a1a4023 7f38b700

+21 -15
-8
drivers/nvmem/core.c
··· 847 847 } 848 848 849 849 #if IS_ENABLED(CONFIG_OF) 850 - /** 851 - * of_nvmem_layout_get_container() - Get OF node to layout container. 852 - * 853 - * @nvmem: nvmem device. 854 - * 855 - * Return: a node pointer with refcount incremented or NULL if no 856 - * container exists. Use of_node_put() on it when done. 857 - */ 858 850 struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem) 859 851 { 860 852 return of_get_child_by_name(nvmem->dev.of_node, "nvmem-layout");
-7
include/linux/nvmem-consumer.h
··· 247 247 const char *id); 248 248 struct nvmem_device *of_nvmem_device_get(struct device_node *np, 249 249 const char *name); 250 - struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem); 251 250 #else 252 251 static inline struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, 253 252 const char *id) ··· 258 259 const char *name) 259 260 { 260 261 return ERR_PTR(-EOPNOTSUPP); 261 - } 262 - 263 - static inline struct device_node * 264 - of_nvmem_layout_get_container(struct nvmem_device *nvmem) 265 - { 266 - return NULL; 267 262 } 268 263 #endif /* CONFIG_NVMEM && CONFIG_OF */ 269 264
+21
include/linux/nvmem-provider.h
··· 244 244 245 245 #endif /* CONFIG_NVMEM */ 246 246 247 + #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) 248 + 249 + /** 250 + * of_nvmem_layout_get_container() - Get OF node of layout container 251 + * 252 + * @nvmem: nvmem device 253 + * 254 + * Return: a node pointer with refcount incremented or NULL if no 255 + * container exists. Use of_node_put() on it when done. 256 + */ 257 + struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem); 258 + 259 + #else /* CONFIG_NVMEM && CONFIG_OF */ 260 + 261 + static inline struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem) 262 + { 263 + return NULL; 264 + } 265 + 266 + #endif /* CONFIG_NVMEM && CONFIG_OF */ 267 + 247 268 #define module_nvmem_layout_driver(__layout_driver) \ 248 269 module_driver(__layout_driver, nvmem_layout_register, \ 249 270 nvmem_layout_unregister)