From patchwork Thu Sep 17 21:19:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 7210651 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 550C4BEEC1 for ; Thu, 17 Sep 2015 21:20:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8657D2047B for ; Thu, 17 Sep 2015 21:20:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6769120498 for ; Thu, 17 Sep 2015 21:20:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752408AbbIQVUl (ORCPT ); Thu, 17 Sep 2015 17:20:41 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:59563 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751849AbbIQVU2 (ORCPT ); Thu, 17 Sep 2015 17:20:28 -0400 Received: from wuerfel.lan. ([149.172.15.242]) by mrelayeu.kundenserver.de (mreue102) with ESMTPSA (Nemesis) id 0MOjCA-1ZYqaG49ry-0064Op; Thu, 17 Sep 2015 23:20:15 +0200 From: Arnd Bergmann To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, y2038@lists.linaro.org, Mauro Carvalho Chehab , linux-api@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Hans Verkuil , Arnd Bergmann Subject: [PATCH v2 4/9] [media] exynos4-is: use monotonic timestamps as advertized Date: Thu, 17 Sep 2015 23:19:35 +0200 Message-Id: <1442524780-781677-5-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.1.0.rc2 In-Reply-To: <1442524780-781677-1-git-send-email-arnd@arndb.de> References: <1442524780-781677-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:XUFwfwClZDTGsvme1HNSoRMe8lOKXkQC19jROQKOv0G6rMekDGf mlJchBDmgZTKWMCnsxSgXIF4gy29ZuGzynPc0qzCnif4BQdU1xwM7E0DJ5AMQG5XtIDVmCw Md430i3lFug7kUDM2gMHUHQ7bhUlypIgPWqfg/q4mDbiLqDm4UzsB5hVfNJxuE9CHPPQsTv 26ZuAYCGyXX+vfWstiiKA== X-UI-Out-Filterresults: notjunk:1; V01:K0:2/7mn3MhTY4=:rVpAiVrEafULQcgTVn20OT 7aquNJklysZjA4uAA6Y4xS7yxejmjD5LfC7wem/aNvDXh7KIw3KI3ILJM9fMQJXQfiA0t/mfe 9Y7JF3atfSzh48ATlabETQOnURbDv4QU1fqzyWF5aUQRq7Iwo6daZNY9MOwDnw557cVzfQR5f Idc8YH8XUFeHO/uot6A1LTN+yiSBZQsBxJZ3+YyBP7FXTjTCJA2qYfeKNnlG979Tbh63Z4xB0 YtSr3QNUNNjqg7r6YwjECYOb+LSGb6LY3ZLzm8ahlJhFz+NES3NHnf4xTqK7lg9OjXY6aoopW MEYGvtG+deWqe1L56ZQvGGD1SG6pdg/R8pZ52RqBNLZ68A/YKCsnwwBB/zxtaVvIR10+JD8ug 6uuWgr1l1HYBKIbeGn3vP0lLwSlrmCcRGDBZYbUMpSWwpPO7vaWm2pE4AOHHnenH2tGTfbb64 VHgpNVAD1EOLvhkOWw2cnJKcSOFF5zeTDMs7QCrMHZD+skG4I6fZwEL2uv9W4g13QyV0yjaKd sWXt+Mj24o7Hxd13cIaz9R5PLM3fkW66rz/QQqBKn1OjnAisHbCt5nLlabRBTXAzyyfeC81Br nHJWwgAj3TL7pE1YzHdRYie2/N18iPWQJXFMovg7pXSW70lfBed/mL6Tu65eNI7MrAs6xBvRf 7LYCuBwT8CZIZR1Sc92r9zSmQdM9FERwSvmhxghFRdNCz25lHa8lPcgdoD73vO11us7c= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The exynos4 fimc capture driver claims to use monotonic timestamps but calls ktime_get_real_ts(). This is both an incorrect API use, and a bad idea because of the y2038 problem and the fact that the wall clock time is not reliable for timestamps across suspend or settimeofday(). This changes the driver to use the normal v4l2_get_timestamp() function like all other drivers. Signed-off-by: Arnd Bergmann --- drivers/media/platform/exynos4-is/fimc-capture.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c index cfebf292e15a..776ea6d78d03 100644 --- a/drivers/media/platform/exynos4-is/fimc-capture.c +++ b/drivers/media/platform/exynos4-is/fimc-capture.c @@ -183,8 +183,6 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, int deq_buf) struct v4l2_subdev *csis = p->subdevs[IDX_CSIS]; struct fimc_frame *f = &cap->ctx->d_frame; struct fimc_vid_buffer *v_buf; - struct timeval *tv; - struct timespec ts; if (test_and_clear_bit(ST_CAPT_SHUT, &fimc->state)) { wake_up(&fimc->irq_queue); @@ -193,13 +191,9 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, int deq_buf) if (!list_empty(&cap->active_buf_q) && test_bit(ST_CAPT_RUN, &fimc->state) && deq_buf) { - ktime_get_real_ts(&ts); - v_buf = fimc_active_queue_pop(cap); - tv = &v_buf->vb.v4l2_buf.timestamp; - tv->tv_sec = ts.tv_sec; - tv->tv_usec = ts.tv_nsec / NSEC_PER_USEC; + v4l2_get_timestamp(&v_buf->vb.v4l2_buf.timestamp); v_buf->vb.v4l2_buf.sequence = cap->frame_count++; vb2_buffer_done(&v_buf->vb, VB2_BUF_STATE_DONE);