[media] dvb_usb_v2: enable compile

Compilation was disabled as it was failing with allyesconfig.
Rename duplicate functions and enable building.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Antti Palosaari 2012-08-01 14:44:06 -03:00 committed by Mauro Carvalho Chehab
parent 3238aafbc3
commit 597843435c
7 changed files with 82 additions and 64 deletions

View File

@ -13,6 +13,21 @@ config DVB_USB
Say Y if you own a USB DVB device. Say Y if you own a USB DVB device.
config DVB_USB_V2
tristate "Support for various USB DVB devices v2"
depends on DVB_CORE && USB && I2C && RC_CORE
help
By enabling this you will be able to choose the various supported
USB1.1 and USB2.0 DVB devices.
Almost every USB device needs a firmware, please look into
<file:Documentation/dvb/README.dvb-usb>.
For a complete list of supported USB devices see the LinuxTV DVB Wiki:
<http://www.linuxtv.org/wiki/index.php/DVB_USB>
Say Y if you own a USB DVB device.
config DVB_USB_DEBUG config DVB_USB_DEBUG
bool "Enable extended debug support for all DVB-USB devices" bool "Enable extended debug support for all DVB-USB devices"
depends on DVB_USB depends on DVB_USB

View File

@ -1,6 +1,9 @@
dvb-usb-objs = dvb-usb-firmware.o dvb-usb-init.o dvb-usb-urb.o dvb-usb-i2c.o dvb-usb-dvb.o dvb-usb-remote.o usb-urb.o dvb-usb-objs = dvb-usb-firmware.o dvb-usb-init.o dvb-usb-urb.o dvb-usb-i2c.o dvb-usb-dvb.o dvb-usb-remote.o usb-urb.o
obj-$(CONFIG_DVB_USB) += dvb-usb.o obj-$(CONFIG_DVB_USB) += dvb-usb.o
dvb_usbv2-objs = dvb_usb_init.o dvb_usb_urb.o dvb_usb_dvb.o dvb_usb_remote.o usb_urb.o
obj-$(CONFIG_DVB_USB_V2) += dvb_usbv2.o
dvb-usb-vp7045-objs = vp7045.o vp7045-fe.o dvb-usb-vp7045-objs = vp7045.o vp7045-fe.o
obj-$(CONFIG_DVB_USB_VP7045) += dvb-usb-vp7045.o obj-$(CONFIG_DVB_USB_VP7045) += dvb-usb-vp7045.o

View File

@ -11,27 +11,27 @@
#include "dvb_usb.h" #include "dvb_usb.h"
extern int dvb_usb_disable_rc_polling; extern int dvb_usbv2_disable_rc_polling;
/* commonly used methods */ /* commonly used methods */
extern int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff); extern int dvb_usbv2_device_power_ctrl(struct dvb_usb_device *d, int onoff);
extern int usb_urb_init(struct usb_data_stream *stream, extern int usb_urb_initv2(struct usb_data_stream *stream,
struct usb_data_stream_properties *props); struct usb_data_stream_properties *props);
extern int usb_urb_exit(struct usb_data_stream *stream); extern int usb_urb_exitv2(struct usb_data_stream *stream);
extern int usb_urb_submit(struct usb_data_stream *stream, extern int usb_urb_submitv2(struct usb_data_stream *stream,
struct usb_data_stream_properties *props); struct usb_data_stream_properties *props);
extern int usb_urb_kill(struct usb_data_stream *stream); extern int usb_urb_killv2(struct usb_data_stream *stream);
extern int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap); extern int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap);
extern int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap); extern int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap);
extern int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap); extern int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap);
extern int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap); extern int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap);
extern int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap); extern int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap);
extern int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap); extern int dvb_usbv2_adapter_frontend_exit(struct dvb_usb_adapter *adap);
extern int dvb_usb_remote_init(struct dvb_usb_device *); extern int dvb_usbv2_remote_init(struct dvb_usb_device *);
extern int dvb_usb_remote_exit(struct dvb_usb_device *); extern int dvb_usbv2_remote_exit(struct dvb_usb_device *);
#endif #endif

View File

@ -32,7 +32,7 @@ static void dvb_usb_data_complete_raw(struct usb_data_stream *stream,
dvb_dmx_swfilter_raw(&adap->demux, buffer, length); dvb_dmx_swfilter_raw(&adap->demux, buffer, length);
} }
int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap) int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap)
{ {
int ret; int ret;
struct usb_data_stream_properties stream_props; struct usb_data_stream_properties stream_props;
@ -53,12 +53,12 @@ int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap)
/* FIXME: can be removed as set later in anyway */ /* FIXME: can be removed as set later in anyway */
adap->stream.complete = dvb_usb_data_complete; adap->stream.complete = dvb_usb_data_complete;
return usb_urb_init(&adap->stream, &stream_props); return usb_urb_initv2(&adap->stream, &stream_props);
} }
int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap) int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap)
{ {
usb_urb_exit(&adap->stream); usb_urb_exitv2(&adap->stream);
return 0; return 0;
} }
@ -78,7 +78,7 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
/* stop feed before setting a new pid if there will be no pid anymore */ /* stop feed before setting a new pid if there will be no pid anymore */
if (newfeedcount == 0) { if (newfeedcount == 0) {
pr_debug("%s: stop feeding\n", __func__); pr_debug("%s: stop feeding\n", __func__);
usb_urb_kill(&adap->stream); usb_urb_killv2(&adap->stream);
if (adap->props.streaming_ctrl != NULL) { if (adap->props.streaming_ctrl != NULL) {
ret = adap->props.streaming_ctrl(adap, 0); ret = adap->props.streaming_ctrl(adap, 0);
@ -141,7 +141,7 @@ static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
pr_debug("%s: submitting all URBs\n", __func__); pr_debug("%s: submitting all URBs\n", __func__);
usb_urb_submit(&adap->stream, &stream_props); usb_urb_submitv2(&adap->stream, &stream_props);
pr_debug("%s: controlling pid parser\n", __func__); pr_debug("%s: controlling pid parser\n", __func__);
if (adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER && if (adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER &&
@ -187,7 +187,7 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
return dvb_usb_ctrl_feed(dvbdmxfeed, 0); return dvb_usb_ctrl_feed(dvbdmxfeed, 0);
} }
int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap) int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap)
{ {
int ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->name, int ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->name,
adap->dev->props.owner, adap->dev->props.owner,
@ -256,7 +256,7 @@ err:
return ret; return ret;
} }
int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap) int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap)
{ {
if (adap->state & DVB_USB_ADAP_STATE_DVB) { if (adap->state & DVB_USB_ADAP_STATE_DVB) {
pr_debug("%s: unregistering DVB part\n", __func__); pr_debug("%s: unregistering DVB part\n", __func__);
@ -275,7 +275,7 @@ static int dvb_usb_fe_wakeup(struct dvb_frontend *fe)
int ret; int ret;
struct dvb_usb_adapter *adap = fe->dvb->priv; struct dvb_usb_adapter *adap = fe->dvb->priv;
ret = dvb_usb_device_power_ctrl(adap->dev, 1); ret = dvb_usbv2_device_power_ctrl(adap->dev, 1);
if (ret < 0) if (ret < 0)
goto err; goto err;
@ -316,7 +316,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
goto err; goto err;
} }
ret = dvb_usb_device_power_ctrl(adap->dev, 0); ret = dvb_usbv2_device_power_ctrl(adap->dev, 0);
if (ret < 0) if (ret < 0)
goto err; goto err;
@ -328,7 +328,7 @@ err:
return ret; return ret;
} }
int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap) int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
{ {
int ret, i, count_registered = 0; int ret, i, count_registered = 0;
@ -397,7 +397,7 @@ err:
return ret; return ret;
} }
int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap) int dvb_usbv2_adapter_frontend_exit(struct dvb_usb_adapter *adap)
{ {
int i; int i;

View File

@ -13,8 +13,8 @@
*/ */
#include "dvb_usb_common.h" #include "dvb_usb_common.h"
int dvb_usb_disable_rc_polling; int dvb_usbv2_disable_rc_polling;
module_param_named(disable_rc_polling, dvb_usb_disable_rc_polling, int, 0644); module_param_named(disable_rc_polling, dvb_usbv2_disable_rc_polling, int, 0644);
MODULE_PARM_DESC(disable_rc_polling, MODULE_PARM_DESC(disable_rc_polling,
"disable remote control polling (default: 0)."); "disable remote control polling (default: 0).");
@ -24,7 +24,7 @@ module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage,
MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a" \ MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a" \
" PID filter, if any (default: 0)."); " PID filter, if any (default: 0).");
int dvb_usb_download_firmware(struct dvb_usb_device *d) int dvb_usbv2_download_firmware(struct dvb_usb_device *d)
{ {
int ret; int ret;
const struct firmware *fw = NULL; const struct firmware *fw = NULL;
@ -68,7 +68,7 @@ err:
return ret; return ret;
} }
int dvb_usb_i2c_init(struct dvb_usb_device *d) int dvb_usbv2_i2c_init(struct dvb_usb_device *d)
{ {
int ret = 0; int ret = 0;
@ -91,7 +91,7 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d)
return ret; return ret;
} }
int dvb_usb_i2c_exit(struct dvb_usb_device *d) int dvb_usbv2_i2c_exit(struct dvb_usb_device *d)
{ {
if (d->state & DVB_USB_STATE_I2C) if (d->state & DVB_USB_STATE_I2C)
i2c_del_adapter(&d->i2c_adap); i2c_del_adapter(&d->i2c_adap);
@ -99,7 +99,7 @@ int dvb_usb_i2c_exit(struct dvb_usb_device *d)
return 0; return 0;
} }
static int dvb_usb_adapter_init(struct dvb_usb_device *d) static int dvb_usbv2_adapter_init(struct dvb_usb_device *d)
{ {
struct dvb_usb_adapter *adap; struct dvb_usb_adapter *adap;
int ret, n, adapter_count; int ret, n, adapter_count;
@ -154,15 +154,15 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d)
adap->max_feed_count = adap->props.pid_filter_count; adap->max_feed_count = adap->props.pid_filter_count;
} }
ret = dvb_usb_adapter_stream_init(adap); ret = dvb_usbv2_adapter_stream_init(adap);
if (ret) if (ret)
return ret; return ret;
ret = dvb_usb_adapter_dvb_init(adap); ret = dvb_usbv2_adapter_dvb_init(adap);
if (ret) if (ret)
return ret; return ret;
ret = dvb_usb_adapter_frontend_init(adap); ret = dvb_usbv2_adapter_frontend_init(adap);
if (ret) if (ret)
return ret; return ret;
@ -180,14 +180,14 @@ err:
return ret; return ret;
} }
static int dvb_usb_adapter_exit(struct dvb_usb_device *d) static int dvb_usbv2_adapter_exit(struct dvb_usb_device *d)
{ {
int n; int n;
for (n = 0; n < d->num_adapters_initialized; n++) { for (n = 0; n < d->num_adapters_initialized; n++) {
dvb_usb_adapter_frontend_exit(&d->adapter[n]); dvb_usbv2_adapter_frontend_exit(&d->adapter[n]);
dvb_usb_adapter_dvb_exit(&d->adapter[n]); dvb_usbv2_adapter_dvb_exit(&d->adapter[n]);
dvb_usb_adapter_stream_exit(&d->adapter[n]); dvb_usbv2_adapter_stream_exit(&d->adapter[n]);
} }
d->num_adapters_initialized = 0; d->num_adapters_initialized = 0;
@ -196,12 +196,12 @@ static int dvb_usb_adapter_exit(struct dvb_usb_device *d)
} }
/* general initialization functions */ /* general initialization functions */
static int dvb_usb_exit(struct dvb_usb_device *d) static int dvb_usbv2_exit(struct dvb_usb_device *d)
{ {
pr_debug("%s: state before exiting everything: %x\n", __func__, d->state); pr_debug("%s: state before exiting everything: %x\n", __func__, d->state);
dvb_usb_remote_exit(d); dvb_usbv2_remote_exit(d);
dvb_usb_adapter_exit(d); dvb_usbv2_adapter_exit(d);
dvb_usb_i2c_exit(d); dvb_usbv2_i2c_exit(d);
pr_debug("%s: state should be zero now: %x\n", __func__, d->state); pr_debug("%s: state should be zero now: %x\n", __func__, d->state);
d->state = DVB_USB_STATE_INIT; d->state = DVB_USB_STATE_INIT;
kfree(d->priv); kfree(d->priv);
@ -209,14 +209,14 @@ static int dvb_usb_exit(struct dvb_usb_device *d)
return 0; return 0;
} }
static int dvb_usb_init(struct dvb_usb_device *d) static int dvb_usbv2_init(struct dvb_usb_device *d)
{ {
int ret = 0; int ret = 0;
d->state = DVB_USB_STATE_INIT; d->state = DVB_USB_STATE_INIT;
/* check the capabilities and set appropriate variables */ /* check the capabilities and set appropriate variables */
dvb_usb_device_power_ctrl(d, 1); dvb_usbv2_device_power_ctrl(d, 1);
/* read config */ /* read config */
if (d->props.read_config) { if (d->props.read_config) {
@ -225,24 +225,24 @@ static int dvb_usb_init(struct dvb_usb_device *d)
goto err; goto err;
} }
ret = dvb_usb_i2c_init(d); ret = dvb_usbv2_i2c_init(d);
if (ret == 0) if (ret == 0)
ret = dvb_usb_adapter_init(d); ret = dvb_usbv2_adapter_init(d);
if (ret) { if (ret) {
dvb_usb_exit(d); dvb_usbv2_exit(d);
return ret; return ret;
} }
if (d->props.init) if (d->props.init)
d->props.init(d); d->props.init(d);
ret = dvb_usb_remote_init(d); ret = dvb_usbv2_remote_init(d);
if (ret) if (ret)
pr_err("%s: could not initialize remote control\n", pr_err("%s: could not initialize remote control\n",
KBUILD_MODNAME); KBUILD_MODNAME);
dvb_usb_device_power_ctrl(d, 0); dvb_usbv2_device_power_ctrl(d, 0);
return 0; return 0;
err: err:
@ -250,7 +250,7 @@ err:
return ret; return ret;
} }
int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff) int dvb_usbv2_device_power_ctrl(struct dvb_usb_device *d, int onoff)
{ {
if (onoff) if (onoff)
d->powered++; d->powered++;
@ -308,7 +308,7 @@ static void dvb_usbv2_init_work(struct work_struct *work)
if (cold) { if (cold) {
pr_info("%s: found a '%s' in cold state\n", pr_info("%s: found a '%s' in cold state\n",
KBUILD_MODNAME, d->name); KBUILD_MODNAME, d->name);
ret = dvb_usb_download_firmware(d); ret = dvb_usbv2_download_firmware(d);
if (ret == 0) { if (ret == 0) {
; ;
} else if (ret == RECONNECTS_USB) { } else if (ret == RECONNECTS_USB) {
@ -321,7 +321,7 @@ static void dvb_usbv2_init_work(struct work_struct *work)
pr_info("%s: found a '%s' in warm state\n", KBUILD_MODNAME, d->name); pr_info("%s: found a '%s' in warm state\n", KBUILD_MODNAME, d->name);
ret = dvb_usb_init(d); ret = dvb_usbv2_init(d);
if (ret < 0) if (ret < 0)
goto err_usb_driver_release_interface; goto err_usb_driver_release_interface;
@ -413,7 +413,7 @@ void dvb_usbv2_disconnect(struct usb_interface *intf)
usb_set_intfdata(intf, NULL); usb_set_intfdata(intf, NULL);
if (d) { if (d) {
name = d->name; name = d->name;
dvb_usb_exit(d); dvb_usbv2_exit(d);
} }
pr_info("%s: '%s' successfully deinitialized and disconnected\n", pr_info("%s: '%s' successfully deinitialized and disconnected\n",

View File

@ -26,7 +26,7 @@ static void dvb_usb_read_remote_control(struct work_struct *work)
/* when the parameter has been set to 1 via sysfs while the /* when the parameter has been set to 1 via sysfs while the
* driver was running, or when bulk mode is enabled after IR init * driver was running, or when bulk mode is enabled after IR init
*/ */
if (dvb_usb_disable_rc_polling || d->rc.bulk_mode) if (dvb_usbv2_disable_rc_polling || d->rc.bulk_mode)
return; return;
ret = d->rc.query(d); ret = d->rc.query(d);
@ -38,12 +38,12 @@ static void dvb_usb_read_remote_control(struct work_struct *work)
msecs_to_jiffies(d->rc.interval)); msecs_to_jiffies(d->rc.interval));
} }
int dvb_usb_remote_init(struct dvb_usb_device *d) int dvb_usbv2_remote_init(struct dvb_usb_device *d)
{ {
int ret; int ret;
struct rc_dev *dev; struct rc_dev *dev;
if (dvb_usb_disable_rc_polling || !d->props.get_rc_config) if (dvb_usbv2_disable_rc_polling || !d->props.get_rc_config)
return 0; return 0;
ret = d->props.get_rc_config(d, &d->rc); ret = d->props.get_rc_config(d, &d->rc);
@ -104,7 +104,7 @@ err:
return ret; return ret;
} }
int dvb_usb_remote_exit(struct dvb_usb_device *d) int dvb_usbv2_remote_exit(struct dvb_usb_device *d)
{ {
if (d->state & DVB_USB_STATE_REMOTE) { if (d->state & DVB_USB_STATE_REMOTE) {
cancel_delayed_work_sync(&d->rc_query_work); cancel_delayed_work_sync(&d->rc_query_work);

View File

@ -72,7 +72,7 @@ static void usb_urb_complete(struct urb *urb)
usb_submit_urb(urb, GFP_ATOMIC); usb_submit_urb(urb, GFP_ATOMIC);
} }
int usb_urb_kill(struct usb_data_stream *stream) int usb_urb_killv2(struct usb_data_stream *stream)
{ {
int i; int i;
for (i = 0; i < stream->urbs_submitted; i++) { for (i = 0; i < stream->urbs_submitted; i++) {
@ -84,7 +84,7 @@ int usb_urb_kill(struct usb_data_stream *stream)
return 0; return 0;
} }
int usb_urb_submit(struct usb_data_stream *stream, int usb_urb_submitv2(struct usb_data_stream *stream,
struct usb_data_stream_properties *props) struct usb_data_stream_properties *props)
{ {
int i, ret; int i, ret;
@ -101,7 +101,7 @@ int usb_urb_submit(struct usb_data_stream *stream,
if (ret) { if (ret) {
pr_err("%s: could not submit URB no. %d - get them " \ pr_err("%s: could not submit URB no. %d - get them " \
"all back\n", KBUILD_MODNAME, i); "all back\n", KBUILD_MODNAME, i);
usb_urb_kill(stream); usb_urb_killv2(stream);
return ret; return ret;
} }
stream->urbs_submitted++; stream->urbs_submitted++;
@ -113,7 +113,7 @@ int usb_urb_free_urbs(struct usb_data_stream *stream)
{ {
int i; int i;
usb_urb_kill(stream); usb_urb_killv2(stream);
for (i = 0; i < stream->urbs_initialized; i++) { for (i = 0; i < stream->urbs_initialized; i++) {
if (stream->urb_list[i] != NULL) { if (stream->urb_list[i] != NULL) {
@ -305,7 +305,7 @@ int usb_urb_reconfig(struct usb_data_stream *stream,
return 0; return 0;
} }
int usb_urb_init(struct usb_data_stream *stream, int usb_urb_initv2(struct usb_data_stream *stream,
struct usb_data_stream_properties *props) struct usb_data_stream_properties *props)
{ {
int ret; int ret;
@ -347,7 +347,7 @@ int usb_urb_init(struct usb_data_stream *stream,
} }
} }
int usb_urb_exit(struct usb_data_stream *stream) int usb_urb_exitv2(struct usb_data_stream *stream)
{ {
usb_urb_free_urbs(stream); usb_urb_free_urbs(stream);
usb_free_stream_buffers(stream); usb_free_stream_buffers(stream);