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
20#include <linux/workqueue.h>20#include <linux/workqueue.h>
21#include <linux/bitops.h>21#include <linux/bitops.h>
22#include <linux/time.h>22#include <linux/time.h>
23#include <linux/ktime.h>
23#include <xen/platform_pci.h>24#include <xen/platform_pci.h>
24 25
25#include <asm/xen/swiotlb-xen.h>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 evtchn_port_t port = pdev->evtchn;116 evtchn_port_t port = pdev->evtchn;
116 unsigned irq = pdev->irq;117 unsigned irq = pdev->irq;
117 s64 ns, ns_timeout;118 s64 ns, ns_timeout;
118 struct timeval tv;
119 119
120 spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);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 * (in the latter case we end up continually re-executing poll() with a132 * (in the latter case we end up continually re-executing poll() with a
133 * timeout in the past). 1s difference gives plenty of slack for error.133 * timeout in the past). 1s difference gives plenty of slack for error.
134 */134 */
135 do_gettimeofday(&tv);135 ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC;
136 ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC;
137 136
138 xen_clear_irq_pending(irq);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 (unsigned long *)&pdev->sh_info->flags)) {140 (unsigned long *)&pdev->sh_info->flags)) {
142 xen_poll_irq_timeout(irq, jiffies + 3*HZ);141 xen_poll_irq_timeout(irq, jiffies + 3*HZ);
143 xen_clear_irq_pending(irq);142 xen_clear_irq_pending(irq);
144 do_gettimeofday(&tv);143 ns = ktime_get_ns();
145 ns = timeval_to_ns(&tv);
146 if (ns > ns_timeout) {144 if (ns > ns_timeout) {
147 dev_err(&pdev->xdev->dev,145 dev_err(&pdev->xdev->dev,
148 "pciback not responding!!!\n");146 "pciback not responding!!!\n");