i2c: sprd: Make I2C driver can be built as a module
authorBaolin Wang <baolin.wang@linaro.org>
Thu, 25 Jul 2019 07:56:16 +0000 (15:56 +0800)
committerWolfram Sang <wsa@the-dreams.de>
Tue, 6 Aug 2019 20:54:23 +0000 (22:54 +0200)
Now there is no need to keep our I2C driver to be initialized so early,
thus changing to module level and let it can be built as a module,
meanwhile adding some module information.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/busses/Kconfig
drivers/i2c/busses/i2c-sprd.c

index 09367fc..69f1931 100644 (file)
@@ -977,7 +977,7 @@ config I2C_SIRF
          will be called i2c-sirf.
 
 config I2C_SPRD
-       bool "Spreadtrum I2C interface"
+       tristate "Spreadtrum I2C interface"
        depends on I2C=y && ARCH_SPRD
        help
          If you say yes to this option, support will be included for the
index 9611235..8002835 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
@@ -644,8 +645,7 @@ static struct platform_driver sprd_i2c_driver = {
        },
 };
 
-static int sprd_i2c_init(void)
-{
-       return platform_driver_register(&sprd_i2c_driver);
-}
-arch_initcall_sync(sprd_i2c_init);
+module_platform_driver(sprd_i2c_driver);
+
+MODULE_DESCRIPTION("Spreadtrum I2C master controller driver");
+MODULE_LICENSE("GPL v2");