media: rockchip: cif: fix compile error when config with module

Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
Change-Id: I2dd063fddab1abfcd86c415bce89a594f763b786
This commit is contained in:
Allon Huang
2020-07-29 10:28:08 +08:00
parent 415635bfda
commit 0fa77a1ace
4 changed files with 47 additions and 3 deletions

View File

@@ -1389,7 +1389,7 @@ static int __maybe_unused rkcif_runtime_resume(struct device *dev)
return 0;
}
static int __init rkcif_clr_unready_dev(void)
static int __maybe_unused __rkcif_clr_unready_dev(void)
{
struct rkcif_device *cif_dev;
@@ -1400,7 +1400,28 @@ static int __init rkcif_clr_unready_dev(void)
return 0;
}
static int rkcif_clr_unready_dev_param_set(const char *val, const struct kernel_param *kp)
{
#ifdef MODULE
__rkcif_clr_unready_dev();
#endif
return 0;
}
module_param_call(clr_unready_dev, rkcif_clr_unready_dev_param_set, NULL, NULL, 0200);
MODULE_PARM_DESC(clr_unready_dev, "clear unready devices");
#ifndef MODULE
static int __init rkcif_clr_unready_dev(void)
{
__rkcif_clr_unready_dev();
return 0;
}
late_initcall_sync(rkcif_clr_unready_dev);
#endif
static const struct dev_pm_ops rkcif_plat_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
@@ -1418,7 +1439,22 @@ static struct platform_driver rkcif_plat_drv = {
.remove = rkcif_plat_remove,
};
#ifdef MODULE
static int __init rk_cif_plat_drv_init(void)
{
int ret;
ret = platform_driver_register(&rkcif_plat_drv);
if (ret)
return ret;
return rkcif_csi2_plat_drv_init();
}
module_init(rk_cif_plat_drv_init);
#else
module_platform_driver(rkcif_plat_drv);
#endif
MODULE_AUTHOR("Rockchip Camera/ISP team");
MODULE_DESCRIPTION("Rockchip CIF platform driver");
MODULE_LICENSE("GPL v2");

View File

@@ -19,6 +19,7 @@
#include "regs.h"
#include "version.h"
#include "cif-luma.h"
#include "mipi-csi2.h"
#define CIF_DRIVER_NAME "rkcif"
#define CIF_VIDEODEVICE_NAME "stream_cif"

View File

@@ -748,7 +748,14 @@ static struct platform_driver csi2_driver = {
.remove = csi2_remove,
};
#ifdef MODULE
int __init rkcif_csi2_plat_drv_init(void)
{
return platform_driver_register(&csi2_driver);
}
#else
module_platform_driver(csi2_driver);
#endif
MODULE_DESCRIPTION("Rockchip MIPI CSI2 driver");
MODULE_AUTHOR("Macrofly.xu <xuhf@rock-chips.com>");

View File

@@ -3,8 +3,8 @@
#ifndef _RKCIF_MIPI_CSI2_H_
#define _RKCIF_MIPI_CSI2_H_
void rkcif_csi2_event_inc_sof(void);
u32 rkcif_csi2_get_sof(void);
void rkcif_csi2_event_inc_sof(void);
int __init rkcif_csi2_plat_drv_init(void);
#endif