diff options
author | Mike Isely <isely@pobox.com> | 2006-12-27 20:33:00 -0600 |
---|---|---|
committer | Mike Isely <isely@pobox.com> | 2006-12-27 20:33:00 -0600 |
commit | b8041f5d66d235099f174668003ef0e99aa499f1 (patch) | |
tree | 9ceadec81fe86e4d6bdafb66128b5bfbe4c87915 /linux | |
parent | 0d7a4a46dba7d2aad9ee2658ebe6411ecdc0a073 (diff) | |
download | mediapointer-dvb-s2-b8041f5d66d235099f174668003ef0e99aa499f1.tar.gz mediapointer-dvb-s2-b8041f5d66d235099f174668003ef0e99aa499f1.tar.bz2 |
pvrusb2: Remove stream claiming hack from /dev/radio implementation
From: Mike Isely <isely@pobox.com>
Trying to temporarily check that the stream is not claimed during open
of the radio device is at best a race condition. What's to stop
another app from claiming the stream anyway the instant after the
check is done? The implementation for this was dicey anyway. So it's
removed. The only "price" for this is that if /dev/radioX is opened
while streaming video, then the video stream is just going to switch
to radio mode anyway. If a user does this, he gets what he expects...
Signed-off-by: Mike Isely <isely@pobox.com>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/video/pvrusb2/pvrusb2-context.c | 11 | ||||
-rw-r--r-- | linux/drivers/media/video/pvrusb2/pvrusb2-context.h | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 27 |
3 files changed, 6 insertions, 34 deletions
diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-context.c b/linux/drivers/media/video/pvrusb2/pvrusb2-context.c index 6ad1ce7dc..19787dc81 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-context.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-context.c @@ -205,17 +205,6 @@ void pvr2_channel_done(struct pvr2_channel *cp) } -int pvr2_channel_check_stream_no_lock(struct pvr2_channel *cp, - struct pvr2_context_stream *sp) -{ - if (sp == cp->stream) return 0; - if (sp->user) { - return -EBUSY; - } - return 0; -} - - int pvr2_channel_claim_stream(struct pvr2_channel *cp, struct pvr2_context_stream *sp) { diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-context.h b/linux/drivers/media/video/pvrusb2/pvrusb2-context.h index 5e960ae51..69c1f3a92 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-context.h +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-context.h @@ -85,8 +85,6 @@ void pvr2_channel_init(struct pvr2_channel *,struct pvr2_context *); void pvr2_channel_done(struct pvr2_channel *); int pvr2_channel_claim_stream(struct pvr2_channel *, struct pvr2_context_stream *); -int pvr2_channel_check_stream_no_lock(struct pvr2_channel *, - struct pvr2_context_stream *); struct pvr2_ioread *pvr2_channel_create_mpeg_stream( struct pvr2_context_stream *); diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index eaf2a35ec..3bf4e014a 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -941,29 +941,14 @@ static int pvr2_v4l2_open(struct inode *inode, struct file *file) pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr_v4l2_fh id=%p",fhp); pvr2_channel_init(&fhp->channel,vp->channel.mc_head); - /* pk: warning, severe ugliness follows. 18+ only. - please blaim V4L(ivtv) for braindamaged interfaces, - not the implementor. This is probably flawed, but - suggestions on how to do this "right" are welcome! */ + /* Opening the /dev/radioX device implies a mode switch. + So execute that here. Note that you can get the + IDENTICAL effect merely by opening the normal video + device and setting the input appropriately. */ if (dip->config == pvr2_config_radio) { - int ret; - if ((pvr2_channel_check_stream_no_lock(&fhp->channel, - fhp->dev_info->stream)) != 0) { - /* We can 't switch modes while streaming */ - pvr2_channel_done(&fhp->channel); - kfree(fhp); - pvr2_context_exit(vp->channel.mc_head); - return -EBUSY; - } - - if ((ret = pvr2_ctrl_set_value( + pvr2_ctrl_set_value( pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_INPUT), - PVR2_CVAL_INPUT_RADIO))) { - pvr2_channel_done(&fhp->channel); - kfree(fhp); - pvr2_context_exit(vp->channel.mc_head); - return ret; - } + PVR2_CVAL_INPUT_RADIO); } fhp->vnext = NULL; |