diff options
author | Kevin Baradon <kevin.baradon@gmail.com> | 2013-04-22 15:09:44 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-23 16:37:27 -0400 |
commit | f7d141b312702d33449809b823894c486e6d9770 (patch) | |
tree | c4b0e7963326328f5bff49d7da8c5f0e49bce040 | |
parent | c06ca8f92b0b23dfd209fea27d71046c9c776910 (diff) |
[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: Kevin Baradon <kevin.baradon@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/rc/imon.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index b8f9f85a11c9..624fd33d7086 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c | |||
@@ -2093,7 +2093,8 @@ static bool imon_find_endpoints(struct imon_context *ictx, | |||
2093 | 2093 | ||
2094 | } | 2094 | } |
2095 | 2095 | ||
2096 | static struct imon_context *imon_init_intf0(struct usb_interface *intf) | 2096 | static struct imon_context *imon_init_intf0(struct usb_interface *intf, |
2097 | const struct usb_device_id *id) | ||
2097 | { | 2098 | { |
2098 | struct imon_context *ictx; | 2099 | struct imon_context *ictx; |
2099 | struct urb *rx_urb; | 2100 | struct urb *rx_urb; |
@@ -2133,6 +2134,10 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) | |||
2133 | ictx->vendor = le16_to_cpu(ictx->usbdev_intf0->descriptor.idVendor); | 2134 | ictx->vendor = le16_to_cpu(ictx->usbdev_intf0->descriptor.idVendor); |
2134 | ictx->product = le16_to_cpu(ictx->usbdev_intf0->descriptor.idProduct); | 2135 | ictx->product = le16_to_cpu(ictx->usbdev_intf0->descriptor.idProduct); |
2135 | 2136 | ||
2137 | /* default send_packet delay is 5ms but some devices need more */ | ||
2138 | ictx->send_packet_delay = id->driver_info & IMON_NEED_20MS_PKT_DELAY ? | ||
2139 | 20 : 5; | ||
2140 | |||
2136 | ret = -ENODEV; | 2141 | ret = -ENODEV; |
2137 | iface_desc = intf->cur_altsetting; | 2142 | iface_desc = intf->cur_altsetting; |
2138 | if (!imon_find_endpoints(ictx, iface_desc)) { | 2143 | if (!imon_find_endpoints(ictx, iface_desc)) { |
@@ -2311,7 +2316,7 @@ static int imon_probe(struct usb_interface *interface, | |||
2311 | first_if_ctx = usb_get_intfdata(first_if); | 2316 | first_if_ctx = usb_get_intfdata(first_if); |
2312 | 2317 | ||
2313 | if (ifnum == 0) { | 2318 | if (ifnum == 0) { |
2314 | ictx = imon_init_intf0(interface); | 2319 | ictx = imon_init_intf0(interface, id); |
2315 | if (!ictx) { | 2320 | if (!ictx) { |
2316 | pr_err("failed to initialize context!\n"); | 2321 | pr_err("failed to initialize context!\n"); |
2317 | ret = -ENODEV; | 2322 | ret = -ENODEV; |
@@ -2329,10 +2334,6 @@ static int imon_probe(struct usb_interface *interface, | |||
2329 | 2334 | ||
2330 | } | 2335 | } |
2331 | 2336 | ||
2332 | /* default send_packet delay is 5ms but some devices need more */ | ||
2333 | ictx->send_packet_delay = id->driver_info & IMON_NEED_20MS_PKT_DELAY ? | ||
2334 | 20 : 5; | ||
2335 | |||
2336 | usb_set_intfdata(interface, ictx); | 2337 | usb_set_intfdata(interface, ictx); |
2337 | 2338 | ||
2338 | if (ifnum == 0) { | 2339 | if (ifnum == 0) { |