The nvmem core has already been converted to accept layout drivers compiled as modules. So in order to make this change effective we need to convert this driver so it can also be compiled as a module. We then need to expose the match table, provide MODULE_* macros, use module_init/exit() instead of the early subsys_initcall() and of course update the Kconfig symbol type to tristate. Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> --- drivers/nvmem/layouts/Kconfig | 2 +- drivers/nvmem/layouts/sl28vpd.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/nvmem/layouts/Kconfig b/drivers/nvmem/layouts/Kconfig index 9ad50474cb77..3f2d73282242 100644 --- a/drivers/nvmem/layouts/Kconfig +++ b/drivers/nvmem/layouts/Kconfig @@ -3,7 +3,7 @@ menu "Layout Types" config NVMEM_LAYOUT_SL28_VPD - bool "Kontron sl28 VPD layout support" + tristate "Kontron sl28 VPD layout support" select CRC8 help Say Y here if you want to support the VPD layout of the Kontron diff --git a/drivers/nvmem/layouts/sl28vpd.c b/drivers/nvmem/layouts/sl28vpd.c index a36800f201a3..9370e41bad73 100644 --- a/drivers/nvmem/layouts/sl28vpd.c +++ b/drivers/nvmem/layouts/sl28vpd.c @@ -139,6 +139,7 @@ static const struct of_device_id sl28vpd_of_match_table[] = { { .compatible = "kontron,sl28-vpd" }, {}, }; +MODULE_DEVICE_TABLE(of, sl28vpd_of_match_table); struct nvmem_layout sl28vpd_layout = { .name = "sl28-vpd", @@ -150,4 +151,15 @@ static int __init sl28vpd_init(void) { return nvmem_layout_register(&sl28vpd_layout); } -subsys_initcall(sl28vpd_init); + +static void __exit sl28vpd_exit(void) +{ + nvmem_layout_unregister(&sl28vpd_layout); +} + +module_init(sl28vpd_init); +module_exit(sl28vpd_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Michael Walle <michael@xxxxxxxx>"); +MODULE_DESCRIPTION("NVMEM layout driver for the VPD of Kontron sl28 boards"); -- 2.34.1