mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 22:52:35 +02:00
camera: rockchip: fix some compiled errors and warn
fix spin_unlock error use and some potential problems. Change-Id: I860c225f2acb5e28827ad3f6b702b0dc7828bb0f Signed-off-by: xcq <shawn.xu@rock-chips.com>
This commit is contained in:
parent
3e026659b0
commit
c8770955ed
50
drivers/media/video/rk_camsys/camsys_drv.c
Executable file → Normal file
50
drivers/media/video/rk_camsys/camsys_drv.c
Executable file → Normal file
|
|
@ -244,7 +244,7 @@ static int camsys_extdev_register(camsys_devio_name_t *devio, camsys_dev_t
|
|||
for (i = (CamSys_Gpio_Start_Tag+1); i < CamSys_Gpio_End_Tag; i++) {
|
||||
if (strcmp(gpio_info->name, "NC")) {
|
||||
gpio->io = camsys_gpio_get(gpio_info->name);
|
||||
if (gpio->io < 0) {
|
||||
if (!gpio_is_valid(gpio->io)) {
|
||||
camsys_err(
|
||||
"Get %s gpio for dev_id 0x%x failed!",
|
||||
gpio_info->name,
|
||||
|
|
@ -424,11 +424,12 @@ static int camsys_sysctl_external(camsys_sysctrl_t *devctl,
|
|||
continue;
|
||||
|
||||
extdev = camsys_find_extdev((1 << (i+24)), camsys_dev);
|
||||
if (extdev == NULL)
|
||||
if (!extdev) {
|
||||
camsys_err("Can not find dev_id 0x%x device in %s!",
|
||||
(1<<(i+24)),
|
||||
dev_name(camsys_dev->miscdev.this_device));
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
camsys_sysctl_extdev(
|
||||
extdev, devctl, camsys_dev);
|
||||
|
||||
|
|
@ -569,8 +570,9 @@ static int camsys_irq_connect(camsys_irqcnnt_t *irqcnnt, camsys_dev_t
|
|||
list_for_each_entry(irqpool, &camsys_dev->irq.irq_pool, list) {
|
||||
if (irqpool->pid == irqcnnt->pid) {
|
||||
camsys_warn("this thread(pid: %d) had been connect irq!",
|
||||
current->pid);
|
||||
spin_unlock(&camsys_dev->irq.lock);
|
||||
current->pid);
|
||||
spin_unlock_irqrestore(&camsys_dev->irq.lock,
|
||||
flags);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
|
@ -578,6 +580,10 @@ static int camsys_irq_connect(camsys_irqcnnt_t *irqcnnt, camsys_dev_t
|
|||
spin_unlock_irqrestore(&camsys_dev->irq.lock, flags);
|
||||
|
||||
irqpool = kzalloc(sizeof(camsys_irqpool_t), GFP_KERNEL);
|
||||
if (!irqpool) {
|
||||
err = -ENOMEM;
|
||||
goto end;
|
||||
}
|
||||
if (irqpool) {
|
||||
spin_lock_init(&irqpool->lock);
|
||||
irqpool->pid = irqcnnt->pid;
|
||||
|
|
@ -931,7 +937,7 @@ static long camsys_ioctl_compat(struct file *filp, unsigned int cmd, unsigned
|
|||
"iommu status not consistent,"
|
||||
"check the dts file !isp:%d,vpu:%d",
|
||||
iommu_enabled, vpu_iommu_enabled);
|
||||
return -EFAULT;
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1388,7 +1394,7 @@ static int camsys_platform_probe(struct platform_device *pdev)
|
|||
struct resource register_res;
|
||||
struct device *dev = &pdev->dev;
|
||||
unsigned long i2cmem;
|
||||
camsys_meminfo_t *meminfo;
|
||||
camsys_meminfo_t *meminfo, *meminfo_fail;
|
||||
unsigned int irq_id;
|
||||
const char *compatible = NULL;
|
||||
|
||||
|
|
@ -1420,9 +1426,9 @@ static int camsys_platform_probe(struct platform_device *pdev)
|
|||
|
||||
/* map irqs */
|
||||
irq_id = irq_of_parse_and_map(dev->of_node, 0);
|
||||
if (irq_id < 0) {
|
||||
if (!irq_id) {
|
||||
camsys_err("Get irq resource from %s platform device failed!",
|
||||
pdev->name);
|
||||
pdev->name);
|
||||
err = -ENODEV;
|
||||
goto fail_end;
|
||||
}
|
||||
|
|
@ -1559,25 +1565,25 @@ static int camsys_platform_probe(struct platform_device *pdev)
|
|||
request_mem_fail:
|
||||
if (camsys_dev != NULL) {
|
||||
while (!list_empty(&camsys_dev->devmems.memslist)) {
|
||||
meminfo = list_first_entry(
|
||||
meminfo_fail = list_first_entry(
|
||||
&camsys_dev->devmems.memslist,
|
||||
camsys_meminfo_t, list);
|
||||
if (!meminfo)
|
||||
if (!meminfo_fail)
|
||||
continue;
|
||||
|
||||
list_del_init(&meminfo->list);
|
||||
if (strcmp(meminfo->name,
|
||||
CAMSYS_REGISTER_MEM_NAME) == 0) {
|
||||
iounmap((void __iomem *)meminfo->vir_base);
|
||||
list_del_init(&meminfo_fail->list);
|
||||
if (strcmp(meminfo_fail->name,
|
||||
CAMSYS_REGISTER_MEM_NAME) == 0) {
|
||||
iounmap((void __iomem *)meminfo_fail->vir_base);
|
||||
release_mem_region(
|
||||
meminfo->phy_base,
|
||||
meminfo->size);
|
||||
} else if (strcmp(meminfo->name,
|
||||
meminfo_fail->phy_base,
|
||||
meminfo_fail->size);
|
||||
} else if (strcmp(meminfo_fail->name,
|
||||
CAMSYS_I2C_MEM_NAME) == 0) {
|
||||
kfree((void *)meminfo->vir_base);
|
||||
kfree((void *)meminfo_fail->vir_base);
|
||||
}
|
||||
kfree(meminfo);
|
||||
meminfo = NULL;
|
||||
kfree(meminfo_fail);
|
||||
meminfo_fail = NULL;
|
||||
}
|
||||
|
||||
kfree(camsys_dev);
|
||||
|
|
@ -1596,7 +1602,7 @@ static int camsys_platform_remove(struct platform_device *pdev)
|
|||
meminfo = list_first_entry(
|
||||
&camsys_dev->devmems.memslist,
|
||||
camsys_meminfo_t, list);
|
||||
if (meminfo)
|
||||
if (!meminfo)
|
||||
continue;
|
||||
|
||||
list_del_init(&meminfo->list);
|
||||
|
|
|
|||
|
|
@ -568,13 +568,14 @@ static int camsys_mrv_clkin_cb(void *ptr, unsigned int on)
|
|||
clk_prepare_enable(clk->pclk_dphy_ref);
|
||||
}
|
||||
|
||||
clk->in_on = true;
|
||||
clk->in_on = true;
|
||||
|
||||
camsys_trace(1, "%s clock(f: %ld Hz) in turn on",
|
||||
dev_name(camsys_dev->miscdev.this_device), isp_clk);
|
||||
camsys_mrv_reset_cb(ptr, 1);
|
||||
udelay(100);
|
||||
camsys_mrv_reset_cb(ptr, 0);
|
||||
camsys_trace(1, "%s clock(f: %ld Hz) in turn on",
|
||||
dev_name(camsys_dev->miscdev.this_device),
|
||||
isp_clk);
|
||||
camsys_mrv_reset_cb(ptr, 1);
|
||||
udelay(100);
|
||||
camsys_mrv_reset_cb(ptr, 0);
|
||||
} else if (!on && clk->in_on) {
|
||||
if (strstr(camsys_dev->miscdev.name,
|
||||
"camsys_marvin1")) {
|
||||
|
|
@ -601,11 +602,11 @@ static int camsys_mrv_clkin_cb(void *ptr, unsigned int on)
|
|||
clk_disable_unprepare(clk->pclk_dphy_ref);
|
||||
}
|
||||
|
||||
/* rockchip_clear_system_status(SYS_STATUS_ISP); */
|
||||
clk->in_on = false;
|
||||
camsys_trace(1, "%s clock in turn off",
|
||||
dev_name(camsys_dev->miscdev.this_device));
|
||||
}
|
||||
/* rockchip_clear_system_status(SYS_STATUS_ISP); */
|
||||
clk->in_on = false;
|
||||
camsys_trace(1, "%s clock in turn off",
|
||||
dev_name(camsys_dev->miscdev.this_device));
|
||||
}
|
||||
} else{
|
||||
if (on && !clk->in_on) {
|
||||
/* rockchip_set_system_status(SYS_STATUS_ISP); */
|
||||
|
|
@ -630,7 +631,7 @@ static int camsys_mrv_clkin_cb(void *ptr, unsigned int on)
|
|||
} else {
|
||||
clk_prepare_enable(clk->clk_mipi_24m);
|
||||
}
|
||||
clk->in_on = true;
|
||||
clk->in_on = true;
|
||||
|
||||
camsys_trace(1, "%s clock(f: %ld Hz) in turn on",
|
||||
dev_name(camsys_dev->miscdev.this_device), isp_clk);
|
||||
|
|
@ -1189,13 +1190,13 @@ int camsys_mrv_probe_cb(struct platform_device *pdev, camsys_dev_t *camsys_dev)
|
|||
if (!IS_ERR_OR_NULL(mrv_clk->cif_clk_out))
|
||||
clk_put(mrv_clk->cif_clk_out);
|
||||
|
||||
if (CHIP_TYPE == 3368 || CHIP_TYPE == 3366) {
|
||||
if (!IS_ERR_OR_NULL(mrv_clk->pclk_dphyrx))
|
||||
clk_put(mrv_clk->pclk_dphyrx);
|
||||
if (CHIP_TYPE == 3368 || CHIP_TYPE == 3366) {
|
||||
if (!IS_ERR_OR_NULL(mrv_clk->pclk_dphyrx))
|
||||
clk_put(mrv_clk->pclk_dphyrx);
|
||||
|
||||
if (!IS_ERR_OR_NULL(mrv_clk->clk_vio0_noc))
|
||||
clk_put(mrv_clk->clk_vio0_noc);
|
||||
}
|
||||
if (!IS_ERR_OR_NULL(mrv_clk->clk_vio0_noc))
|
||||
clk_put(mrv_clk->clk_vio0_noc);
|
||||
}
|
||||
|
||||
kfree(mrv_clk);
|
||||
mrv_clk = NULL;
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ struct ext_fsh_dev_list_s{
|
|||
|
||||
static struct ext_fsh_dev_list_s g_ext_fsh_devs;
|
||||
|
||||
int camsys_init_ext_fsh_module()
|
||||
int camsys_init_ext_fsh_module(void)
|
||||
{
|
||||
camsys_trace(1,"init external flash module");
|
||||
INIT_LIST_HEAD(&g_ext_fsh_devs.dev_list);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int camsys_deinit_ext_fsh_module()
|
||||
int camsys_deinit_ext_fsh_module(void)
|
||||
{
|
||||
ext_fsh_info_t* cur_fsh_info = NULL;
|
||||
camsys_trace(1,"deinit external flash module");
|
||||
|
|
@ -58,7 +58,7 @@ void* camsys_register_ext_fsh_dev(camsys_flash_info_t *fsh_info)
|
|||
goto fail0;
|
||||
}
|
||||
|
||||
new_rt_dev = kzalloc(sizeof(*new_rt_dev), GFP_KERNEL);
|
||||
new_rt_dev = kzalloc(sizeof(*new_rt_dev), GFP_KERNEL);
|
||||
if(!new_rt_dev){
|
||||
camsys_err("register new ext flash dev erro !");
|
||||
goto fail1;
|
||||
|
|
@ -66,7 +66,7 @@ void* camsys_register_ext_fsh_dev(camsys_flash_info_t *fsh_info)
|
|||
|
||||
new_dev->pdev.id = -1;
|
||||
new_dev->pdev.name = fsh_info->fl_drv_name;
|
||||
new_dev->pdev.dev.release = camsys_ext_fsh_release;
|
||||
new_dev->pdev.dev.release = camsys_ext_fsh_release;
|
||||
new_dev->pdev.dev.platform_data = (void*)new_rt_dev;
|
||||
new_dev->dev_model = "rt-flash-led";
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ void* camsys_register_ext_fsh_dev(camsys_flash_info_t *fsh_info)
|
|||
camsys_trace(1,"flset name :%s, gpio %d, active %d \n",fsh_info->fl.name,new_rt_dev->flset_gpio,new_rt_dev->flset_active);
|
||||
new_rt_dev->ctl_gpio = -1;
|
||||
new_rt_dev->def_lvp = RT8547_LVP_3V;
|
||||
new_rt_dev->def_tol = RT8547_TOL_100mA;
|
||||
new_rt_dev->def_tol = RT8547_TOL_100mA;
|
||||
|
||||
// new_rt_dev->def_lvp = RT8547_LVP_MAX;
|
||||
// new_rt_dev->def_tol = RT8547_TOL_MAX;
|
||||
|
|
@ -113,7 +113,7 @@ int camsys_deregister_ext_fsh_dev(void* dev)
|
|||
/* free after unregister device ?*/
|
||||
kfree(cur_fsh_info->pdev.dev.platform_data);
|
||||
kfree(cur_fsh_info);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -140,8 +140,8 @@ int camsys_ext_fsh_ctrl(void* dev,int mode,unsigned int on)
|
|||
}
|
||||
}
|
||||
if(cur_fsh_info == NULL){
|
||||
camsys_err("this flash dev have not been registered !");
|
||||
return -1;
|
||||
camsys_err("this flash dev have not been registered !");
|
||||
return -1;
|
||||
}
|
||||
|
||||
fled_dev = find_flashlight_by_name(cur_fsh_info->dev_model);
|
||||
|
|
@ -163,7 +163,7 @@ int camsys_ext_fsh_ctrl(void* dev,int mode,unsigned int on)
|
|||
/* set flashlight mode to Strobe */
|
||||
flashlight_set_mode(fled_dev, FLASHLIGHT_MODE_FLASH);
|
||||
flashlight_strobe(fled_dev);
|
||||
break;
|
||||
break;
|
||||
case 5: /* torch */
|
||||
/* set the torch brightness index 2 (75mA), refer to the datasheet for index current value. */
|
||||
flashlight_set_torch_brightness(fled_dev, 2);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user