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.
Unified · Split
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | #include <linux/workqueue.h> |
| 21 | 21 | #include <linux/bitops.h> |
| 22 | 22 | #include <linux/time.h> |
| 23 | +#include <linux/ktime.h> | |
| 23 | 24 | #include <xen/platform_pci.h> |
| 24 | 25 | |
| 25 | 26 | #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 | ||
| 115 | 116 | evtchn_port_t port = pdev->evtchn; |
| 116 | 117 | unsigned irq = pdev->irq; |
| 117 | 118 | s64 ns, ns_timeout; |
| 118 | − struct timeval tv; | |
| 119 | 119 | |
| 120 | 120 | spin_lock_irqsave(&pdev->sh_info_lock, irq_flags); |
| 121 | 121 | |
| @@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op) · 10 unmodified lines | ||
| 132 | 132 | * (in the latter case we end up continually re-executing poll() with a |
| 133 | 133 | * timeout in the past). 1s difference gives plenty of slack for error. |
| 134 | 134 | */ |
| 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; | |
| 137 | 136 | |
| 138 | 137 | xen_clear_irq_pending(irq); |
| 139 | 138 | |
| @@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op) · 1 unmodified line | ||
| 141 | 140 | (unsigned long *)&pdev->sh_info->flags)) { |
| 142 | 141 | xen_poll_irq_timeout(irq, jiffies + 3*HZ); |
| 143 | 142 | xen_clear_irq_pending(irq); |
| 144 | − do_gettimeofday(&tv); | |
| 145 | − ns = timeval_to_ns(&tv); | |
| 143 | + ns = ktime_get_ns(); | |
| 146 | 144 | if (ns > ns_timeout) { |
| 147 | 145 | dev_err(&pdev->xdev->dev, |
| 148 | 146 | "pciback not responding!!!\n"); |