/** * prev2resz_release - Releases device resources */ static int prev2resz_release(struct inode *inode, struct file *fp) { struct prev2resz_fhdl *fh = fp->private_data; u32 timeout = 0; while ((p2r_ctx.status.prv_busy != PREV2RESZ_FREE || p2r_ctx.status.rsz_busy != PREV2RESZ_FREE) && (timeout < 20)) { timeout++; schedule(); } p2r_ctx.status.prv_busy = PREV2RESZ_FREE; p2r_ctx.status.rsz_busy = PREV2RESZ_FREE; p2r_ctx.opened--; /* This will Free memory allocated to the buffers, * and flushes the queue */ if (&fh->src_vbq) videobuf_queue_cancel(&fh->src_vbq); if (&fh->dst_vbq) videobuf_queue_cancel(&fh->dst_vbq); fp->private_data = NULL; isp_stop(fh->isp); kfree(fh); isp_put(); return 0; }
/** * ispdss_put_resource - Release all the resource. **/ void ispdss_put_resource() { struct isp_device *isp_res = dev_get_drvdata(dev_ctx.isp); int i = 0; if (dev_ctx.opened != 1) return; /* unmap output buffers if allocated */ for (i = 0; i < dev_ctx.num_video_buffers; ++i) { if (dev_ctx.out_buf_virt_addr[i]) { iommu_kunmap(isp_res->iommu, dev_ctx.out_buf_virt_addr[i]); dev_ctx.out_buf_virt_addr[i] = 0; } if (dev_ctx.in_buf_virt_addr[i]) { iommu_kunmap(isp_res->iommu, dev_ctx.in_buf_virt_addr[i]); dev_ctx.in_buf_virt_addr[i] = 0; } } ispdss_tmp_buf_free(); /* make device available */ dev_ctx.opened = 0; /* stop the isp */ isp_stop(dev_ctx.isp); /* release isp resource*/ isp_put(); return ; }