diff options
author | Andy Walls <awalls@md.metrocast.net> | 2010-12-12 02:38:20 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-29 13:17:10 +0300 |
commit | 754f9969c323559a12bce1475f3c1e6574129856 (patch) | |
tree | 3345067e0920d27112b1449152d83e291fd348b3 /drivers/media/video/cx18/cx18-dvb.c | |
parent | fa98447f09641adeeaf02b94133649f03b74d159 (diff) | |
download | linux-754f9969c323559a12bce1475f3c1e6574129856.tar.xz |
[media] cx18: Only allocate a struct cx18_dvb for the DVB TS stream
The cx18_stream struct contained a struct cx18_dvb for
every stream object, most of which were for analog capture.
Now we only allocate the cx18_dvb object for the DTV TS stream.
Signed-off-by: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-dvb.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-dvb.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/media/video/cx18/cx18-dvb.c b/drivers/media/video/cx18/cx18-dvb.c index c7f0bad39ad0..f0381d62518d 100644 --- a/drivers/media/video/cx18/cx18-dvb.c +++ b/drivers/media/video/cx18/cx18-dvb.c @@ -137,7 +137,7 @@ static int yuan_mpc718_mt352_init(struct dvb_frontend *fe) { struct cx18_dvb *dvb = container_of(fe->dvb, struct cx18_dvb, dvb_adapter); - struct cx18_stream *stream = container_of(dvb, struct cx18_stream, dvb); + struct cx18_stream *stream = dvb->stream; const struct firmware *fw = NULL; int ret; int i; @@ -266,22 +266,22 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed) if (!demux->dmx.frontend) return -EINVAL; - mutex_lock(&stream->dvb.feedlock); - if (stream->dvb.feeding++ == 0) { + mutex_lock(&stream->dvb->feedlock); + if (stream->dvb->feeding++ == 0) { CX18_DEBUG_INFO("Starting Transport DMA\n"); mutex_lock(&cx->serialize_lock); set_bit(CX18_F_S_STREAMING, &stream->s_flags); ret = cx18_start_v4l2_encode_stream(stream); if (ret < 0) { CX18_DEBUG_INFO("Failed to start Transport DMA\n"); - stream->dvb.feeding--; - if (stream->dvb.feeding == 0) + stream->dvb->feeding--; + if (stream->dvb->feeding == 0) clear_bit(CX18_F_S_STREAMING, &stream->s_flags); } mutex_unlock(&cx->serialize_lock); } else ret = 0; - mutex_unlock(&stream->dvb.feedlock); + mutex_unlock(&stream->dvb->feedlock); return ret; } @@ -299,15 +299,15 @@ static int cx18_dvb_stop_feed(struct dvb_demux_feed *feed) CX18_DEBUG_INFO("Stop feed: pid = 0x%x index = %d\n", feed->pid, feed->index); - mutex_lock(&stream->dvb.feedlock); - if (--stream->dvb.feeding == 0) { + mutex_lock(&stream->dvb->feedlock); + if (--stream->dvb->feeding == 0) { CX18_DEBUG_INFO("Stopping Transport DMA\n"); mutex_lock(&cx->serialize_lock); ret = cx18_stop_v4l2_encode_stream(stream, 0); mutex_unlock(&cx->serialize_lock); } else ret = 0; - mutex_unlock(&stream->dvb.feedlock); + mutex_unlock(&stream->dvb->feedlock); } return ret; @@ -316,7 +316,7 @@ static int cx18_dvb_stop_feed(struct dvb_demux_feed *feed) int cx18_dvb_register(struct cx18_stream *stream) { struct cx18 *cx = stream->cx; - struct cx18_dvb *dvb = &stream->dvb; + struct cx18_dvb *dvb = stream->dvb; struct dvb_adapter *dvb_adapter; struct dvb_demux *dvbdemux; struct dmx_demux *dmx; @@ -325,6 +325,9 @@ int cx18_dvb_register(struct cx18_stream *stream) if (!dvb) return -EINVAL; + dvb->enabled = 0; + dvb->stream = stream; + ret = dvb_register_adapter(&dvb->dvb_adapter, CX18_DRIVER_NAME, THIS_MODULE, &cx->pci_dev->dev, adapter_nr); @@ -378,7 +381,7 @@ int cx18_dvb_register(struct cx18_stream *stream) CX18_INFO("DVB Frontend registered\n"); CX18_INFO("Registered DVB adapter%d for %s (%d x %d.%02d kB)\n", - stream->dvb.dvb_adapter.num, stream->name, + stream->dvb->dvb_adapter.num, stream->name, stream->buffers, stream->buf_size/1024, (stream->buf_size * 100 / 1024) % 100); @@ -405,13 +408,16 @@ err_out: void cx18_dvb_unregister(struct cx18_stream *stream) { struct cx18 *cx = stream->cx; - struct cx18_dvb *dvb = &stream->dvb; + struct cx18_dvb *dvb = stream->dvb; struct dvb_adapter *dvb_adapter; struct dvb_demux *dvbdemux; struct dmx_demux *dmx; CX18_INFO("unregister DVB\n"); + if (dvb == NULL || !dvb->enabled) + return; + dvb_adapter = &dvb->dvb_adapter; dvbdemux = &dvb->demux; dmx = &dvbdemux->dmx; @@ -432,7 +438,7 @@ void cx18_dvb_unregister(struct cx18_stream *stream) */ static int dvb_register(struct cx18_stream *stream) { - struct cx18_dvb *dvb = &stream->dvb; + struct cx18_dvb *dvb = stream->dvb; struct cx18 *cx = stream->cx; int ret = 0; |