From patchwork Mon May 11 02:44:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tina Ruchandani X-Patchwork-Id: 6372691 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 83880BEEE1 for ; Mon, 11 May 2015 02:45:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA475203AC for ; Mon, 11 May 2015 02:45:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 933EF202DD for ; Mon, 11 May 2015 02:45:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752129AbbEKCoz (ORCPT ); Sun, 10 May 2015 22:44:55 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:35894 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751739AbbEKCoy (ORCPT ); Sun, 10 May 2015 22:44:54 -0400 Received: by pdea3 with SMTP id a3so136488852pde.3 for ; Sun, 10 May 2015 19:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=VhJJSy3n7xwkMUuuOJyCXiWaSSmUiXBvNFSUkADHLmk=; b=XPmiFUygtgicuafvbPKLy9aHQ/peuRvjKA9td8bsgE54Ce7Qv8cXfHjEZPglonjpjp 5/1zvrOqqvmhSBZOjXySNHDwCFRMw5Qt46+VIb6EA8hiwsrV2UYohfVyyuJQL1ymjH6d mA+5jvIRsUXQDvztMF9DxXZx4ktJiwCR//8ZgWdSFwGLwanPtyuBNIMsIH2FUcZ3vgUx sVx1VCkC8NlE5u6OOFXPgfJ3vnNCDPyYaiYVP7z7Uw4JWs11E6oAiOG17YwiQhrn/jM8 NIrxTioMiQW0rr/LmB+xll8OXCMRl1rs0vRqytGw9rIo/09stWhA6DnlGb6EF+xxbkQM dAyA== X-Received: by 10.70.56.98 with SMTP id z2mr15247547pdp.120.1431312293453; Sun, 10 May 2015 19:44:53 -0700 (PDT) Received: from tinar ([14.97.39.70]) by mx.google.com with ESMTPSA id e12sm11407771pap.40.2015.05.10.19.44.52 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 10 May 2015 19:44:52 -0700 (PDT) Date: Mon, 11 May 2015 08:14:48 +0530 From: Tina Ruchandani To: Arnd Bergmann Cc: y2038@lists.linaro.org, Konrad Rzeszutek Wilk , Boris Ostrovsky , David Vrabel , Bjorn Helgaas , xen-devel@lists.xenproject.org, linux-pci@vger.kernel.org Subject: [PATCH] xen/pcifront: Remove usage of struct timeval Message-ID: <20150511024448.GA2836@tinar> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/pci/xen-pcifront.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index 7cfd2db..43d1d6c 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,7 @@ 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; + ktime_t tv; spin_lock_irqsave(&pdev->sh_info_lock, irq_flags); @@ -132,8 +133,8 @@ 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; + tv = ktime_get_real(); + ns_timeout = ktime_to_ns(tv) + 2 * (s64)NSEC_PER_SEC; xen_clear_irq_pending(irq); @@ -141,8 +142,8 @@ 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); + tv = ktime_get_real(); + ns = ktime_to_ns(tv); if (ns > ns_timeout) { dev_err(&pdev->xdev->dev, "pciback not responding!!!\n");