@@ -663,9 +663,13 @@ static int msm_fd_s_fmt_vid_out(struct file *file,
663663static int msm_fd_reqbufs (struct file * file ,
664664 void * fh , struct v4l2_requestbuffers * req )
665665{
666+ int ret ;
666667 struct fd_ctx * ctx = msm_fd_ctx_from_fh (fh );
667668
668- return vb2_reqbufs (& ctx -> vb2_q , req );
669+ mutex_lock (& ctx -> fd_device -> recovery_lock );
670+ ret = vb2_reqbufs (& ctx -> vb2_q , req );
671+ mutex_unlock (& ctx -> fd_device -> recovery_lock );
672+ return ret ;
669673}
670674
671675/*
@@ -677,9 +681,14 @@ static int msm_fd_reqbufs(struct file *file,
677681static int msm_fd_qbuf (struct file * file , void * fh ,
678682 struct v4l2_buffer * pb )
679683{
684+ int ret ;
680685 struct fd_ctx * ctx = msm_fd_ctx_from_fh (fh );
681686
682- return vb2_qbuf (& ctx -> vb2_q , pb );
687+ mutex_lock (& ctx -> fd_device -> recovery_lock );
688+ ret = vb2_qbuf (& ctx -> vb2_q , pb );
689+ mutex_unlock (& ctx -> fd_device -> recovery_lock );
690+ return ret ;
691+
683692}
684693
685694/*
@@ -691,9 +700,13 @@ static int msm_fd_qbuf(struct file *file, void *fh,
691700static int msm_fd_dqbuf (struct file * file ,
692701 void * fh , struct v4l2_buffer * pb )
693702{
703+ int ret ;
694704 struct fd_ctx * ctx = msm_fd_ctx_from_fh (fh );
695705
696- return vb2_dqbuf (& ctx -> vb2_q , pb , file -> f_flags & O_NONBLOCK );
706+ mutex_lock (& ctx -> fd_device -> recovery_lock );
707+ ret = vb2_dqbuf (& ctx -> vb2_q , pb , file -> f_flags & O_NONBLOCK );
708+ mutex_unlock (& ctx -> fd_device -> recovery_lock );
709+ return ret ;
697710}
698711
699712/*
@@ -1198,6 +1211,7 @@ static int fd_probe(struct platform_device *pdev)
11981211
11991212 mutex_init (& fd -> lock );
12001213 spin_lock_init (& fd -> slock );
1214+ mutex_init (& fd -> recovery_lock );
12011215 init_completion (& fd -> hw_halt_completion );
12021216 INIT_LIST_HEAD (& fd -> buf_queue );
12031217 fd -> dev = & pdev -> dev ;
0 commit comments