aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/tm6000/tm6000-video.c
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@avionic-design.de>2011-08-04 04:14:13 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-08-31 17:21:23 -0300
commitdd0c8abf2ac853dad9a360f5e9d3d1cb5e5f7621 (patch)
tree616d21ad6e4b85e9692f3875dc8144711f94687b /drivers/staging/tm6000/tm6000-video.c
parent88e834a841bde22b4c0aa71809e02c118c5b219d (diff)
[media] tm6000: Execute lightweight reset on close
When the last user closes the device, perform a lightweight reset of the device to bring it into a well-known state. Note that this is not always enough with the TM6010, which sometimes needs a hard reset to get into a working state again. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/staging/tm6000/tm6000-video.c')
-rw-r--r--drivers/staging/tm6000/tm6000-video.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c
index 873c8ee8b3b..df8e25301d2 100644
--- a/drivers/staging/tm6000/tm6000-video.c
+++ b/drivers/staging/tm6000/tm6000-video.c
@@ -1603,9 +1603,16 @@ static int tm6000_release(struct file *file)
dev->users--;
res_free(dev, fh);
+
if (!dev->users) {
+ int err;
+
tm6000_uninit_isoc(dev);
videobuf_mmap_free(&fh->vb_vidq);
+
+ err = tm6000_reset(dev);
+ if (err < 0)
+ dev_err(&vdev->dev, "reset failed: %d\n", err);
}
kfree(fh);