[media] marvell-cam: Remove broken "owner" logic

The marvell cam driver retained just enough of the owner-tracking logic
from cafe_ccic to be broken; it could, conceivably, cause the driver to
release DMA memory while the controller is still active.  Simply remove the
remaining pieces and ensure that the controller is stopped before we free
things.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Jonathan Corbet 2012-03-16 19:14:51 -03:00 committed by Mauro Carvalho Chehab
parent 49df19ebcc
commit 0770d07f7b
2 changed files with 1 additions and 5 deletions

View file

@ -1564,11 +1564,8 @@ static int mcam_v4l_release(struct file *filp)
singles, delivered); singles, delivered);
mutex_lock(&cam->s_mutex); mutex_lock(&cam->s_mutex);
(cam->users)--; (cam->users)--;
if (filp == cam->owner) {
mcam_ctlr_stop_dma(cam);
cam->owner = NULL;
}
if (cam->users == 0) { if (cam->users == 0) {
mcam_ctlr_stop_dma(cam);
mcam_cleanup_vb2(cam); mcam_cleanup_vb2(cam);
mcam_ctlr_power_down(cam); mcam_ctlr_power_down(cam);
if (cam->buffer_mode == B_vmalloc && alloc_bufs_at_read) if (cam->buffer_mode == B_vmalloc && alloc_bufs_at_read)

View file

@ -107,7 +107,6 @@ struct mcam_camera {
enum mcam_state state; enum mcam_state state;
unsigned long flags; /* Buffer status, mainly (dev_lock) */ unsigned long flags; /* Buffer status, mainly (dev_lock) */
int users; /* How many open FDs */ int users; /* How many open FDs */
struct file *owner; /* Who has data access (v4l2) */
/* /*
* Subsystem structures. * Subsystem structures.