diff --git a/drivers/media/video/rk_camsys/camsys_drv.c b/drivers/media/video/rk_camsys/camsys_drv.c index cd04f06895cd..393b83ad925c 100644 --- a/drivers/media/video/rk_camsys/camsys_drv.c +++ b/drivers/media/video/rk_camsys/camsys_drv.c @@ -643,7 +643,7 @@ static int camsys_irq_wait(camsys_irqsta_t *irqsta, camsys_dev_t *camsys_dev) spin_lock_irqsave(&camsys_dev->irq.lock, flags); if (!list_empty(&camsys_dev->irq.irq_pool)) { list_for_each_entry(irqpool, &camsys_dev->irq.irq_pool, list) { - if (irqpool->pid == current->pid) { + if (irqpool->pid == irqsta->pid) { find_pool = true; break; } @@ -654,7 +654,7 @@ static int camsys_irq_wait(camsys_irqsta_t *irqsta, camsys_dev_t *camsys_dev) if (find_pool == false) { camsys_err( "this thread(pid: %d) hasn't been connect irq, so wait irq failed!", - current->pid); + irqsta->pid); err = -EINVAL; goto end; } @@ -674,7 +674,7 @@ static int camsys_irq_wait(camsys_irqsta_t *irqsta, camsys_dev_t *camsys_dev) active_list_isnot_empty(irqpool), usecs_to_jiffies(irqpool->timeout)); - if (irqpool->pid == current->pid) { + if (irqpool->pid == irqsta->pid) { if (active_list_isnot_empty(irqpool)) { spin_lock_irqsave(&irqpool->lock, flags); irqstas = list_first_entry( @@ -692,7 +692,7 @@ static int camsys_irq_wait(camsys_irqsta_t *irqsta, camsys_dev_t *camsys_dev) } else { camsys_warn( "Thread(pid: %d) has been disconnect!", - current->pid); + irqsta->pid); err = -EAGAIN; } } @@ -700,7 +700,7 @@ static int camsys_irq_wait(camsys_irqsta_t *irqsta, camsys_dev_t *camsys_dev) if (err == 0) { camsys_trace(3, "Thread(pid: %d) has been wake up for irq(mis: 0x%x ris:0x%x)!", - current->pid, irqsta->mis, irqsta->ris); + irqsta->pid, irqsta->mis, irqsta->ris); } end: @@ -1052,7 +1052,9 @@ static long camsys_ioctl_compat(struct file *filp, unsigned int cmd, unsigned case CAMSYS_IRQWAIT: { camsys_irqsta_t irqsta; - + if (copy_from_user((void *)&irqsta, (void __user *)arg, + sizeof(camsys_irqsta_t))) + return -EFAULT; err = camsys_irq_wait(&irqsta, camsys_dev); if (err == 0) { if (copy_to_user((void __user *)arg, (void *)&irqsta, @@ -1263,7 +1265,9 @@ static long camsys_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) case CAMSYS_IRQWAIT: { camsys_irqsta_t irqsta; - + if (copy_from_user((void *)&irqsta, (void __user *)arg, + sizeof(camsys_irqsta_t))) + return -EFAULT; err = camsys_irq_wait(&irqsta, camsys_dev); if (err == 0) { if (copy_to_user((void __user *)arg, (void *)&irqsta, diff --git a/drivers/media/video/rk_camsys/camsys_internal.h b/drivers/media/video/rk_camsys/camsys_internal.h index 8a8209f00af2..7073f9de9a90 100644 --- a/drivers/media/video/rk_camsys/camsys_internal.h +++ b/drivers/media/video/rk_camsys/camsys_internal.h @@ -185,9 +185,11 @@ fs_id and fe_id into isp library. *v0.0x22.8: 1) 3399 power management is wrong, correct it. +*v0.0x23.0: + 1) replace current->pid with irqsta->pid. */ -#define CAMSYS_DRIVER_VERSION KERNEL_VERSION(0, 0x22, 8) +#define CAMSYS_DRIVER_VERSION KERNEL_VERSION(0, 0x23, 0) #define CAMSYS_PLATFORM_DRV_NAME "RockChip-CamSys" #define CAMSYS_PLATFORM_MARVIN_NAME "Platform_MarvinDev" diff --git a/include/media/camsys_head.h b/include/media/camsys_head.h index 71024f667b01..cc038756ce8e 100644 --- a/include/media/camsys_head.h +++ b/include/media/camsys_head.h @@ -35,8 +35,11 @@ 1) powerup sequence type moved to common_head.h. *v0.e.0: 1) add fs_id, fe_id and some reserved bytes in struct camsys_irqsta_s. +*v0.f.0: + 1) add pid in struct camsys_irqsta_s. */ -#define CAMSYS_HEAD_VERSION KERNEL_VERSION(0, 0xe, 0) + +#define CAMSYS_HEAD_VERSION KERNEL_VERSION(0, 0xf, 0) #define CAMSYS_MARVIN_DEVNAME "camsys_marvin" #define CAMSYS_CIF0_DEVNAME "camsys_cif0" @@ -64,7 +67,8 @@ typedef struct camsys_irqsta_s { unsigned int mis; //Masked interrupt status unsigned int fs_id; // frame number from Frame Start (FS) short packet unsigned int fe_id; // frame number from Frame End (FE) short packet - unsigned int reserved[4]; + int pid; + unsigned int reserved[3]; } camsys_irqsta_t; typedef struct camsys_irqcnnt_s {