soc: rockchip: vendor storage: make modules support
This submit supports to compile vendor storage into a module. Change-Id: Id88bbee6ff44a75b2aa163a669098d410afaa921 Signed-off-by: Yifeng Zhao <zyf@rock-chips.com>
This commit is contained in:
@@ -360,3 +360,4 @@ static __exit void vendor_storage_deinit(void)
|
||||
|
||||
device_initcall_sync(vendor_storage_init);
|
||||
module_exit(vendor_storage_deinit);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -75,6 +75,7 @@ static DEFINE_MUTEX(vendor_ops_mutex);
|
||||
static struct mtd_info *mtd;
|
||||
static const char *vendor_mtd_name = "vnvm";
|
||||
static struct mtd_nand_info nand_info;
|
||||
static struct platform_device *g_pdev;
|
||||
|
||||
static int mtd_vendor_nand_write(void)
|
||||
{
|
||||
@@ -437,6 +438,8 @@ static int __init vendor_storage_init(void)
|
||||
|
||||
g_idb_buffer = NULL;
|
||||
ret = platform_driver_register(&vendor_storage_driver);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pdev = platform_device_register_simple("mtd_vendor_storage",
|
||||
-1, NULL, 0);
|
||||
@@ -444,8 +447,17 @@ static int __init vendor_storage_init(void)
|
||||
platform_driver_unregister(&vendor_storage_driver);
|
||||
return PTR_ERR(pdev);
|
||||
}
|
||||
g_pdev = pdev;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static __exit void vendor_storage_deinit(void)
|
||||
{
|
||||
platform_device_unregister(g_pdev);
|
||||
platform_driver_unregister(&vendor_storage_driver);
|
||||
}
|
||||
|
||||
module_init(vendor_storage_init);
|
||||
module_exit(vendor_storage_deinit);
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/soc/rockchip/rk_vendor_storage.h>
|
||||
|
||||
int (*_vendor_read)(u32 id, void *pbuf, u32 size) = NULL;
|
||||
@@ -47,3 +48,5 @@ bool is_rk_vendor_ready(void)
|
||||
return false;
|
||||
}
|
||||
EXPORT_SYMBOL(is_rk_vendor_ready);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -28,9 +28,31 @@
|
||||
#define LAN_RGMII_DL_ID 16
|
||||
#define EINK_VCOM_ID 17
|
||||
|
||||
#if IS_ENABLED(CONFIG_ROCKCHIP_VENDOR_STORAGE)
|
||||
int rk_vendor_read(u32 id, void *pbuf, u32 size);
|
||||
int rk_vendor_write(u32 id, void *pbuf, u32 size);
|
||||
int rk_vendor_register(void *read, void *write);
|
||||
bool is_rk_vendor_ready(void);
|
||||
#else
|
||||
static inline int rk_vendor_read(u32 id, void *pbuf, u32 size)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int rk_vendor_write(u32 id, void *pbuf, u32 size)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int rk_vendor_register(void *read, void *write)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline bool is_rk_vendor_ready(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user