Commit 4edcf22b authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] dvb_usb_v2: git rid of dvb_usb_adapter state variable

We can live without it easily.

Also USB data stream complete callback checks for feedcount
seems to be quite redundant so remove those also.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 5da2aecb
...@@ -297,9 +297,6 @@ struct usb_data_stream { ...@@ -297,9 +297,6 @@ struct usb_data_stream {
* @stream: the usb data stream. * @stream: the usb data stream.
*/ */
struct dvb_usb_adapter { struct dvb_usb_adapter {
#define DVB_USB_ADAP_STATE_INIT 0x000
#define DVB_USB_ADAP_STATE_DVB 0x001
int state;
struct dvb_usb_device *dev; struct dvb_usb_device *dev;
const struct dvb_usb_adapter_properties *props; const struct dvb_usb_adapter_properties *props;
struct usb_data_stream stream; struct usb_data_stream stream;
......
...@@ -8,28 +8,25 @@ ...@@ -8,28 +8,25 @@
*/ */
#include "dvb_usb_common.h" #include "dvb_usb_common.h"
static void dvb_usb_data_complete(struct usb_data_stream *stream, u8 *buffer, static void dvb_usb_data_complete(struct usb_data_stream *stream, u8 *buf,
size_t length) size_t len)
{ {
struct dvb_usb_adapter *adap = stream->user_priv; struct dvb_usb_adapter *adap = stream->user_priv;
if (adap->feedcount > 0 && adap->state & DVB_USB_ADAP_STATE_DVB) dvb_dmx_swfilter(&adap->demux, buf, len);
dvb_dmx_swfilter(&adap->demux, buffer, length);
} }
static void dvb_usb_data_complete_204(struct usb_data_stream *stream, static void dvb_usb_data_complete_204(struct usb_data_stream *stream, u8 *buf,
u8 *buffer, size_t length) size_t len)
{ {
struct dvb_usb_adapter *adap = stream->user_priv; struct dvb_usb_adapter *adap = stream->user_priv;
if (adap->feedcount > 0 && adap->state & DVB_USB_ADAP_STATE_DVB) dvb_dmx_swfilter_204(&adap->demux, buf, len);
dvb_dmx_swfilter_204(&adap->demux, buffer, length);
} }
static void dvb_usb_data_complete_raw(struct usb_data_stream *stream, static void dvb_usb_data_complete_raw(struct usb_data_stream *stream, u8 *buf,
u8 *buffer, size_t length) size_t len)
{ {
struct dvb_usb_adapter *adap = stream->user_priv; struct dvb_usb_adapter *adap = stream->user_priv;
if (adap->feedcount > 0 && adap->state & DVB_USB_ADAP_STATE_DVB) dvb_dmx_swfilter_raw(&adap->demux, buf, len);
dvb_dmx_swfilter_raw(&adap->demux, buffer, length);
} }
int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap) int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap)
...@@ -244,9 +241,8 @@ int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap) ...@@ -244,9 +241,8 @@ int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
} }
mutex_init(&adap->sync_mutex); mutex_init(&adap->sync_mutex);
adap->state |= DVB_USB_ADAP_STATE_DVB;
return 0;
return 0;
err_net_init: err_net_init:
dvb_dmxdev_release(&adap->dmxdev); dvb_dmxdev_release(&adap->dmxdev);
err_dmx_dev: err_dmx_dev:
...@@ -254,6 +250,7 @@ int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap) ...@@ -254,6 +250,7 @@ int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
err_dmx: err_dmx:
dvb_unregister_adapter(&adap->dvb_adap); dvb_unregister_adapter(&adap->dvb_adap);
err: err:
adap->dvb_adap.priv = NULL;
return ret; return ret;
} }
...@@ -261,15 +258,14 @@ int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap) ...@@ -261,15 +258,14 @@ int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap)
{ {
pr_debug("%s: adap=%d\n", __func__, adap->id); pr_debug("%s: adap=%d\n", __func__, adap->id);
if (adap->state & DVB_USB_ADAP_STATE_DVB) { if (adap->dvb_adap.priv) {
pr_debug("%s: unregistering DVB part\n", __func__);
dvb_net_release(&adap->dvb_net); dvb_net_release(&adap->dvb_net);
adap->demux.dmx.close(&adap->demux.dmx); adap->demux.dmx.close(&adap->demux.dmx);
dvb_dmxdev_release(&adap->dmxdev); dvb_dmxdev_release(&adap->dmxdev);
dvb_dmx_release(&adap->demux); dvb_dmx_release(&adap->demux);
dvb_unregister_adapter(&adap->dvb_adap); dvb_unregister_adapter(&adap->dvb_adap);
adap->state &= ~DVB_USB_ADAP_STATE_DVB;
} }
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