History

xen/pcifront: Remove usage of struct timeval

struct timeval uses a 32-bit field for representing seconds, which will overflow in the year 2038 and beyond. Replace struct timeval with 64-bit ktime_t which is 2038 safe. This is part of a larger effort to remove instances of 32-bit timekeeping variables (timeval, time_t and timespec) from the kernel.

Tina Ruchandani committed 11 years ago

Commit e1d5bbc1 parent 01b720f1 file · +3 −5Browse files

Unified · Split

drivers/pci/xen-pcifront.c+3−5
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <linux/workqueue.h>
2121 #include <linux/bitops.h>
2222 #include <linux/time.h>
23+#include <linux/ktime.h>
2324 #include <xen/platform_pci.h>
2425
2526 #include <asm/xen/swiotlb-xen.h>
@@ -115,7 +116,6 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op) · 89 unmodified lines
115116 evtchn_port_t port = pdev->evtchn;
116117 unsigned irq = pdev->irq;
117118 s64 ns, ns_timeout;
118− struct timeval tv;
119119
120120 spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);
121121
@@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op) · 10 unmodified lines
132132 * (in the latter case we end up continually re-executing poll() with a
133133 * timeout in the past). 1s difference gives plenty of slack for error.
134134 */
135− do_gettimeofday(&tv);
136− ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC;
135+ ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC;
137136
138137 xen_clear_irq_pending(irq);
139138
@@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op) · 1 unmodified line
141140 (unsigned long *)&pdev->sh_info->flags)) {
142141 xen_poll_irq_timeout(irq, jiffies + 3*HZ);
143142 xen_clear_irq_pending(irq);
144− do_gettimeofday(&tv);
145− ns = timeval_to_ns(&tv);
143+ ns = ktime_get_ns();
146144 if (ns > ns_timeout) {
147145 dev_err(&pdev->xdev->dev,
148146 "pciback not responding!!!\n");