diff options
author | Tina Ruchandani <ruchandani.tina@gmail.com> | 2015-05-19 02:08:09 -0400 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2015-06-08 05:49:50 -0400 |
commit | e1d5bbcdc7ca08d8731f5d780f0de342a768d96a (patch) | |
tree | 2ed770c803a290e6c0cc968a9f62ae2f968883cd /drivers/pci/xen-pcifront.c | |
parent | 01b720f3295b6c1b2dcfc1affd0fedc6f5d28c1e (diff) |
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.
Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'drivers/pci/xen-pcifront.c')
-rw-r--r-- | drivers/pci/xen-pcifront.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index 7cfd2db02deb..c4796c81c4af 100644 --- a/drivers/pci/xen-pcifront.c +++ b/drivers/pci/xen-pcifront.c | |||
@@ -20,6 +20,7 @@ | |||
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) | |||
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) | |||
132 | * (in the latter case we end up continually re-executing poll() with a | 132 | * (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) | |||
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"); |