Commit f7d141b3 authored by Kevin Baradon's avatar Kevin Baradon Committed by Mauro Carvalho Chehab

[media] imon: Use large delays earlier

send_packet() is used during initialization, before send_packet_delay
is set. So, move ictx->send_packet_delay to happen earlier.

[mchehab@redhat.com: fold two patches into one to make git history clearer]
Signed-off-by: default avatarKevin Baradon <kevin.baradon@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent c06ca8f9
...@@ -2093,7 +2093,8 @@ static bool imon_find_endpoints(struct imon_context *ictx, ...@@ -2093,7 +2093,8 @@ static bool imon_find_endpoints(struct imon_context *ictx,
} }
static struct imon_context *imon_init_intf0(struct usb_interface *intf) static struct imon_context *imon_init_intf0(struct usb_interface *intf,
const struct usb_device_id *id)
{ {
struct imon_context *ictx; struct imon_context *ictx;
struct urb *rx_urb; struct urb *rx_urb;
...@@ -2133,6 +2134,10 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) ...@@ -2133,6 +2134,10 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf)
ictx->vendor = le16_to_cpu(ictx->usbdev_intf0->descriptor.idVendor); ictx->vendor = le16_to_cpu(ictx->usbdev_intf0->descriptor.idVendor);
ictx->product = le16_to_cpu(ictx->usbdev_intf0->descriptor.idProduct); ictx->product = le16_to_cpu(ictx->usbdev_intf0->descriptor.idProduct);
/* default send_packet delay is 5ms but some devices need more */
ictx->send_packet_delay = id->driver_info & IMON_NEED_20MS_PKT_DELAY ?
20 : 5;
ret = -ENODEV; ret = -ENODEV;
iface_desc = intf->cur_altsetting; iface_desc = intf->cur_altsetting;
if (!imon_find_endpoints(ictx, iface_desc)) { if (!imon_find_endpoints(ictx, iface_desc)) {
...@@ -2311,7 +2316,7 @@ static int imon_probe(struct usb_interface *interface, ...@@ -2311,7 +2316,7 @@ static int imon_probe(struct usb_interface *interface,
first_if_ctx = usb_get_intfdata(first_if); first_if_ctx = usb_get_intfdata(first_if);
if (ifnum == 0) { if (ifnum == 0) {
ictx = imon_init_intf0(interface); ictx = imon_init_intf0(interface, id);
if (!ictx) { if (!ictx) {
pr_err("failed to initialize context!\n"); pr_err("failed to initialize context!\n");
ret = -ENODEV; ret = -ENODEV;
...@@ -2329,10 +2334,6 @@ static int imon_probe(struct usb_interface *interface, ...@@ -2329,10 +2334,6 @@ static int imon_probe(struct usb_interface *interface,
} }
/* default send_packet delay is 5ms but some devices need more */
ictx->send_packet_delay = id->driver_info & IMON_NEED_20MS_PKT_DELAY ?
20 : 5;
usb_set_intfdata(interface, ictx); usb_set_intfdata(interface, ictx);
if (ifnum == 0) { if (ifnum == 0) {
......
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