aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChunyan Zhang <zhang.chunyan@linaro.org>2015-01-07 23:01:31 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-11 21:39:40 -0500
commit89a07e1726534957fc987b39742048d592ec9aae (patch)
treef5a98fad350c6615ded503c390d2eaefcc6d09b0
parent4c3bd197a0f9b98343c5a6533e76a259271855b4 (diff)
irda: stir4200: Replace timeval with ktime_t
The stir4200 driver uses 'timeval', which we try to remove in the kernel because all 32-bit time types will break in the year 2038. This patch also changes do_gettimeofday() to ktime_get() accordingly, since ktime_get returns a ktime_t, but do_gettimeofday returns a struct timeval, and the other reason is that ktime_get() uses the monotonic clock. This patch uses ktime_us_delta to get the elapsed time of microsecond. Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/irda/stir4200.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c
index dd1bd1060ec9..83cc48a01802 100644
--- a/drivers/net/irda/stir4200.c
+++ b/drivers/net/irda/stir4200.c
@@ -40,6 +40,7 @@
40#include <linux/moduleparam.h> 40#include <linux/moduleparam.h>
41 41
42#include <linux/kernel.h> 42#include <linux/kernel.h>
43#include <linux/ktime.h>
43#include <linux/types.h> 44#include <linux/types.h>
44#include <linux/time.h> 45#include <linux/time.h>
45#include <linux/skbuff.h> 46#include <linux/skbuff.h>
@@ -174,7 +175,7 @@ struct stir_cb {
174 __u8 *fifo_status; 175 __u8 *fifo_status;
175 176
176 iobuff_t rx_buff; /* receive unwrap state machine */ 177 iobuff_t rx_buff; /* receive unwrap state machine */
177 struct timeval rx_time; 178 ktime_t rx_time;
178 int receiving; 179 int receiving;
179 struct urb *rx_urb; 180 struct urb *rx_urb;
180}; 181};
@@ -650,15 +651,12 @@ static int fifo_txwait(struct stir_cb *stir, int space)
650static void turnaround_delay(const struct stir_cb *stir, long us) 651static void turnaround_delay(const struct stir_cb *stir, long us)
651{ 652{
652 long ticks; 653 long ticks;
653 struct timeval now;
654 654
655 if (us <= 0) 655 if (us <= 0)
656 return; 656 return;
657 657
658 do_gettimeofday(&now); 658 us -= ktime_us_delta(ktime_get(), stir->rx_time);
659 if (now.tv_sec - stir->rx_time.tv_sec > 0) 659
660 us -= USEC_PER_SEC;
661 us -= now.tv_usec - stir->rx_time.tv_usec;
662 if (us < 10) 660 if (us < 10)
663 return; 661 return;
664 662
@@ -823,8 +821,8 @@ static void stir_rcv_irq(struct urb *urb)
823 pr_debug("receive %d\n", urb->actual_length); 821 pr_debug("receive %d\n", urb->actual_length);
824 unwrap_chars(stir, urb->transfer_buffer, 822 unwrap_chars(stir, urb->transfer_buffer,
825 urb->actual_length); 823 urb->actual_length);
826 824
827 do_gettimeofday(&stir->rx_time); 825 stir->rx_time = ktime_get();
828 } 826 }
829 827
830 /* kernel thread is stopping receiver don't resubmit */ 828 /* kernel thread is stopping receiver don't resubmit */
@@ -876,7 +874,7 @@ static int stir_net_open(struct net_device *netdev)
876 874
877 skb_reserve(stir->rx_buff.skb, 1); 875 skb_reserve(stir->rx_buff.skb, 1);
878 stir->rx_buff.head = stir->rx_buff.skb->data; 876 stir->rx_buff.head = stir->rx_buff.skb->data;
879 do_gettimeofday(&stir->rx_time); 877 stir->rx_time = ktime_get();
880 878
881 stir->rx_urb = usb_alloc_urb(0, GFP_KERNEL); 879 stir->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
882 if (!stir->rx_urb) 880 if (!stir->rx_urb)