Commit e1d5bbcd authored by Tina Ruchandani's avatar Tina Ruchandani Committed by David Vrabel

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: default avatarTina Ruchandani <ruchandani.tina@gmail.com>
Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
parent 01b720f3
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/ktime.h>
#include <xen/platform_pci.h> #include <xen/platform_pci.h>
#include <asm/xen/swiotlb-xen.h> #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,7 +116,6 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
evtchn_port_t port = pdev->evtchn; evtchn_port_t port = pdev->evtchn;
unsigned irq = pdev->irq; unsigned irq = pdev->irq;
s64 ns, ns_timeout; s64 ns, ns_timeout;
struct timeval tv;
spin_lock_irqsave(&pdev->sh_info_lock, irq_flags); spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);
...@@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op) ...@@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
* (in the latter case we end up continually re-executing poll() with a * (in the latter case we end up continually re-executing poll() with a
* timeout in the past). 1s difference gives plenty of slack for error. * timeout in the past). 1s difference gives plenty of slack for error.
*/ */
do_gettimeofday(&tv); ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC;
ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC;
xen_clear_irq_pending(irq); xen_clear_irq_pending(irq);
...@@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op) ...@@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
(unsigned long *)&pdev->sh_info->flags)) { (unsigned long *)&pdev->sh_info->flags)) {
xen_poll_irq_timeout(irq, jiffies + 3*HZ); xen_poll_irq_timeout(irq, jiffies + 3*HZ);
xen_clear_irq_pending(irq); xen_clear_irq_pending(irq);
do_gettimeofday(&tv); ns = ktime_get_ns();
ns = timeval_to_ns(&tv);
if (ns > ns_timeout) { if (ns > ns_timeout) {
dev_err(&pdev->xdev->dev, dev_err(&pdev->xdev->dev,
"pciback not responding!!!\n"); "pciback not responding!!!\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment