Revert "media: Revert "media: dvb-usb: Fix unexpected infinite loop in dvb_usb_read_remote_control()""

This reverts commit bc158d0b3a.
This commit is contained in:
Ksawlii 2024-11-24 00:23:54 +01:00
parent 0b80835234
commit e89ee38649

View file

@ -23,11 +23,40 @@ static int dvb_usb_force_pid_filter_usage;
module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444);
MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID filter, if any (default: 0).");
static int dvb_usb_check_bulk_endpoint(struct dvb_usb_device *d, u8 endpoint)
{
if (endpoint) {
int ret;
ret = usb_pipe_type_check(d->udev, usb_sndbulkpipe(d->udev, endpoint));
if (ret)
return ret;
ret = usb_pipe_type_check(d->udev, usb_rcvbulkpipe(d->udev, endpoint));
if (ret)
return ret;
}
return 0;
}
static void dvb_usb_clear_halt(struct dvb_usb_device *d, u8 endpoint)
{
if (endpoint) {
usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, endpoint));
usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, endpoint));
}
}
static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)
{
struct dvb_usb_adapter *adap;
int ret, n, o;
ret = dvb_usb_check_bulk_endpoint(d, d->props.generic_bulk_ctrl_endpoint);
if (ret)
return ret;
ret = dvb_usb_check_bulk_endpoint(d, d->props.generic_bulk_ctrl_endpoint_response);
if (ret)
return ret;
for (n = 0; n < d->props.num_adapters; n++) {
adap = &d->adapter[n];
adap->dev = d;
@ -103,10 +132,8 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)
* when reloading the driver w/o replugging the device
* sometimes a timeout occurs, this helps
*/
if (d->props.generic_bulk_ctrl_endpoint != 0) {
usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
}
dvb_usb_clear_halt(d, d->props.generic_bulk_ctrl_endpoint);
dvb_usb_clear_halt(d, d->props.generic_bulk_ctrl_endpoint_response);
return 0;