[7/8] nvmem: layouts: sl28vpd: Convert layout driver into a module
Commit Message
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@bootlin.com>
---
drivers/nvmem/layouts/Kconfig | 2 +-
drivers/nvmem/layouts/sl28vpd.c | 14 +++++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
@@ -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
@@ -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@walle.cc>");
+MODULE_DESCRIPTION("NVMEM layout driver for the VPD of Kontron sl28 boards");