mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-09-04 20:19:47 +08:00 
			
		
		
		
	media: amphion: release m2m ctx when releasing vpu instance
release m2m ctx in the callback function that
release the vpu instance, then there is no need
to add lock around releasing m2m ctx.
Fixes: 3cd084519c ("media: amphion: add vpu v4l2 m2m support")
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
			
			
This commit is contained in:
		
							parent
							
								
									cfeacb5d46
								
							
						
					
					
						commit
						d91d7bc850
					
				| @ -603,6 +603,10 @@ static int vpu_v4l2_release(struct vpu_inst *inst) | |||||||
| 		inst->workqueue = NULL; | 		inst->workqueue = NULL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	if (inst->fh.m2m_ctx) { | ||||||
|  | 		v4l2_m2m_ctx_release(inst->fh.m2m_ctx); | ||||||
|  | 		inst->fh.m2m_ctx = NULL; | ||||||
|  | 	} | ||||||
| 	v4l2_ctrl_handler_free(&inst->ctrl_handler); | 	v4l2_ctrl_handler_free(&inst->ctrl_handler); | ||||||
| 	mutex_destroy(&inst->lock); | 	mutex_destroy(&inst->lock); | ||||||
| 	v4l2_fh_del(&inst->fh); | 	v4l2_fh_del(&inst->fh); | ||||||
| @ -685,13 +689,6 @@ int vpu_v4l2_close(struct file *file) | |||||||
| 
 | 
 | ||||||
| 	vpu_trace(vpu->dev, "tgid = %d, pid = %d, inst = %p\n", inst->tgid, inst->pid, inst); | 	vpu_trace(vpu->dev, "tgid = %d, pid = %d, inst = %p\n", inst->tgid, inst->pid, inst); | ||||||
| 
 | 
 | ||||||
| 	vpu_inst_lock(inst); |  | ||||||
| 	if (inst->fh.m2m_ctx) { |  | ||||||
| 		v4l2_m2m_ctx_release(inst->fh.m2m_ctx); |  | ||||||
| 		inst->fh.m2m_ctx = NULL; |  | ||||||
| 	} |  | ||||||
| 	vpu_inst_unlock(inst); |  | ||||||
| 
 |  | ||||||
| 	call_void_vop(inst, release); | 	call_void_vop(inst, release); | ||||||
| 	vpu_inst_unregister(inst); | 	vpu_inst_unregister(inst); | ||||||
| 	vpu_inst_put(inst); | 	vpu_inst_put(inst); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Ming Qian
						Ming Qian