memory: mtk-smi: Allow building as module
authorYong Wu <yong.wu@mediatek.com>
Tue, 26 Jan 2021 06:00:55 +0000 (14:00 +0800)
committerKrzysztof Kozlowski <krzk@kernel.org>
Tue, 26 Jan 2021 19:47:51 +0000 (20:47 +0100)
Add support for building the SMI driver as module. Switch MTK_SMI to
tristate, and add module_exit/module_license.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210126060055.11050-1-yong.wu@mediatek.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
drivers/memory/Kconfig
drivers/memory/mtk-smi.c
include/soc/mediatek/smi.h

index 7e01b5157f4076f7c82ece136f78a9a7f1cf528f..7d9d33d8ebf66bdb6b013ba993fcc1f2c77aefd6 100644 (file)
@@ -173,7 +173,7 @@ config JZ4780_NEMC
          memory devices such as NAND and SRAM.
 
 config MTK_SMI
-       bool "Mediatek SoC Memory Controller driver" if COMPILE_TEST
+       tristate "MediaTek SoC Memory Controller driver" if COMPILE_TEST
        depends on ARCH_MEDIATEK || COMPILE_TEST
        help
          This driver is for the Memory Controller module in MediaTek SoCs,
index c07bb0b3144b86876e4cfcfd3ff61bd02a3fb4cc..40c02d7315f64b74e19aa355ea9ecd77f6be7c00 100644 (file)
@@ -597,3 +597,12 @@ static int __init mtk_smi_init(void)
        return platform_register_drivers(smidrivers, ARRAY_SIZE(smidrivers));
 }
 module_init(mtk_smi_init);
+
+static void __exit mtk_smi_exit(void)
+{
+       platform_unregister_drivers(smidrivers, ARRAY_SIZE(smidrivers));
+}
+module_exit(mtk_smi_exit);
+
+MODULE_DESCRIPTION("MediaTek SMI driver");
+MODULE_LICENSE("GPL v2");
index 5a34b87d89e32fdc7bbea9a138fcc5f80c482f99..29e2fb8f33d6f83ef55bc12f205161755155c3db 100644 (file)
@@ -9,7 +9,7 @@
 #include <linux/bitops.h>
 #include <linux/device.h>
 
-#ifdef CONFIG_MTK_SMI
+#if IS_ENABLED(CONFIG_MTK_SMI)
 
 #define MTK_LARB_NR_MAX                16