From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753096AbbIRJKH (ORCPT ); Fri, 18 Sep 2015 05:10:07 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:52548 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790AbbIRJKB (ORCPT ); Fri, 18 Sep 2015 05:10:01 -0400 From: Arnd Bergmann To: Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, y2038@lists.linaro.org, Mauro Carvalho Chehab , linux-api@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: Re: [PATCH v2 7/9] [media] v4l2: introduce v4l2_timeval Date: Fri, 18 Sep 2015 11:09:48 +0200 Message-ID: <8200227.6XAMdOOJfW@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <55FBC5B2.10808@xs4all.nl> References: <1442524780-781677-1-git-send-email-arnd@arndb.de> <1442524780-781677-8-git-send-email-arnd@arndb.de> <55FBC5B2.10808@xs4all.nl> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:PM6oC6eS/Oed1LYVWcdH4LfGQ/qPN0XvF27KVMNXXX4cMXzrNRy ULbaIe61HV2OYmyYIVEERN5+IQBAAgNnh/3KiwH4Zqr9eeKDphHEzXez1irZZXkdgWeoofq sj/M5hhoekslVfgKIa/MEmh/nUA67YyCzlFUezhALYBhwWx4SR7fNgjHhAnns8hwTmgj4US GbRk0/X3rTJ+fg0XgV4Pw== X-UI-Out-Filterresults: notjunk:1;V01:K0:lZ4EKtiVsDI=:vI0E0e6p3fArxwvhhc6JZe 72hPHwR4Syk9eecMPJKrqSb/bOG2VQzUORxkns8iWxPC4hNRbHO3+iJA25+8qBtuxAT8Sz2nq aJDCo2DhQpewaPEo1wN848JfNeeKQLiLcfiOHqhhAckdXQBMfCajKyl5eBWutsPvwUToqmz+K ttxNv1v2N1aREmguC/ndLgWRJnnM0Nj/i3PJhQ/bFSKHwEIWFWncnakVKbec96T/MwNRwJVjo MJM4kJEs47IyX7b7f/DE3nm1jC2WTHRmBU/HDbO7CrPh4PmQdmE9bY0nuWKMyc6q1bV4qqfqH hnEioEFGKOkMwuyqZ1Jc57Z04eE2IaNxw5yRMJuWGzOsOTaU05qS6cfGZjPpXYas1SYSwQgCb MIE7G1MdFEED+27z6vX3+/SPDB7My4kGJb0tKxcAj2YOj4uAOQd6lVPUPg5/ZVbSKvscLKCe+ wiL7HEBiJQHy8vJEVbEb9danZ6zvAvfGLfQ3W8wL0dkfbjS7G1TJjMKPBE4YJ/P/e05oFIImV CW6JkAURL8UOq4OKacIwFjCsGnmaLLItpEOx197UmzQ1ML3Vr+w5aWOQ5WeWLwuXQwdexUBDU Ami4hfJ18nE6rrIkgdAV2Vv8l9BangZIFmSfp8y0voUnDtzKY7TexpLMUaE66GdLBM1KWcE2T XnxiMYSVtFRAUbzgFKcevoLJm3vOIc68l0t8zRJKAgcXHWPD/G75G7zY+aR4tnbeOD+h3ZcYt m9vnFHbiHwkPDnMH Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 18 September 2015 10:05:06 Hans Verkuil wrote: > On 09/17/15 23:19, Arnd Bergmann wrote: > > The v4l2 API uses a 'struct timeval' to communicate time stamps to user > > space. This is broken on 32-bit architectures as soon as we have a C library > > that defines time_t as 64 bit, which then changes the structure layout of > > struct v4l2_buffer. > > > > Since existing user space source code relies on the type to be 'struct > > timeva' and we want to preserve compile-time compatibility when moving > > s/timeva/timeval/ Fixed > > to a new libc, we cannot make user-visible changes to the header file. > > > > In this patch, we change the type of the timestamp to 'struct v4l2_timeval' > > Don't we need a kernel-wide timeval64? Rather than adding a v4l2-specific > struct? I still hope to avoid doing that. All in-kernel users should be changed to use timespec64 or ktime_t, which are always more efficient and accurate. For the system call interface, all timeval APIs are deprecated and have replacements using timespec64 (e.g. clock_gettime() replaces gettimeofday). Only a handful of ioctls pass timeval, and so far my impression is that we are better off handling each one separately. The total amount of code we need to add this way should be less than if we have to duplicate all common code functions that today operate on timeval and can eventually get removed. > > diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c > > index 295fde5fdb75..df5daac6d099 100644 > > --- a/drivers/media/platform/vim2m.c > > +++ b/drivers/media/platform/vim2m.c > > @@ -235,7 +235,7 @@ static int device_process(struct vim2m_ctx *ctx, > > in_vb->v4l2_buf.sequence = q_data->sequence++; > > memcpy(&out_vb->v4l2_buf.timestamp, > > &in_vb->v4l2_buf.timestamp, > > - sizeof(struct timeval)); > > + sizeof(struct v4l2_timeval)); > > if (in_vb->v4l2_buf.flags & V4L2_BUF_FLAG_TIMECODE) > > memcpy(&out_vb->v4l2_buf.timecode, &in_vb->v4l2_buf.timecode, > > sizeof(struct v4l2_timecode)); > > See https://patchwork.linuxtv.org/patch/31405/ > > I'll merge that one for 4.4 very soon. Ok. Arnd