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

nvmem: drop nvmem_layout_get_match_data()

Thanks for layouts refactoring we now have "struct device" associated
with layout. Also its OF pointer points directly to the "nvmem-layout"
DT node.

All it takes to get match data is a generic of_device_get_match_data().

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Link: https://lore.kernel.org/r/20231219120104.3422-2-zajec5@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rafał Miłecki and committed by
Greg Kroah-Hartman
43f60e3f 401df0d4

-23
-13
drivers/nvmem/core.c
··· 876 876 } 877 877 EXPORT_SYMBOL_GPL(nvmem_layout_unregister); 878 878 879 - const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, 880 - struct nvmem_layout *layout) 881 - { 882 - struct device_node __maybe_unused *layout_np; 883 - const struct of_device_id *match; 884 - 885 - layout_np = of_nvmem_layout_get_container(nvmem); 886 - match = of_match_node(layout->dev.driver->of_match_table, layout_np); 887 - 888 - return match ? match->data : NULL; 889 - } 890 - EXPORT_SYMBOL_GPL(nvmem_layout_get_match_data); 891 - 892 879 /** 893 880 * nvmem_register() - Register a nvmem device for given nvmem_config. 894 881 * Also creates a binary entry in /sys/bus/nvmem/devices/dev-name/nvmem
-10
include/linux/nvmem-provider.h
··· 205 205 module_driver(__nvmem_layout_driver, nvmem_layout_driver_register, \ 206 206 nvmem_layout_driver_unregister) 207 207 208 - const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, 209 - struct nvmem_layout *layout); 210 - 211 208 #else 212 209 213 210 static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) ··· 234 237 } 235 238 236 239 static inline void nvmem_layout_unregister(struct nvmem_layout *layout) {} 237 - 238 - static inline const void * 239 - nvmem_layout_get_match_data(struct nvmem_device *nvmem, 240 - struct nvmem_layout *layout) 241 - { 242 - return NULL; 243 - } 244 240 245 241 #endif /* CONFIG_NVMEM */ 246 242