diff options
Diffstat (limited to 'drivers/media/video/cx18/cx18-dvb.c')
| -rw-r--r-- | drivers/media/video/cx18/cx18-dvb.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/media/video/cx18/cx18-dvb.c b/drivers/media/video/cx18/cx18-dvb.c index 71ad2d1b4c2c..0ae2c2e1eab5 100644 --- a/drivers/media/video/cx18/cx18-dvb.c +++ b/drivers/media/video/cx18/cx18-dvb.c | |||
| @@ -213,10 +213,14 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed) | |||
| 213 | { | 213 | { |
| 214 | struct dvb_demux *demux = feed->demux; | 214 | struct dvb_demux *demux = feed->demux; |
| 215 | struct cx18_stream *stream = (struct cx18_stream *) demux->priv; | 215 | struct cx18_stream *stream = (struct cx18_stream *) demux->priv; |
| 216 | struct cx18 *cx = stream->cx; | 216 | struct cx18 *cx; |
| 217 | int ret; | 217 | int ret; |
| 218 | u32 v; | 218 | u32 v; |
| 219 | 219 | ||
| 220 | if (!stream) | ||
| 221 | return -EINVAL; | ||
| 222 | |||
| 223 | cx = stream->cx; | ||
| 220 | CX18_DEBUG_INFO("Start feed: pid = 0x%x index = %d\n", | 224 | CX18_DEBUG_INFO("Start feed: pid = 0x%x index = %d\n", |
| 221 | feed->pid, feed->index); | 225 | feed->pid, feed->index); |
| 222 | 226 | ||
| @@ -253,12 +257,10 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed) | |||
| 253 | if (!demux->dmx.frontend) | 257 | if (!demux->dmx.frontend) |
| 254 | return -EINVAL; | 258 | return -EINVAL; |
| 255 | 259 | ||
| 256 | if (!stream) | ||
| 257 | return -EINVAL; | ||
| 258 | |||
| 259 | mutex_lock(&stream->dvb.feedlock); | 260 | mutex_lock(&stream->dvb.feedlock); |
| 260 | if (stream->dvb.feeding++ == 0) { | 261 | if (stream->dvb.feeding++ == 0) { |
| 261 | CX18_DEBUG_INFO("Starting Transport DMA\n"); | 262 | CX18_DEBUG_INFO("Starting Transport DMA\n"); |
| 263 | mutex_lock(&cx->serialize_lock); | ||
| 262 | set_bit(CX18_F_S_STREAMING, &stream->s_flags); | 264 | set_bit(CX18_F_S_STREAMING, &stream->s_flags); |
| 263 | ret = cx18_start_v4l2_encode_stream(stream); | 265 | ret = cx18_start_v4l2_encode_stream(stream); |
| 264 | if (ret < 0) { | 266 | if (ret < 0) { |
| @@ -267,6 +269,7 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed) | |||
| 267 | if (stream->dvb.feeding == 0) | 269 | if (stream->dvb.feeding == 0) |
| 268 | clear_bit(CX18_F_S_STREAMING, &stream->s_flags); | 270 | clear_bit(CX18_F_S_STREAMING, &stream->s_flags); |
| 269 | } | 271 | } |
| 272 | mutex_unlock(&cx->serialize_lock); | ||
| 270 | } else | 273 | } else |
| 271 | ret = 0; | 274 | ret = 0; |
| 272 | mutex_unlock(&stream->dvb.feedlock); | 275 | mutex_unlock(&stream->dvb.feedlock); |
| @@ -279,17 +282,20 @@ static int cx18_dvb_stop_feed(struct dvb_demux_feed *feed) | |||
| 279 | { | 282 | { |
| 280 | struct dvb_demux *demux = feed->demux; | 283 | struct dvb_demux *demux = feed->demux; |
| 281 | struct cx18_stream *stream = (struct cx18_stream *)demux->priv; | 284 | struct cx18_stream *stream = (struct cx18_stream *)demux->priv; |
| 282 | struct cx18 *cx = stream->cx; | 285 | struct cx18 *cx; |
| 283 | int ret = -EINVAL; | 286 | int ret = -EINVAL; |
| 284 | 287 | ||
| 285 | CX18_DEBUG_INFO("Stop feed: pid = 0x%x index = %d\n", | ||
| 286 | feed->pid, feed->index); | ||
| 287 | |||
| 288 | if (stream) { | 288 | if (stream) { |
| 289 | cx = stream->cx; | ||
| 290 | CX18_DEBUG_INFO("Stop feed: pid = 0x%x index = %d\n", | ||
| 291 | feed->pid, feed->index); | ||
| 292 | |||
| 289 | mutex_lock(&stream->dvb.feedlock); | 293 | mutex_lock(&stream->dvb.feedlock); |
| 290 | if (--stream->dvb.feeding == 0) { | 294 | if (--stream->dvb.feeding == 0) { |
| 291 | CX18_DEBUG_INFO("Stopping Transport DMA\n"); | 295 | CX18_DEBUG_INFO("Stopping Transport DMA\n"); |
| 296 | mutex_lock(&cx->serialize_lock); | ||
| 292 | ret = cx18_stop_v4l2_encode_stream(stream, 0); | 297 | ret = cx18_stop_v4l2_encode_stream(stream, 0); |
| 298 | mutex_unlock(&cx->serialize_lock); | ||
| 293 | } else | 299 | } else |
| 294 | ret = 0; | 300 | ret = 0; |
| 295 | mutex_unlock(&stream->dvb.feedlock); | 301 | mutex_unlock(&stream->dvb.feedlock); |
