From patchwork Mon Jun 4 09:17:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10446145 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 9194960375 for ; Mon, 4 Jun 2018 09:17:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82B0528B20 for ; Mon, 4 Jun 2018 09:17:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 774EE28B2B; Mon, 4 Jun 2018 09:17:58 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 1842B28B20 for ; Mon, 4 Jun 2018 09:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751886AbeFDJR5 (ORCPT ); Mon, 4 Jun 2018 05:17:57 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:36405 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751097AbeFDJR4 (ORCPT ); Mon, 4 Jun 2018 05:17:56 -0400 Received: by mail-lf0-f65.google.com with SMTP id u4-v6so24051077lff.3; Mon, 04 Jun 2018 02:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=UGexa2gC1zDdFk8WJTaXI3rqbzOfvPOT7MlW3B1avTQ=; b=PhTwl80hvCq1djljb/cdIffr+qpWNGXH7AXv2ASWOW88Ncabww7IJjW143idplRfN6 r9r8T9bzgmyaxZ4EqNxifE+FueoMSgZMTBbSf5FtzG86rC9hD8F1+CKkh7NVabOWQYZR YZwWLqNOMuwToLmx1UZ7V1oNKJqgTdLy8F6Rv880qEF77jXrtreSZpM6vfZ8ZeI12aJy smZ4axu5pOyEohVNXJjnJxH+qhe2efGcOYMWbckgSo3IofDL+DHSSfhUZH6jmBCBp4QT XhvaE+HBXYkjI5JUq2gy1BVlh2JW965cigD80sFTM2vrHrb4j3e9dBaDY/OthPKpXBh2 KYDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=UGexa2gC1zDdFk8WJTaXI3rqbzOfvPOT7MlW3B1avTQ=; b=ipQe8a6JWbwBxdPlA7RcV3+u2pEdXWys8aVBbyfQwiTLKw3skypbdmnC5fd84H53HV N9sub3Hl0Ikt4FHMrZorhx8PpdJH4KviqMTF5scDvlWh1o1ZRN5eDUNFNvYjArWspEmS 9VdoAIu1HysPG9JgnsIa6gWFW0GREIIb1+m+KAIRFGdTI12ILG1SQVPAsZGVJdwdRnV4 fa9Z+qjZtJaE8gLCuekxjEjFVxOjQNhuxLWFCo8XTOl/jxB2vF8fxPG7iu0oCtlc6ETR QVyeLBaxIUe/C2wfZu2k6n66sT21amt04M7fU084STkp2uM15k0V/2unbKQ1pQFAKpFn hMTg== X-Gm-Message-State: APt69E0ATnERZtcPs4rQzfCr00yHKuNMQWm6EQUDbiSkmTrZIYON5g1X hsIswYCocWVqxggjQ4rsnbt/VLhbX9dAhKuE0+k= X-Google-Smtp-Source: ADUXVKL/GN5wLDs1SCymyOvzgE6o1B6fjLYt7xAPRbvm5hobbY+HjmqT0qEo36Tatv+GL06KP6MmQOfxDhFamUrTgTs= X-Received: by 2002:a2e:99c7:: with SMTP id l7-v6mr2999058ljj.148.1528103874746; Mon, 04 Jun 2018 02:17:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:56c8:0:0:0:0:0 with HTTP; Mon, 4 Jun 2018 02:17:54 -0700 (PDT) In-Reply-To: <8ab19b1665b51364c1f7e607f9a69a86fe084d0d.1528102909.git.baolin.wang@linaro.org> References: <8ab19b1665b51364c1f7e607f9a69a86fe084d0d.1528102909.git.baolin.wang@linaro.org> From: Arnd Bergmann Date: Mon, 4 Jun 2018 11:17:54 +0200 X-Google-Sender-Auth: ZoS6WmxDh0hLKCKg4Q0HdaTRUzc Message-ID: Subject: Re: [PATCH] iio: Convert to use timespec64 variables to get a time stamp To: Baolin Wang Cc: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Mark Brown , linux-iio@vger.kernel.org, Linux Kernel Mailing List , Thomas Gleixner 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 On Mon, Jun 4, 2018 at 11:07 AM, Baolin Wang wrote: > The struct timespec is not y2038 safe on 32bit machines, thus this patch > converts to use timespec64 variables and related APIs to get a time stamp > for events etc. > > Signed-off-by: Baolin Wang Hi Baolin, I was waiting with this for the new header file cleanup to land. Thomas merged that one recently, so now we should be able to do this more nicely: --- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);