lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230301152239.531194-9-miquel.raynal@bootlin.com>
Date:   Wed,  1 Mar 2023 16:22:39 +0100
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        <linux-kernel@...r.kernel.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Michael Walle <michael@...le.cc>, devicetree@...r.kernel.org,
        Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        Robert Marko <robert.marko@...tura.hr>,
        Luka Perkov <luka.perkov@...tura.hr>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        rafal@...ecki.pl, Miquel Raynal <miquel.raynal@...tlin.com>
Subject: [PATCH 8/8] nvmem: layouts: onie-tlv: Convert layout driver into a module

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@...tlin.com>
---
 drivers/nvmem/layouts/Kconfig    |  2 +-
 drivers/nvmem/layouts/onie-tlv.c | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/nvmem/layouts/Kconfig b/drivers/nvmem/layouts/Kconfig
index 3f2d73282242..7ff1ee1c1f05 100644
--- a/drivers/nvmem/layouts/Kconfig
+++ b/drivers/nvmem/layouts/Kconfig
@@ -12,7 +12,7 @@ config NVMEM_LAYOUT_SL28_VPD
 	  If unsure, say N.
 
 config NVMEM_LAYOUT_ONIE_TLV
-	bool "ONIE tlv support"
+	tristate "ONIE tlv support"
 	select CRC32
 	help
 	  Say Y here if you want to support the Open Compute Project ONIE
diff --git a/drivers/nvmem/layouts/onie-tlv.c b/drivers/nvmem/layouts/onie-tlv.c
index 767f39fff717..d45b7301a69d 100644
--- a/drivers/nvmem/layouts/onie-tlv.c
+++ b/drivers/nvmem/layouts/onie-tlv.c
@@ -230,6 +230,7 @@ static const struct of_device_id onie_tlv_of_match_table[] = {
 	{ .compatible = "onie,tlv-layout", },
 	{},
 };
+MODULE_DEVICE_TABLE(of, onie_tlv_of_match_table);
 
 static struct nvmem_layout onie_tlv_layout = {
 	.name = "ONIE tlv layout",
@@ -241,4 +242,16 @@ static int __init onie_tlv_init(void)
 {
 	return nvmem_layout_register(&onie_tlv_layout);
 }
-subsys_initcall(onie_tlv_init);
+
+static void __exit onie_tlv_exit(void)
+{
+	nvmem_layout_unregister(&onie_tlv_layout);
+}
+
+module_init(onie_tlv_init);
+module_exit(onie_tlv_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Miquel Raynal <miquel.raynal@...tlin.com>");
+MODULE_DESCRIPTION("NVMEM layout driver for Onie TLV table parsing");
+MODULE_ALIAS("NVMEM layout driver for Onie TLV table parsing");
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ