From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753155AbbC2VMo (ORCPT ); Sun, 29 Mar 2015 17:12:44 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:36275 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752938AbbC2VM1 (ORCPT ); Sun, 29 Mar 2015 17:12:27 -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 , Jacob Keller , Jeff Kirsher , John Stultz , Luwei Zhou , Matthew Vick , Michael Chan , Prashant Sreedharan , Rayagond K , Shradha Shah , Solarflare linux maintainers , Sonic Zhang , =?UTF-8?q?Stefan=20S=C3=B8rensen?= , Thomas Gleixner , Tom Lendacky Subject: [PATCH net-next V3 03/23] ptp: use the 64 bit get/set time methods for the posix clock. Date: Sun, 29 Mar 2015 23:11:53 +0200 Message-Id: <922b5ea24b10b9f031a5a4cd2c9bffae428a69cd.1427662907.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 posix clock code to prefer the new methods whenever they are implemented by the PHC drivers. Signed-off-by: Richard Cochran --- drivers/ptp/ptp_clock.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index 296b0ec..df50d5e 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c @@ -107,13 +107,28 @@ static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp) static int ptp_clock_settime(struct posix_clock *pc, const struct timespec *tp) { struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); - return ptp->info->settime(ptp->info, tp); + struct timespec64 ts = timespec_to_timespec64(*tp); + + return ptp->info->settime64 ? + ptp->info->settime64(ptp->info, &ts) : + ptp->info->settime(ptp->info, tp); } static int ptp_clock_gettime(struct posix_clock *pc, struct timespec *tp) { struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); - return ptp->info->gettime(ptp->info, tp); + struct timespec64 ts; + int err; + + if (ptp->info->gettime64) { + err = ptp->info->gettime64(ptp->info, &ts); + if (!err) + *tp = timespec64_to_timespec(ts); + } else { + err = ptp->info->gettime(ptp->info, tp); + } + + return err; } static int ptp_clock_adjtime(struct posix_clock *pc, struct timex *tx) -- 1.7.10.4