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

[media] dvb_usb_v2: move 3 callbacks from the frontend to adapter

Move .frontend_attach(), .tuner_attach() and .streaming_ctrl()
from the frontend to adapter.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e46c5b66
...@@ -114,11 +114,6 @@ struct usb_data_stream_properties { ...@@ -114,11 +114,6 @@ struct usb_data_stream_properties {
* @stream: configuration of the USB streaming * @stream: configuration of the USB streaming
*/ */
struct dvb_usb_adapter_fe_properties { struct dvb_usb_adapter_fe_properties {
int (*streaming_ctrl) (struct dvb_usb_adapter *, int);
int (*frontend_attach) (struct dvb_usb_adapter *);
int (*tuner_attach) (struct dvb_usb_adapter *);
int size_of_priv; int size_of_priv;
}; };
...@@ -136,9 +131,12 @@ struct dvb_usb_adapter_properties { ...@@ -136,9 +131,12 @@ struct dvb_usb_adapter_properties {
int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int); int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int);
int (*pid_filter) (struct dvb_usb_adapter *, int, u16, int); int (*pid_filter) (struct dvb_usb_adapter *, int, u16, int);
int (*frontend_ctrl) (struct dvb_frontend *, int); int (*frontend_attach) (struct dvb_usb_adapter *);
int (*tuner_attach) (struct dvb_usb_adapter *);
int (*frontend_ctrl) (struct dvb_frontend *, int);
int (*streaming_ctrl) (struct dvb_usb_adapter *, int);
int (*fe_ioctl_override) (struct dvb_frontend *, int (*fe_ioctl_override) (struct dvb_frontend *,
unsigned int, void *, unsigned int); unsigned int, void *, unsigned int);
int num_frontends; int num_frontends;
struct dvb_usb_adapter_fe_properties fe[MAX_NO_OF_FE_PER_ADAP]; struct dvb_usb_adapter_fe_properties fe[MAX_NO_OF_FE_PER_ADAP];
......
...@@ -83,9 +83,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) ...@@ -83,9 +83,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
deb_ts("stop feeding\n"); deb_ts("stop feeding\n");
usb_urb_kill(&adap->stream); usb_urb_kill(&adap->stream);
if (adap->props.fe[adap->active_fe].streaming_ctrl != NULL) { if (adap->props.streaming_ctrl != NULL) {
ret = adap->props.fe[adap->active_fe].streaming_ctrl( ret = adap->props.streaming_ctrl(adap, 0);
adap, 0);
if (ret < 0) { if (ret < 0) {
err("error while stopping stream."); err("error while stopping stream.");
return ret; return ret;
...@@ -159,9 +158,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) ...@@ -159,9 +158,8 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
} }
} }
deb_ts("start feeding\n"); deb_ts("start feeding\n");
if (adap->props.fe[adap->active_fe].streaming_ctrl != NULL) { if (adap->props.streaming_ctrl != NULL) {
ret = adap->props.fe[adap->active_fe].streaming_ctrl( ret = adap->props.streaming_ctrl(adap, 1);
adap, 1);
if (ret < 0) { if (ret < 0) {
err("error while enabling fifo."); err("error while enabling fifo.");
return ret; return ret;
...@@ -319,7 +317,7 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap) ...@@ -319,7 +317,7 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap)
/* register all given adapter frontends */ /* register all given adapter frontends */
for (i = 0; i < adap->props.num_frontends; i++) { for (i = 0; i < adap->props.num_frontends; i++) {
if (adap->props.fe[i].frontend_attach == NULL) { if (adap->props.frontend_attach == NULL) {
err("strange: '%s' #%d,%d " \ err("strange: '%s' #%d,%d " \
"doesn't want to attach a frontend.", "doesn't want to attach a frontend.",
adap->dev->name, adap->id, i); adap->dev->name, adap->id, i);
...@@ -327,7 +325,7 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap) ...@@ -327,7 +325,7 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap)
return 0; return 0;
} }
ret = adap->props.fe[i].frontend_attach(adap); ret = adap->props.frontend_attach(adap);
if (ret || adap->fe_adap[i].fe == NULL) { if (ret || adap->fe_adap[i].fe == NULL) {
/* only print error when there is no FE at all */ /* only print error when there is no FE at all */
if (i == 0) if (i == 0)
...@@ -359,8 +357,8 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap) ...@@ -359,8 +357,8 @@ int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap)
} }
/* only attach the tuner if the demod is there */ /* only attach the tuner if the demod is there */
if (adap->props.fe[i].tuner_attach != NULL) if (adap->props.tuner_attach != NULL)
adap->props.fe[i].tuner_attach(adap); adap->props.tuner_attach(adap);
adap->num_frontends_initialized++; adap->num_frontends_initialized++;
} }
......
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