*camsys_dev)
{
int err = 0, i;
- camsys_irqpool_t *irqpool;
+ bool find_pool = false;
+ camsys_irqpool_t *irqpool, *n;
unsigned long int flags;
if ((irqcnnt->mis != MRV_ISP_MIS) &&
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 == irqcnnt->pid) {
- camsys_warn("this thread(pid: %d) had been connect irq!",
- current->pid);
- spin_unlock_irqrestore(&camsys_dev->irq.lock,
- flags);
- goto end;
+ list_for_each_entry_safe(irqpool, n,
+ &camsys_dev->irq.irq_pool, list) {
+ if (irqpool->pid == -1) {
+ list_del_init(&irqpool->list);
+ kfree(irqpool);
+ irqpool = NULL;
+ } else {
+ if (irqpool->pid == irqcnnt->pid)
+ find_pool = true;
}
}
}
spin_unlock_irqrestore(&camsys_dev->irq.lock, flags);
+ if (find_pool) {
+ camsys_warn("this thread(pid: %d) had been connect irq!",
+ irqcnnt->pid);
+ goto end;
+ }
+
irqpool = kzalloc(sizeof(camsys_irqpool_t), GFP_KERNEL);
if (!irqpool) {
err = -ENOMEM;
list_for_each_entry(irqpool, &camsys_dev->irq.irq_pool, list) {
if (irqpool->pid == irqcnnt->pid) {
find_pool = true;
- irqpool->pid = 0;
+ irqpool->pid = -1;
break;
}
}
camsys_err(
"this thread(pid: %d) have not been connect irq!"
"disconnect failed",
- current->pid);
+ irqcnnt->pid);
} else {
wake_up_all(&irqpool->done);
}
2) add csi-phy timing setting for 3368.
*v0.0x21.0xf:
1) add reference count for marvin.
+*v0.0x22.0:
+ 1) delete node in irqpool list when thread disconnect.
*/
-#define CAMSYS_DRIVER_VERSION KERNEL_VERSION(0, 0x21, 0xf)
+#define CAMSYS_DRIVER_VERSION KERNEL_VERSION(0, 0x22, 0)
#define CAMSYS_PLATFORM_DRV_NAME "RockChip-CamSys"
#define CAMSYS_PLATFORM_MARVIN_NAME "Platform_MarvinDev"
attach = camsys_dev->dma_buf[index].attach;
dma_buf = camsys_dev->dma_buf[index].dma_buf;
sgt = camsys_dev->dma_buf[index].sgt;
+ camsys_trace
+ (
+ 2,
+ "exist mapped buf, release it before map: attach %p,"
+ "dma_buf %p,sgt %p,fd %d,index %d",
+ attach,
+ dma_buf,
+ sgt,
+ iommu->map_fd,
+ index);
dma_buf_unmap_attachment
(attach,
sgt,
}
if (index == camsys_dev->dma_buf_cnt) {
camsys_warn("can't find map fd %d", iommu->map_fd);
- return 0;
+ return -EINVAL;
}
attach = camsys_dev->dma_buf[index].attach;
dma_buf = camsys_dev->dma_buf[index].dma_buf;