From patchwork Mon Jun 18 15:31:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10472097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EBAB4601D7 for ; Mon, 18 Jun 2018 15:32:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB1B528A32 for ; Mon, 18 Jun 2018 15:32:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE14E28A38; Mon, 18 Jun 2018 15:32:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 240AC28A35 for ; Mon, 18 Jun 2018 15:32:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753570AbeFRPcs (ORCPT ); Mon, 18 Jun 2018 11:32:48 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:35377 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752849AbeFRPcr (ORCPT ); Mon, 18 Jun 2018 11:32:47 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0MMWH0-1fZssn3R3G-008KPX; Mon, 18 Jun 2018 17:31:55 +0200 From: Arnd Bergmann To: Jonathan Cameron Cc: y2038@lists.linaro.org, Arnd Bergmann , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Randy Dunlap , "Gustavo A. R. Silva" , Matt Fornero , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iio: use timespec64 based interfaces for iio_get_time_ns() Date: Mon, 18 Jun 2018 17:31:36 +0200 Message-Id: <20180618153153.1903178-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:mcVjUPaouPYX8LBmLB4N/DAIM1SQrK8yU+5IYHU2SjZwChs2ZYp 1YUoMQTfpYGViNv4kmfDzuSoXobf9YThAYUMXCTQDDnJR5e/bN0JzbGX77cJgof0Cf9ZZNW tbCfO2SaYDZODmNXgGzeMYLlJ/EOeT2UTY5RCZn9KQR1PbTiFzl5406goiYEXAS4F9UCULI OJBlOUkmhhkmUT/NpBbyw== X-UI-Out-Filterresults: notjunk:1; V01:K0:mrrPjxwudeo=:Nq6hfxiNernp9T9dXexccy +Ilo5cxXNpGft7uMsmoSJxf1F0cOJOHM/vyKZUqXcD1M7aR+oI3ksVhrnAU+T1kRxYRBsHhHu 62qjBzVLZLLMkDjX0diI/f3ICheCk8E3WF8LYJTzFMmbck9sMmtuImv4ktURPr+oBwyiBS3ii LYSpsHxGMDf+smzavNhcdzMpD+/7kyU+F4WEqmNx+jUFATCifZ/UyAmzLqk/dKmgArXOFJa/C KM/eRjN2tTeI/lpku/TmWpLatFBGzmd+hWxjc2wX5puVDVV5udYc1sJ2gV84gLsm4JBitSify K5wSuT3ru0ukvP0Qm+44T6QfbKhhwVlBhKtah6gtfvPjc3WfGtsdxdXlUo9U2zf0nCUxiEsNA 4VopLqh7SJj7v29cj3kHoWw8g4AhCdADHBF6xJtbU4qv0njXf50y39d+ZQZpK7GbyVCUknIG7 /XzU6M4rdVWs9uTJLCxECas+u3Oiu2whlLBQpheKYQppFaILEEupwgHZR5560WhJZl1Iuiehb abXpwkuJTJgbM2m+HnVpKRRVo1tr1cy0oblqS/tjyuy81U+rbbIieOnQ8Tyjnihdg5t2GKKyv E07kFF8CZc3yelXZcAblhcJILhKdOzp6AWSQBHryT1YqVXCld9taZthxSu/twU5daPvPI/EJB tRG1GZF6Y5NX/3F+o6tJqEd79qdDDQTnmPnoK7gI7NnMq5xt/edW1mxDx2i+iUZaJyvw= Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We have replacements for all the deprecated timespec based interfaces now, so this can finally convert iio_get_time_ns() to consistently use the nanosecond or timespec64 based interfaces instead, avoiding the y2038 overflow. Signed-off-by: Arnd Bergmann --- drivers/iio/industrialio-core.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 19bdf3d2962a..fcbe92c34a3d 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -207,35 +207,27 @@ static int iio_device_set_clock(struct iio_dev *indio_dev, clockid_t clock_id) */ s64 iio_get_time_ns(const struct iio_dev *indio_dev) { - struct timespec tp; + struct timespec64 tp; switch (iio_device_get_clock(indio_dev)) { case CLOCK_REALTIME: - ktime_get_real_ts(&tp); - break; + return ktime_get_real_ns(); case CLOCK_MONOTONIC: - ktime_get_ts(&tp); - break; + return ktime_get_ns(); case CLOCK_MONOTONIC_RAW: - getrawmonotonic(&tp); - break; + return ktime_get_raw_ns(); case CLOCK_REALTIME_COARSE: - tp = current_kernel_time(); - break; + return ktime_to_ns(ktime_get_coarse_real()); case CLOCK_MONOTONIC_COARSE: - tp = get_monotonic_coarse(); - break; + ktime_get_coarse_ts64(&tp); + return timespec64_to_ns(&tp); case CLOCK_BOOTTIME: - get_monotonic_boottime(&tp); - break; + return ktime_get_boot_ns(); case CLOCK_TAI: - timekeeping_clocktai(&tp); - break; + return ktime_get_tai_ns(); default: BUG(); } - - return timespec_to_ns(&tp); } EXPORT_SYMBOL(iio_get_time_ns);