Commit 24168911 authored by Rupesh Gujare's avatar Rupesh Gujare Committed by Greg Kroah-Hartman

staging: ozwpan: Insulate driver from HZ value

This patch fixes issue caused due to different HZ
value on system which do not have HZ=1000
Signed-off-by: default avatarRupesh Gujare <rgujare@ozmodevices.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 28a72295
...@@ -1053,7 +1053,7 @@ int oz_hcd_heartbeat(void *hport) ...@@ -1053,7 +1053,7 @@ int oz_hcd_heartbeat(void *hport)
ep = ep_from_link(e); ep = ep_from_link(e);
if (ep->credit < 0) if (ep->credit < 0)
continue; continue;
ep->credit += (now - ep->last_jiffies); ep->credit += jiffies_to_msecs(now - ep->last_jiffies);
if (ep->credit > ep->credit_ceiling) if (ep->credit > ep->credit_ceiling)
ep->credit = ep->credit_ceiling; ep->credit = ep->credit_ceiling;
oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, 0, ep->credit); oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, 0, ep->credit);
...@@ -1062,7 +1062,7 @@ int oz_hcd_heartbeat(void *hport) ...@@ -1062,7 +1062,7 @@ int oz_hcd_heartbeat(void *hport)
urbl = list_first_entry(&ep->urb_list, urbl = list_first_entry(&ep->urb_list,
struct oz_urb_link, link); struct oz_urb_link, link);
urb = urbl->urb; urb = urbl->urb;
if (ep->credit < urb->number_of_packets) if ((ep->credit + 1) < urb->number_of_packets)
break; break;
ep->credit -= urb->number_of_packets; ep->credit -= urb->number_of_packets;
oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, 0, oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num, 0, 0,
...@@ -1105,7 +1105,7 @@ int oz_hcd_heartbeat(void *hport) ...@@ -1105,7 +1105,7 @@ int oz_hcd_heartbeat(void *hport)
} }
continue; continue;
} }
ep->credit += (now - ep->last_jiffies); ep->credit += jiffies_to_msecs(now - ep->last_jiffies);
oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num | USB_DIR_IN, oz_event_log(OZ_EVT_EP_CREDIT, ep->ep_num | USB_DIR_IN,
0, 0, ep->credit); 0, 0, ep->credit);
ep->last_jiffies = now; ep->last_jiffies = now;
...@@ -1117,7 +1117,7 @@ int oz_hcd_heartbeat(void *hport) ...@@ -1117,7 +1117,7 @@ int oz_hcd_heartbeat(void *hport)
int len = 0; int len = 0;
int copy_len; int copy_len;
int i; int i;
if (ep->credit < urb->number_of_packets) if ((ep->credit + 1) < urb->number_of_packets)
break; break;
if (ep->buffered_units < urb->number_of_packets) if (ep->buffered_units < urb->number_of_packets)
break; break;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
/* Converts millisecs to jiffies. /* Converts millisecs to jiffies.
*/ */
#define oz_ms_to_jiffies(__x) (((__x)*1000)/HZ) #define oz_ms_to_jiffies(__x) msecs_to_jiffies(__x)
/* Quantum milliseconds. /* Quantum milliseconds.
*/ */
......
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