|
@@ -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;
|
|
|
|