#define DVB_USB_ADAP_STATE_DVB 0x001
int state;
struct dvb_usb_device *dev;
- struct dvb_usb_adapter_properties props;
+ const struct dvb_usb_adapter_properties *props;
struct usb_data_stream stream;
u8 id;
* in size_of_priv of dvb_usb_properties).
*/
struct dvb_usb_device {
- struct dvb_usb_device_properties props;
+ const struct dvb_usb_device_properties *props;
const char *name;
const char *rc_map;
struct dvb_usb_rc rc;
adap->stream.user_priv = adap;
/* resolve USB stream configuration for buffer alloc */
- if (adap->dev->props.get_usb_stream_config) {
- ret = adap->dev->props.get_usb_stream_config(NULL,
+ if (adap->dev->props->get_usb_stream_config) {
+ ret = adap->dev->props->get_usb_stream_config(NULL,
&stream_props);
if (ret < 0)
return ret;
} else {
- stream_props = adap->props.stream;
+ stream_props = adap->props->stream;
}
/* FIXME: can be removed as set later in anyway */
pr_debug("%s: stop feeding\n", __func__);
usb_urb_killv2(&adap->stream);
- if (adap->dev->props.streaming_ctrl != NULL) {
- ret = adap->dev->props.streaming_ctrl(adap, 0);
+ if (adap->dev->props->streaming_ctrl != NULL) {
+ ret = adap->dev->props->streaming_ctrl(adap, 0);
if (ret < 0) {
pr_err("%s: error while stopping stream\n",
KBUILD_MODNAME);
adap->pid_filtering ? "yes" : "no", dvbdmxfeed->pid,
dvbdmxfeed->pid, dvbdmxfeed->index,
onoff ? "on" : "off");
- if (adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER &&
+ if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER &&
adap->pid_filtering &&
- adap->props.pid_filter != NULL)
- adap->props.pid_filter(adap, dvbdmxfeed->index,
+ adap->props->pid_filter != NULL)
+ adap->props->pid_filter(adap, dvbdmxfeed->index,
dvbdmxfeed->pid, onoff);
/* start the feed if this was the first feed and there is still a feed
unsigned int ts_props;
/* resolve TS configuration */
- if (adap->dev->props.get_ts_config) {
- ret = adap->dev->props.get_ts_config(
+ if (adap->dev->props->get_ts_config) {
+ ret = adap->dev->props->get_ts_config(
adap->fe[adap->active_fe],
&ts_props);
if (ret < 0)
adap->stream.complete = dvb_usb_data_complete;
/* resolve USB stream configuration */
- if (adap->dev->props.get_usb_stream_config) {
- ret = adap->dev->props.get_usb_stream_config(
+ if (adap->dev->props->get_usb_stream_config) {
+ ret = adap->dev->props->get_usb_stream_config(
adap->fe[adap->active_fe],
&stream_props);
if (ret < 0)
return ret;
} else {
- stream_props = adap->props.stream;
+ stream_props = adap->props->stream;
}
pr_debug("%s: submitting all URBs\n", __func__);
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 &&
- adap->props.caps &
+ if (adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER &&
+ adap->props->caps &
DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF &&
- adap->props.pid_filter_ctrl != NULL) {
- ret = adap->props.pid_filter_ctrl(adap,
+ adap->props->pid_filter_ctrl != NULL) {
+ ret = adap->props->pid_filter_ctrl(adap,
adap->pid_filtering);
if (ret < 0) {
pr_err("%s: could not handle pid_parser\n",
}
}
pr_debug("%s: start feeding\n", __func__);
- if (adap->dev->props.streaming_ctrl != NULL) {
- ret = adap->dev->props.streaming_ctrl(adap, 1);
+ if (adap->dev->props->streaming_ctrl != NULL) {
+ ret = adap->dev->props->streaming_ctrl(adap, 1);
if (ret < 0) {
pr_err("%s: error while enabling fifo\n",
KBUILD_MODNAME);
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,
+ adap->dev->props->owner,
&adap->dev->udev->dev,
- adap->dev->props.adapter_nr);
+ adap->dev->props->adapter_nr);
if (ret < 0) {
pr_debug("%s: dvb_register_adapter failed=%d\n", __func__, ret);
goto err;
}
adap->dvb_adap.priv = adap;
- adap->dvb_adap.fe_ioctl_override = adap->props.fe_ioctl_override;
+ adap->dvb_adap.fe_ioctl_override = adap->props->fe_ioctl_override;
- if (adap->dev->props.read_mac_address) {
- if (adap->dev->props.read_mac_address(adap->dev,
+ if (adap->dev->props->read_mac_address) {
+ if (adap->dev->props->read_mac_address(adap->dev,
adap->dvb_adap.proposed_mac) == 0)
pr_info("%s: MAC address: %pM\n", KBUILD_MODNAME,
adap->dvb_adap.proposed_mac);
if (ret < 0)
goto err;
- if (adap->dev->props.frontend_ctrl) {
- ret = adap->dev->props.frontend_ctrl(fe, 1);
+ if (adap->dev->props->frontend_ctrl) {
+ ret = adap->dev->props->frontend_ctrl(fe, 1);
if (ret < 0)
goto err;
}
goto err;
}
- if (adap->dev->props.frontend_ctrl) {
- ret = adap->dev->props.frontend_ctrl(fe, 0);
+ if (adap->dev->props->frontend_ctrl) {
+ ret = adap->dev->props->frontend_ctrl(fe, 0);
if (ret < 0)
goto err;
}
memset(adap->fe, 0, sizeof(adap->fe));
adap->active_fe = -1;
- if (adap->dev->props.frontend_attach) {
- ret = adap->dev->props.frontend_attach(adap);
+ if (adap->dev->props->frontend_attach) {
+ ret = adap->dev->props->frontend_attach(adap);
if (ret < 0) {
pr_debug("%s: frontend_attach() failed=%d\n", __func__,
ret);
goto err;
}
- if (adap->dev->props.tuner_attach) {
- ret = adap->dev->props.tuner_attach(adap);
+ if (adap->dev->props->tuner_attach) {
+ ret = adap->dev->props->tuner_attach(adap);
if (ret < 0) {
pr_debug("%s: tuner_attach() failed=%d\n", __func__,
ret);
const char *name;
/* resolve firmware name */
- name = d->props.firmware;
- if (d->props.get_firmware_name) {
- ret = d->props.get_firmware_name(d, &name);
+ name = d->props->firmware;
+ if (d->props->get_firmware_name) {
+ ret = d->props->get_firmware_name(d, &name);
if (ret < 0)
goto err;
}
- if (!d->props.download_firmware) {
+ if (!d->props->download_firmware) {
ret = -EINVAL;
goto err;
}
pr_info("%s: downloading firmware from file '%s'\n", KBUILD_MODNAME,
name);
- ret = d->props.download_firmware(d, fw);
+ ret = d->props->download_firmware(d, fw);
release_firmware(fw);
{
int ret;
- if (!d->props.i2c_algo) {
+ if (!d->props->i2c_algo) {
ret = 0;
goto err;
}
strlcpy(d->i2c_adap.name, d->name, sizeof(d->i2c_adap.name));
- d->i2c_adap.algo = d->props.i2c_algo;
+ d->i2c_adap.algo = d->props->i2c_algo;
d->i2c_adap.algo_data = NULL;
d->i2c_adap.dev.parent = &d->udev->dev;
int ret, i, adapter_count;
/* resolve adapter count */
- adapter_count = d->props.num_adapters;
- if (d->props.get_adapter_count) {
- ret = d->props.get_adapter_count(d);
+ adapter_count = d->props->num_adapters;
+ if (d->props->get_adapter_count) {
+ ret = d->props->get_adapter_count(d);
if (ret < 0)
goto err;
for (i = 0; i < adapter_count; i++) {
adap = &d->adapter[i];
adap->dev = d;
- adap->id = i;
-
- memcpy(&adap->props, &d->props.adapter[i],
- sizeof(struct dvb_usb_adapter_properties));
+ adap->id = i;
+ adap->props = &d->props->adapter[i];
/* speed - when running at FULL speed we need a HW PID filter */
if (d->udev->speed == USB_SPEED_FULL &&
- !(adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER)) {
+ !(adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER)) {
pr_err("%s: this USB2.0 device cannot be run on a " \
"USB1.1 port (it lacks a hardware " \
"PID filter)\n", KBUILD_MODNAME);
ret = -ENODEV;
goto err;
} else if ((d->udev->speed == USB_SPEED_FULL &&
- adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER) ||
- (adap->props.caps & DVB_USB_ADAP_NEED_PID_FILTERING)) {
+ adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER) ||
+ (adap->props->caps & DVB_USB_ADAP_NEED_PID_FILTERING)) {
pr_info("%s: will use the device's hardware PID " \
"filter (table count: %d)\n",
KBUILD_MODNAME,
- adap->props.pid_filter_count);
+ adap->props->pid_filter_count);
adap->pid_filtering = 1;
- adap->max_feed_count = adap->props.pid_filter_count;
+ adap->max_feed_count = adap->props->pid_filter_count;
} else {
pr_info("%s: will pass the complete MPEG2 transport " \
"stream to the software demuxer\n",
}
if (!adap->pid_filtering && dvb_usb_force_pid_filter_usage &&
- adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER) {
+ adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER) {
pr_info("%s: pid filter enabled by module option\n",
KBUILD_MODNAME);
adap->pid_filtering = 1;
- adap->max_feed_count = adap->props.pid_filter_count;
+ adap->max_feed_count = adap->props->pid_filter_count;
}
ret = dvb_usbv2_adapter_stream_init(adap);
/* check the capabilities and set appropriate variables */
dvb_usbv2_device_power_ctrl(d, 1);
- if (d->props.read_config) {
- ret = d->props.read_config(d);
+ if (d->props->read_config) {
+ ret = d->props->read_config(d);
if (ret < 0)
goto err;
}
if (ret < 0)
goto err;
- if (d->props.init) {
- ret = d->props.init(d);
+ if (d->props->init) {
+ ret = d->props->init(d);
if (ret < 0)
goto err;
}
if (d->powered == 0 || (onoff && d->powered == 1)) {
/* when switching from 1 to 0 or from 0 to 1 */
pr_debug("%s: power control=%d\n", __func__, onoff);
- if (d->props.power_ctrl) {
- ret = d->props.power_ctrl(d, onoff);
+ if (d->props->power_ctrl) {
+ ret = d->props->power_ctrl(d, onoff);
goto err;
}
}
pr_debug("%s: work_pid=%d\n", __func__, d->work_pid);
- if (d->props.size_of_priv) {
- d->priv = kzalloc(d->props.size_of_priv, GFP_KERNEL);
+ if (d->props->size_of_priv) {
+ d->priv = kzalloc(d->props->size_of_priv, GFP_KERNEL);
if (!d->priv) {
pr_err("%s: kzalloc() failed\n", KBUILD_MODNAME);
ret = -ENOMEM;
}
}
- if (d->props.identify_state) {
- ret = d->props.identify_state(d);
+ if (d->props->identify_state) {
+ ret = d->props->identify_state(d);
if (ret == 0) {
;
} else if (ret == COLD) {
d->rc_map = driver_info->rc_map;
d->udev = interface_to_usbdev(intf);
d->intf = intf;
- memcpy(&d->props, driver_info->props,
- sizeof(struct dvb_usb_device_properties));
+ d->props = driver_info->props;
if (d->intf->cur_altsetting->desc.bInterfaceNumber !=
- d->props.bInterfaceNumber) {
+ d->props->bInterfaceNumber) {
ret = -ENODEV;
goto err_kfree;
}
if (d->work_pid != current->pid)
cancel_work_sync(&d->probe_work);
- if (d->props.disconnect)
- d->props.disconnect(d);
+ if (d->props->disconnect)
+ d->props->disconnect(d);
name = d->name;
dvb_usbv2_exit(d);
int ret;
struct rc_dev *dev;
- if (dvb_usbv2_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);
+ ret = d->props->get_rc_config(d, &d->rc);
if (ret < 0)
goto err;
dev->input_phys = d->rc_phys;
usb_to_input_id(d->udev, &dev->input_id);
/* TODO: likely RC-core should took const char * */
- dev->driver_name = (char *) d->props.driver_name;
+ dev->driver_name = (char *) d->props->driver_name;
dev->driver_type = d->rc.driver_type;
dev->allowed_protos = d->rc.allowed_protos;
dev->change_protocol = d->rc.change_protocol;
if (!d || wbuf == NULL || wlen == 0)
return -EINVAL;
- if (d->props.generic_bulk_ctrl_endpoint == 0) {
+ if (d->props->generic_bulk_ctrl_endpoint == 0) {
pr_err("%s: endpoint for generic control not specified\n",
KBUILD_MODNAME);
return -EINVAL;
32, 1, wbuf, wlen, 0);
ret = usb_bulk_msg(d->udev, usb_sndbulkpipe(d->udev,
- d->props.generic_bulk_ctrl_endpoint), wbuf, wlen,
+ d->props->generic_bulk_ctrl_endpoint), wbuf, wlen,
&actlen, 2000);
if (ret)
msleep(delay_ms);
ret = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev,
- d->props.generic_bulk_ctrl_endpoint_response ?
- d->props.generic_bulk_ctrl_endpoint_response :
- d->props.generic_bulk_ctrl_endpoint),
+ d->props->generic_bulk_ctrl_endpoint_response ?
+ d->props->generic_bulk_ctrl_endpoint_response :
+ d->props->generic_bulk_ctrl_endpoint),
rbuf, rlen, &actlen, 2000);
if (ret)