From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751799AbbCUVAO (ORCPT ); Sat, 21 Mar 2015 17:00:14 -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 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: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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))) -- 1.7.10.4