From patchwork Sat Mar 21 20:59:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Cochran X-Patchwork-Id: 453041 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 97EE2140146 for ; Sun, 22 Mar 2015 08:07:36 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=KH1MCxnh; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751693AbbCUVAI (ORCPT ); Sat, 21 Mar 2015 17:00:08 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:35025 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751630AbbCUVAD (ORCPT ); Sat, 21 Mar 2015 17:00:03 -0400 Received: by wibdy8 with SMTP id dy8so15712941wib.0; Sat, 21 Mar 2015 14:00:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+Aemp7YLDsH25NiGCNuDbn3sJZ8sZly8FVkqOtiQom4=; b=KH1MCxnh2Wpr3GiWkJKa2Uun5mi2qxjxL+kdZMl2a8rsDL+RQhiskRM/FCT/nb4Hfc bXXpdqZ4KgBTOz+sNLamBfT/hbBvUAcJNRCcG0kXEp84DEXcRLrs/dRMwJeCWyqY2Z0P dpnYevAUTeTZdY7VK84KgTvSBY+HpSqV50SdRRwSglMK0tMPJdAzirFHhak6o9pUZAS+ HM6uMXMDnKlrYi2PLuH/CisBmbIMDzOy0Cl8PQWmaCCeh8E6joYxCCA11tpvY2C0LdJ2 F8UlDgSe9U/tYo6fj2J7QuHwOmempX7Ir4I8IOAQPNyVWeoVs8PP5Fkc8RK9IjIraLeD cmXA== X-Received: by 10.194.78.144 with SMTP id b16mr168490914wjx.18.1426971601788; Sat, 21 Mar 2015 14:00:01 -0700 (PDT) Received: from hoboy.home (194-96-185-227.adsl.highway.telekom.at. [194.96.185.227]) by mx.google.com with ESMTPSA id dn7sm3916401wid.12.2015.03.21.13.59.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Mar 2015 14:00:01 -0700 (PDT) From: Richard Cochran To: Cc: , Amir Vadai , Ariel Elior , Arnd Bergmann , Baolin Wang , Ben Hutchings , Bruce Allan , Carolyn Wyborny , Chris Metcalf , David Miller , Frank Li , Giuseppe Cavallaro , Jeff Kirsher , John Stultz , Luwei Zhou , Matthew Vick , Michael Chan , Prashant Sreedharan , Shradha Shah , Solarflare linux maintainers , Sonic Zhang , =?UTF-8?q?Stefan=20S=C3=B8rensen?= , Thomas Gleixner , Tom Lendacky Subject: [RFC net-next 02/22] ptp: use the 64 bit gettime method for the SYS_OFFSET ioctl. Date: Sat, 21 Mar 2015 21:59:32 +0100 Message-Id: <614890e5bb7c29b027fcecf3efc7d7fdf935735c.1426970294.git.richardcochran@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch changes the code to use the new method whenever implemented by the PHC driver. Signed-off-by: Richard Cochran --- drivers/ptp/ptp_chardev.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index f8a7609..95bcf15 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c @@ -124,7 +124,8 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); struct ptp_clock_info *ops = ptp->info; struct ptp_clock_time *pct; - struct timespec ts; + struct timespec64 ts; + struct timespec t2; int enable, err = 0; unsigned int i, pin_index; @@ -197,16 +198,21 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) } pct = &sysoff->ts[0]; for (i = 0; i < sysoff->n_samples; i++) { - getnstimeofday(&ts); + getnstimeofday64(&ts); pct->sec = ts.tv_sec; pct->nsec = ts.tv_nsec; pct++; - ptp->info->gettime(ptp->info, &ts); + if (ptp->info->gettime64) { + ptp->info->gettime64(ptp->info, &ts); + } else { + ptp->info->gettime(ptp->info, &t2); + ts = timespec_to_timespec64(t2); + } pct->sec = ts.tv_sec; pct->nsec = ts.tv_nsec; pct++; } - getnstimeofday(&ts); + getnstimeofday64(&ts); pct->sec = ts.tv_sec; pct->nsec = ts.tv_nsec; if (copy_to_user((void __user *)arg, sysoff, sizeof(*sysoff)))