Commit 4d68e700 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] cx18: remove exclusive open of radio device

For some reason the cx18 driver could open the radio device only once.
Remove this limitation.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarAndy Walls <awalls@md.metrocast.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 3f3edd7c
...@@ -751,20 +751,10 @@ int cx18_v4l2_close(struct file *filp) ...@@ -751,20 +751,10 @@ int cx18_v4l2_close(struct file *filp)
CX18_DEBUG_IOCTL("close() of %s\n", s->name); CX18_DEBUG_IOCTL("close() of %s\n", s->name);
v4l2_fh_del(fh);
v4l2_fh_exit(fh);
/* Easy case first: this stream was never claimed by us */
if (s->id != id->open_id) {
kfree(id);
return 0;
}
/* 'Unclaim' this stream */
/* Stop radio */
mutex_lock(&cx->serialize_lock); mutex_lock(&cx->serialize_lock);
if (id->type == CX18_ENC_STREAM_TYPE_RAD) { /* Stop radio */
if (id->type == CX18_ENC_STREAM_TYPE_RAD &&
v4l2_fh_is_singular_file(filp)) {
/* Closing radio device, return to TV mode */ /* Closing radio device, return to TV mode */
cx18_mute(cx); cx18_mute(cx);
/* Mark that the radio is no longer in use */ /* Mark that the radio is no longer in use */
...@@ -781,10 +771,14 @@ int cx18_v4l2_close(struct file *filp) ...@@ -781,10 +771,14 @@ int cx18_v4l2_close(struct file *filp)
} }
/* Done! Unmute and continue. */ /* Done! Unmute and continue. */
cx18_unmute(cx); cx18_unmute(cx);
cx18_release_stream(s);
} else {
cx18_stop_capture(id, 0);
} }
v4l2_fh_del(fh);
v4l2_fh_exit(fh);
/* 'Unclaim' this stream */
if (s->id == id->open_id)
cx18_stop_capture(id, 0);
kfree(id); kfree(id);
mutex_unlock(&cx->serialize_lock); mutex_unlock(&cx->serialize_lock);
return 0; return 0;
...@@ -810,21 +804,15 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp) ...@@ -810,21 +804,15 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp)
item->open_id = cx->open_id++; item->open_id = cx->open_id++;
filp->private_data = &item->fh; filp->private_data = &item->fh;
v4l2_fh_add(&item->fh);
if (item->type == CX18_ENC_STREAM_TYPE_RAD) { if (item->type == CX18_ENC_STREAM_TYPE_RAD &&
/* Try to claim this stream */ v4l2_fh_is_singular_file(filp)) {
if (cx18_claim_stream(item, item->type)) {
/* No, it's already in use */
v4l2_fh_exit(&item->fh);
kfree(item);
return -EBUSY;
}
if (!test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) { if (!test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) {
if (atomic_read(&cx->ana_capturing) > 0) { if (atomic_read(&cx->ana_capturing) > 0) {
/* switching to radio while capture is /* switching to radio while capture is
in progress is not polite */ in progress is not polite */
cx18_release_stream(s); v4l2_fh_del(&item->fh);
v4l2_fh_exit(&item->fh); v4l2_fh_exit(&item->fh);
kfree(item); kfree(item);
return -EBUSY; return -EBUSY;
...@@ -842,7 +830,6 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp) ...@@ -842,7 +830,6 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp)
/* Done! Unmute and continue. */ /* Done! Unmute and continue. */
cx18_unmute(cx); cx18_unmute(cx);
} }
v4l2_fh_add(&item->fh);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment