From 597843435c0a6421d687a5f7a1ce11548e7cd6e1 Mon Sep 17 00:00:00 2001 From: Antti Palosaari Date: Wed, 1 Aug 2012 14:44:06 -0300 Subject: [PATCH] [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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-usb/Kconfig | 15 ++++++ drivers/media/dvb/dvb-usb/Makefile | 3 ++ drivers/media/dvb/dvb-usb/dvb_usb_common.h | 28 +++++------ drivers/media/dvb/dvb-usb/dvb_usb_dvb.c | 24 +++++----- drivers/media/dvb/dvb-usb/dvb_usb_init.c | 56 +++++++++++----------- drivers/media/dvb/dvb-usb/dvb_usb_remote.c | 8 ++-- drivers/media/dvb/dvb-usb/usb_urb.c | 12 ++--- 7 files changed, 82 insertions(+), 64 deletions(-) diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index c2161565023a..a6ffdb322041 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig @@ -13,6 +13,21 @@ config DVB_USB 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 + . + + For a complete list of supported USB devices see the LinuxTV DVB Wiki: + + + Say Y if you own a USB DVB device. + config DVB_USB_DEBUG bool "Enable extended debug support for all DVB-USB devices" depends on DVB_USB diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile index b667ac39a4e3..3c73e7b2a9f8 100644 --- a/drivers/media/dvb/dvb-usb/Makefile +++ b/drivers/media/dvb/dvb-usb/Makefile @@ -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 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 obj-$(CONFIG_DVB_USB_VP7045) += dvb-usb-vp7045.o diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_common.h b/drivers/media/dvb/dvb-usb/dvb_usb_common.h index c3035a154860..dcdccb7fde31 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_common.h +++ b/drivers/media/dvb/dvb-usb/dvb_usb_common.h @@ -11,27 +11,27 @@ #include "dvb_usb.h" -extern int dvb_usb_disable_rc_polling; +extern int dvb_usbv2_disable_rc_polling; /* 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); -extern int usb_urb_exit(struct usb_data_stream *stream); -extern int usb_urb_submit(struct usb_data_stream *stream, +extern int usb_urb_exitv2(struct usb_data_stream *stream); +extern int usb_urb_submitv2(struct usb_data_stream *stream, 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_usb_adapter_stream_exit(struct dvb_usb_adapter *adap); +extern int dvb_usbv2_adapter_stream_init(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_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap); -extern int dvb_usb_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_dvb_init(struct dvb_usb_adapter *adap); +extern int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap); +extern int dvb_usbv2_adapter_frontend_init(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_usb_remote_exit(struct dvb_usb_device *); +extern int dvb_usbv2_remote_init(struct dvb_usb_device *); +extern int dvb_usbv2_remote_exit(struct dvb_usb_device *); #endif diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c b/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c index a2ec0427f833..a08d879fd177 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c +++ b/drivers/media/dvb/dvb-usb/dvb_usb_dvb.c @@ -32,7 +32,7 @@ static void dvb_usb_data_complete_raw(struct usb_data_stream *stream, 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; 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 */ 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; } @@ -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 */ if (newfeedcount == 0) { pr_debug("%s: stop feeding\n", __func__); - usb_urb_kill(&adap->stream); + usb_urb_killv2(&adap->stream); if (adap->props.streaming_ctrl != NULL) { 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__); - usb_urb_submit(&adap->stream, &stream_props); + usb_urb_submitv2(&adap->stream, &stream_props); pr_debug("%s: controlling pid parser\n", __func__); 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); } -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, adap->dev->props.owner, @@ -256,7 +256,7 @@ err: 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) { pr_debug("%s: unregistering DVB part\n", __func__); @@ -275,7 +275,7 @@ static int dvb_usb_fe_wakeup(struct dvb_frontend *fe) int ret; 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) goto err; @@ -316,7 +316,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe) goto err; } - ret = dvb_usb_device_power_ctrl(adap->dev, 0); + ret = dvb_usbv2_device_power_ctrl(adap->dev, 0); if (ret < 0) goto err; @@ -328,7 +328,7 @@ err: 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; @@ -397,7 +397,7 @@ err: 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; diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_init.c b/drivers/media/dvb/dvb-usb/dvb_usb_init.c index 9f75bb18ed17..c98712a29133 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_init.c +++ b/drivers/media/dvb/dvb-usb/dvb_usb_init.c @@ -13,8 +13,8 @@ */ #include "dvb_usb_common.h" -int dvb_usb_disable_rc_polling; -module_param_named(disable_rc_polling, dvb_usb_disable_rc_polling, int, 0644); +int dvb_usbv2_disable_rc_polling; +module_param_named(disable_rc_polling, dvb_usbv2_disable_rc_polling, int, 0644); MODULE_PARM_DESC(disable_rc_polling, "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" \ " 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; const struct firmware *fw = NULL; @@ -68,7 +68,7 @@ err: 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; @@ -91,7 +91,7 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d) 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) i2c_del_adapter(&d->i2c_adap); @@ -99,7 +99,7 @@ int dvb_usb_i2c_exit(struct dvb_usb_device *d) 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; 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; } - ret = dvb_usb_adapter_stream_init(adap); + ret = dvb_usbv2_adapter_stream_init(adap); if (ret) return ret; - ret = dvb_usb_adapter_dvb_init(adap); + ret = dvb_usbv2_adapter_dvb_init(adap); if (ret) return ret; - ret = dvb_usb_adapter_frontend_init(adap); + ret = dvb_usbv2_adapter_frontend_init(adap); if (ret) return ret; @@ -180,14 +180,14 @@ err: 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; for (n = 0; n < d->num_adapters_initialized; n++) { - dvb_usb_adapter_frontend_exit(&d->adapter[n]); - dvb_usb_adapter_dvb_exit(&d->adapter[n]); - dvb_usb_adapter_stream_exit(&d->adapter[n]); + dvb_usbv2_adapter_frontend_exit(&d->adapter[n]); + dvb_usbv2_adapter_dvb_exit(&d->adapter[n]); + dvb_usbv2_adapter_stream_exit(&d->adapter[n]); } d->num_adapters_initialized = 0; @@ -196,12 +196,12 @@ static int dvb_usb_adapter_exit(struct dvb_usb_device *d) } /* 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); - dvb_usb_remote_exit(d); - dvb_usb_adapter_exit(d); - dvb_usb_i2c_exit(d); + dvb_usbv2_remote_exit(d); + dvb_usbv2_adapter_exit(d); + dvb_usbv2_i2c_exit(d); pr_debug("%s: state should be zero now: %x\n", __func__, d->state); d->state = DVB_USB_STATE_INIT; kfree(d->priv); @@ -209,14 +209,14 @@ static int dvb_usb_exit(struct dvb_usb_device *d) 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; d->state = DVB_USB_STATE_INIT; /* check the capabilities and set appropriate variables */ - dvb_usb_device_power_ctrl(d, 1); + dvb_usbv2_device_power_ctrl(d, 1); /* read config */ if (d->props.read_config) { @@ -225,24 +225,24 @@ static int dvb_usb_init(struct dvb_usb_device *d) goto err; } - ret = dvb_usb_i2c_init(d); + ret = dvb_usbv2_i2c_init(d); if (ret == 0) - ret = dvb_usb_adapter_init(d); + ret = dvb_usbv2_adapter_init(d); if (ret) { - dvb_usb_exit(d); + dvb_usbv2_exit(d); return ret; } if (d->props.init) d->props.init(d); - ret = dvb_usb_remote_init(d); + ret = dvb_usbv2_remote_init(d); if (ret) pr_err("%s: could not initialize remote control\n", KBUILD_MODNAME); - dvb_usb_device_power_ctrl(d, 0); + dvb_usbv2_device_power_ctrl(d, 0); return 0; err: @@ -250,7 +250,7 @@ err: 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) d->powered++; @@ -308,7 +308,7 @@ static void dvb_usbv2_init_work(struct work_struct *work) if (cold) { pr_info("%s: found a '%s' in cold state\n", KBUILD_MODNAME, d->name); - ret = dvb_usb_download_firmware(d); + ret = dvb_usbv2_download_firmware(d); if (ret == 0) { ; } 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); - ret = dvb_usb_init(d); + ret = dvb_usbv2_init(d); if (ret < 0) goto err_usb_driver_release_interface; @@ -413,7 +413,7 @@ void dvb_usbv2_disconnect(struct usb_interface *intf) usb_set_intfdata(intf, NULL); if (d) { name = d->name; - dvb_usb_exit(d); + dvb_usbv2_exit(d); } pr_info("%s: '%s' successfully deinitialized and disconnected\n", diff --git a/drivers/media/dvb/dvb-usb/dvb_usb_remote.c b/drivers/media/dvb/dvb-usb/dvb_usb_remote.c index 8c7f1221f89a..4b7cd0e29bfa 100644 --- a/drivers/media/dvb/dvb-usb/dvb_usb_remote.c +++ b/drivers/media/dvb/dvb-usb/dvb_usb_remote.c @@ -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 * 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; 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)); } -int dvb_usb_remote_init(struct dvb_usb_device *d) +int dvb_usbv2_remote_init(struct dvb_usb_device *d) { int ret; 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; ret = d->props.get_rc_config(d, &d->rc); @@ -104,7 +104,7 @@ err: 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) { cancel_delayed_work_sync(&d->rc_query_work); diff --git a/drivers/media/dvb/dvb-usb/usb_urb.c b/drivers/media/dvb/dvb-usb/usb_urb.c index 396c755c3ad0..16e9fa03c847 100644 --- a/drivers/media/dvb/dvb-usb/usb_urb.c +++ b/drivers/media/dvb/dvb-usb/usb_urb.c @@ -72,7 +72,7 @@ static void usb_urb_complete(struct urb *urb) 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; for (i = 0; i < stream->urbs_submitted; i++) { @@ -84,7 +84,7 @@ int usb_urb_kill(struct usb_data_stream *stream) 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) { int i, ret; @@ -101,7 +101,7 @@ int usb_urb_submit(struct usb_data_stream *stream, if (ret) { pr_err("%s: could not submit URB no. %d - get them " \ "all back\n", KBUILD_MODNAME, i); - usb_urb_kill(stream); + usb_urb_killv2(stream); return ret; } stream->urbs_submitted++; @@ -113,7 +113,7 @@ int usb_urb_free_urbs(struct usb_data_stream *stream) { int i; - usb_urb_kill(stream); + usb_urb_killv2(stream); for (i = 0; i < stream->urbs_initialized; i++) { if (stream->urb_list[i] != NULL) { @@ -305,7 +305,7 @@ int usb_urb_reconfig(struct usb_data_stream *stream, 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) { 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_free_stream_buffers(stream); -- 2.39.5