From patchwork Thu Dec 21 18:31:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_Br=C3=BCns?= X-Patchwork-Id: 10128235 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 B4AED60318 for ; Thu, 21 Dec 2017 18:32:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB62429D7C for ; Thu, 21 Dec 2017 18:32:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A01AA29D80; Thu, 21 Dec 2017 18:32:04 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 5989529DBE for ; Thu, 21 Dec 2017 18:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754388AbdLUScC (ORCPT ); Thu, 21 Dec 2017 13:32:02 -0500 Received: from mail-out-1.itc.rwth-aachen.de ([134.130.5.46]:35125 "EHLO mail-out-1.itc.rwth-aachen.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753493AbdLUSb4 (ORCPT ); Thu, 21 Dec 2017 13:31:56 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2ASCgAD/Tta/54agoZbHAEBAQQBAQoBA?= =?us-ascii?q?YM+ggEHg3+ZNIFamWUKhTsChEpDFAEBAQEBAQEBAWsohSQGIw8BRhAlAiYCAlc?= =?us-ascii?q?GDgWKKwSkQ4IniFOCHAEBAQEGAQEBAQEjCQGBBYJwghKDaAyGKYI6gg4MMYJlB?= =?us-ascii?q?aNIgROgL4dnllICAgICCQIagTs2IoFPcIJ5hFh3iQEBgRUBAQE?= X-IPAS-Result: =?us-ascii?q?A2ASCgAD/Tta/54agoZbHAEBAQQBAQoBAYM+ggEHg3+ZNIF?= =?us-ascii?q?amWUKhTsChEpDFAEBAQEBAQEBAWsohSQGIw8BRhAlAiYCAlcGDgWKKwSkQ4Ini?= =?us-ascii?q?FOCHAEBAQEGAQEBAQEjCQGBBYJwghKDaAyGKYI6gg4MMYJlBaNIgROgL4dnllI?= =?us-ascii?q?CAgICCQIagTs2IoFPcIJ5hFh3iQEBgRUBAQE?= X-IronPort-AV: E=Sophos;i="5.45,437,1508796000"; d="scan'208";a="30554763" Received: from rwthex-w2-a.rwth-ad.de ([134.130.26.158]) by mail-in-1.itc.rwth-aachen.de with ESMTP; 21 Dec 2017 19:31:55 +0100 Received: from pebbles.fritz.box (92.228.148.100) by rwthex-w2-a.rwth-ad.de (2002:8682:1a9e::8682:1a9e) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Thu, 21 Dec 2017 19:31:51 +0100 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= To: CC: Peter Meerwald-Stadler , =?UTF-8?q?Stefan=20Br=C3=BCns?= , Maciej Purski , , "Andrew F . Davis" , Lars-Peter Clausen , Jonathan Cameron , Hartmut Knaack Subject: [PATCH v2 6/7] iio: adc: ina2xx: Align timestamp with conversion ready flag Date: Thu, 21 Dec 2017 19:31:37 +0100 X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171221183138.361-1-stefan.bruens@rwth-aachen.de> References: <20171221183138.361-1-stefan.bruens@rwth-aachen.de> MIME-Version: 1.0 X-Originating-IP: [92.228.148.100] X-ClientProxiedBy: rwthex-s1-a.rwth-ad.de (2002:8682:1a98::8682:1a98) To rwthex-w2-a.rwth-ad.de (2002:8682:1a9e::8682:1a9e) Message-ID: <78c52a18-e747-4661-963c-d06e05631eda@rwthex-w2-a.rwth-ad.de> 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 As the timestamp is no longer (ab-)used to measure the function run time, it can be taken at the correct time, i.e. when the conversion has finished. Signed-off-by: Stefan BrĂ¼ns --- Changes in v2: None drivers/iio/adc/ina2xx-adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ina2xx-adc.c b/drivers/iio/adc/ina2xx-adc.c index 415e53b5c0a6..b7407ac91b59 100644 --- a/drivers/iio/adc/ina2xx-adc.c +++ b/drivers/iio/adc/ina2xx-adc.c @@ -706,8 +706,6 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev) s64 time; unsigned int alert; - time = iio_get_time_ns(indio_dev); - /* * Because the timer thread and the chip conversion clock * are asynchronous, the period difference will eventually @@ -736,6 +734,8 @@ static int ina2xx_work_buffer(struct iio_dev *indio_dev) } while (!alert); + time = iio_get_time_ns(indio_dev); + /* * Single register reads: bulk_read will not work with ina226/219 * as there is no auto-increment of the register pointer.