From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bjorn Helgaas Subject: Re: [PATCH v2] xen/pcifront: Remove usage of struct timeval Date: Wed, 20 May 2015 08:16:24 -0500 Message-ID: References: <20150519060809.GA27777@tinar> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yv3rc-0006Bm-9P for xen-devel@lists.xenproject.org; Wed, 20 May 2015 13:16:48 +0000 Received: by qcblr10 with SMTP id lr10so22265729qcb.0 for ; Wed, 20 May 2015 06:16:45 -0700 (PDT) In-Reply-To: <20150519060809.GA27777@tinar> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tina Ruchandani Cc: Arnd Bergmann , y2038@lists.linaro.org, "linux-pci@vger.kernel.org" , David Vrabel , "xen-devel@lists.xenproject.org" , Boris Ostrovsky List-Id: xen-devel@lists.xenproject.org On Tue, May 19, 2015 at 1:08 AM, Tina Ruchandani wrote: > struct timeval uses a 32-bit field for representing seconds, > which will overflow in the year 2038 and beyond. This patch replaces > struct timeval with 64-bit ktime_t which is 2038 safe. > The patch 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 > Suggested-by: Arnd Bergmann Acked-by: Bjorn Helgaas This isn't PCI-related, so I expect Konrad, Boris, or David will merge this. > -- > Changes in v2: > - Use monotonic time (ktime_get_ns()) instead of real time > since we only care about elapsed delta here. > - Use macro ktime_get_ns() instead of getting ktime_t and > converting it to ns. > --- > drivers/pci/xen-pcifront.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c > index 7cfd2db..c4796c8 100644 > --- a/drivers/pci/xen-pcifront.c > +++ b/drivers/pci/xen-pcifront.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > #include > > #include > @@ -115,7 +116,6 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op) > evtchn_port_t port = pdev->evtchn; > unsigned irq = pdev->irq; > s64 ns, ns_timeout; > - struct timeval tv; > > 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) > * (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. > */ > - do_gettimeofday(&tv); > - ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC; > + ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC; > > xen_clear_irq_pending(irq); > > @@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op) > (unsigned long *)&pdev->sh_info->flags)) { > xen_poll_irq_timeout(irq, jiffies + 3*HZ); > xen_clear_irq_pending(irq); > - do_gettimeofday(&tv); > - ns = timeval_to_ns(&tv); > + ns = ktime_get_ns(); > if (ns > ns_timeout) { > dev_err(&pdev->xdev->dev, > "pciback not responding!!!\n"); > -- > 2.2.0.rc0.207.ga3a616c >