Received: by 10.192.165.148 with SMTP id m20csp3077991imm; Mon, 7 May 2018 06:19:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpEQ5DF/pzkDymLR0030IRnOrcs19r4yw+7XJ/ZTPxqpEadXA2B2uvfFy07wZ0VEpZjkh5f X-Received: by 2002:a17:902:ab8d:: with SMTP id f13-v6mr37749580plr.81.1525699183327; Mon, 07 May 2018 06:19:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525699183; cv=none; d=google.com; s=arc-20160816; b=Ua1B+6tNcs5LDbbkaiV9tcjRzHwBBe+3Q1gCVwWJfmTshutlgxuhncjEt/dxoS9PKJ whv7frMzP6ZaXBpzSi5pdMgtn3fZwbcpsrfngFWPfo+g0tbkbG/8qAe7cebEUmPpngoB RFgGmL+7A1dpIVu8/00pmYMuBuMC1WOV7g9Fa7tv7A/qDnTJvmBUBTzFb0KaRQEJGbRS nuVj7yoNpl1bTUzQA7L1CkbqFtp/kU7aK6WWynjQdTSGPYOFDMCHIUnpda6KMFCCn0l8 LXkNCWdhADLXnSXOSpagQcILzzUv+Cu3Ls/wJP2G72CHkeW8iZXW2Z52LSAQIUNMSadO cOxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=tlMPBhcPZV/VwTWE3YBLLg71kO2iJrRPGbHtyeJ9VVI=; b=LyyA7sLtVAJhdBiooywpB1ccSOcmT7lI0ORJ6CVbPE5eVbrjjVxSRBoY3fcd+8IJIp /PgFBWvbIZA2ltXVyRv/6aiHVDe7Er/0UqHkdH6jZxmqhH/M2Lld1s0TagxIApPEMmCj nONtsUr0TEF/jRuRnTzz70IoJhTbm0jhBV87xjVyFuXCkvSrkBJBZXradPo9EWbRlPhU TzXYhdIMmL/UwQQG4tgslf5Cv8OleQ8BSJgRQoxzoFt08TcHnsWDO9tDc/PR/W5i9A2r WZjYNpdmd4ZGweyhnCN98cxDeeGyx98w1ohBB6CCEMABmPrFR4jyrNRr44EvlQHnz/IP 9IBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t7-v6si17647169pgc.609.2018.05.07.06.19.28; Mon, 07 May 2018 06:19:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752335AbeEGNTM (ORCPT + 99 others); Mon, 7 May 2018 09:19:12 -0400 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:38380 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751976AbeEGNTJ (ORCPT ); Mon, 7 May 2018 09:19:09 -0400 Received: from valkosipuli.localdomain (valkosipuli.retiisi.org.uk [IPv6:2001:1bc8:1a6:d3d5::80:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id F37B2634C50; Mon, 7 May 2018 16:19:06 +0300 (EEST) Received: from sakke by valkosipuli.localdomain with local (Exim 4.89) (envelope-from ) id 1fFg2k-0003ha-LQ; Mon, 07 May 2018 16:19:06 +0300 Date: Mon, 7 May 2018 16:19:06 +0300 From: Sakari Ailus To: Laurent Pinchart Cc: Arnd Bergmann , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] [RESEND] [media] omap3isp: support 64-bit version of omap3isp_stat_data Message-ID: <20180507131906.rdvcmvim5gvi5odk@valkosipuli.retiisi.org.uk> References: <20180425213044.1535393-1-arnd@arndb.de> <2922276.lKgGZtlCEW@avalon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2922276.lKgGZtlCEW@avalon> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 07, 2018 at 04:17:32PM +0300, Laurent Pinchart wrote: > Hi Arnd, > > Thank you for the patch. > > On Thursday, 26 April 2018 00:30:10 EEST Arnd Bergmann wrote: > > C libraries with 64-bit time_t use an incompatible format for > > struct omap3isp_stat_data. This changes the kernel code to > > support either version, by moving over the normal handling > > to the 64-bit variant, and adding compatiblity code to handle > > the old binary format with the existing ioctl command code. > > > > Fortunately, the command code includes the size of the structure, > > so the difference gets handled automatically. In the process of > > eliminating the references to 'struct timeval' from the kernel, > > I also change the way the timestamp is generated internally, > > basically by open-coding the v4l2_get_timestamp() call. > > > > Cc: Laurent Pinchart > > Cc: Sakari Ailus > > Signed-off-by: Arnd Bergmann > > --- > > I submitted this one in November and asked again in January, > > still waiting for a review so it can be applied. > > --- > > drivers/media/platform/omap3isp/isph3a_aewb.c | 2 ++ > > drivers/media/platform/omap3isp/isph3a_af.c | 2 ++ > > drivers/media/platform/omap3isp/isphist.c | 2 ++ > > drivers/media/platform/omap3isp/ispstat.c | 21 +++++++++++++++++++-- > > drivers/media/platform/omap3isp/ispstat.h | 4 +++- > > include/uapi/linux/omap3isp.h | 22 ++++++++++++++++++++++ > > 6 files changed, 50 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/media/platform/omap3isp/isph3a_aewb.c > > b/drivers/media/platform/omap3isp/isph3a_aewb.c index > > d44626f20ac6..3c82dea4d375 100644 > > --- a/drivers/media/platform/omap3isp/isph3a_aewb.c > > +++ b/drivers/media/platform/omap3isp/isph3a_aewb.c > > @@ -250,6 +250,8 @@ static long h3a_aewb_ioctl(struct v4l2_subdev *sd, > > unsigned int cmd, void *arg) return omap3isp_stat_config(stat, arg); > > case VIDIOC_OMAP3ISP_STAT_REQ: > > return omap3isp_stat_request_statistics(stat, arg); > > + case VIDIOC_OMAP3ISP_STAT_REQ_TIME32: > > + return omap3isp_stat_request_statistics_time32(stat, arg); > > case VIDIOC_OMAP3ISP_STAT_EN: { > > unsigned long *en = arg; > > return omap3isp_stat_enable(stat, !!*en); > > diff --git a/drivers/media/platform/omap3isp/isph3a_af.c > > b/drivers/media/platform/omap3isp/isph3a_af.c index > > 99bd6cc21d86..4da25c84f0c6 100644 > > --- a/drivers/media/platform/omap3isp/isph3a_af.c > > +++ b/drivers/media/platform/omap3isp/isph3a_af.c > > @@ -314,6 +314,8 @@ static long h3a_af_ioctl(struct v4l2_subdev *sd, > > unsigned int cmd, void *arg) return omap3isp_stat_config(stat, arg); > > case VIDIOC_OMAP3ISP_STAT_REQ: > > return omap3isp_stat_request_statistics(stat, arg); > > + case VIDIOC_OMAP3ISP_STAT_REQ_TIME32: > > + return omap3isp_stat_request_statistics_time32(stat, arg); > > case VIDIOC_OMAP3ISP_STAT_EN: { > > int *en = arg; > > return omap3isp_stat_enable(stat, !!*en); > > diff --git a/drivers/media/platform/omap3isp/isphist.c > > b/drivers/media/platform/omap3isp/isphist.c index > > a4ed5d140d48..d4be3d0e06f9 100644 > > --- a/drivers/media/platform/omap3isp/isphist.c > > +++ b/drivers/media/platform/omap3isp/isphist.c > > @@ -435,6 +435,8 @@ static long hist_ioctl(struct v4l2_subdev *sd, unsigned > > int cmd, void *arg) return omap3isp_stat_config(stat, arg); > > case VIDIOC_OMAP3ISP_STAT_REQ: > > return omap3isp_stat_request_statistics(stat, arg); > > + case VIDIOC_OMAP3ISP_STAT_REQ_TIME32: > > + return omap3isp_stat_request_statistics_time32(stat, arg); > > case VIDIOC_OMAP3ISP_STAT_EN: { > > int *en = arg; > > return omap3isp_stat_enable(stat, !!*en); > > diff --git a/drivers/media/platform/omap3isp/ispstat.c > > b/drivers/media/platform/omap3isp/ispstat.c index > > 47cbc7e3d825..5967dfd0a9f7 100644 > > --- a/drivers/media/platform/omap3isp/ispstat.c > > +++ b/drivers/media/platform/omap3isp/ispstat.c > > @@ -18,6 +18,7 @@ > > #include > > #include > > #include > > +#include > > Could you please keep the headers alphabetically sorted ? > > > > > #include "isp.h" > > > > @@ -237,7 +238,7 @@ static int isp_stat_buf_queue(struct ispstat *stat) > > if (!stat->active_buf) > > return STAT_NO_BUF; > > > > - v4l2_get_timestamp(&stat->active_buf->ts); > > + ktime_get_ts64(&stat->active_buf->ts); > > > > stat->active_buf->buf_size = stat->buf_size; > > if (isp_stat_buf_check_magic(stat, stat->active_buf)) { > > @@ -500,7 +501,8 @@ int omap3isp_stat_request_statistics(struct ispstat > > *stat, return PTR_ERR(buf); > > } > > > > - data->ts = buf->ts; > > + data->ts.tv_sec = buf->ts.tv_sec; > > + data->ts.tv_usec = buf->ts.tv_nsec / NSEC_PER_USEC; > > data->config_counter = buf->config_counter; > > data->frame_number = buf->frame_number; > > data->buf_size = buf->buf_size; > > @@ -512,6 +514,21 @@ int omap3isp_stat_request_statistics(struct ispstat > > *stat, return 0; > > } > > > > +int omap3isp_stat_request_statistics_time32(struct ispstat *stat, > > + struct omap3isp_stat_data_time32 *data) > > +{ > > + struct omap3isp_stat_data data64; > > + int ret; > > + > > + ret = omap3isp_stat_request_statistics(stat, &data64); > > + > > + data->ts.tv_sec = data64.ts.tv_sec; > > + data->ts.tv_usec = data64.ts.tv_usec; > > + memcpy(&data->buf, &data64.buf, sizeof(*data) - sizeof(data->ts)); > > + > > + return ret; > > We could return immediately after omap3isp_stat_request_statistics() if the > function fails, but that's no big deal, the error path is clearly a cold path. > > > +} > > + > > /* > > * omap3isp_stat_config - Receives new statistic engine configuration. > > * @new_conf: Pointer to config structure. > > diff --git a/drivers/media/platform/omap3isp/ispstat.h > > b/drivers/media/platform/omap3isp/ispstat.h index > > 6d9b0244f320..923b38cfc682 100644 > > --- a/drivers/media/platform/omap3isp/ispstat.h > > +++ b/drivers/media/platform/omap3isp/ispstat.h > > @@ -39,7 +39,7 @@ struct ispstat_buffer { > > struct sg_table sgt; > > void *virt_addr; > > dma_addr_t dma_addr; > > - struct timeval ts; > > + struct timespec64 ts; > > u32 buf_size; > > u32 frame_number; > > u16 config_counter; > > @@ -130,6 +130,8 @@ struct ispstat_generic_config { > > int omap3isp_stat_config(struct ispstat *stat, void *new_conf); > > int omap3isp_stat_request_statistics(struct ispstat *stat, > > struct omap3isp_stat_data *data); > > +int omap3isp_stat_request_statistics_time32(struct ispstat *stat, > > + struct omap3isp_stat_data_time32 *data); > > int omap3isp_stat_init(struct ispstat *stat, const char *name, > > const struct v4l2_subdev_ops *sd_ops); > > void omap3isp_stat_cleanup(struct ispstat *stat); > > diff --git a/include/uapi/linux/omap3isp.h b/include/uapi/linux/omap3isp.h > > index 1a920145db04..87b55755f4ff 100644 > > --- a/include/uapi/linux/omap3isp.h > > +++ b/include/uapi/linux/omap3isp.h > > @@ -55,6 +55,8 @@ > > _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct omap3isp_h3a_af_config) > > #define VIDIOC_OMAP3ISP_STAT_REQ \ > > _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data) > > +#define VIDIOC_OMAP3ISP_STAT_REQ_TIME32 \ > > + _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data_time32) > > #define VIDIOC_OMAP3ISP_STAT_EN \ > > _IOWR('V', BASE_VIDIOC_PRIVATE + 7, unsigned long) > > > > @@ -165,7 +167,14 @@ struct omap3isp_h3a_aewb_config { > > * @config_counter: Number of the configuration associated with the data. > > */ > > struct omap3isp_stat_data { > > +#ifdef __KERNEL__ > > + struct { > > + __s64 tv_sec; > > + __s64 tv_usec; > > + } ts; > > I share Sakari's comment about this method implying a little-endian system, > but as the SoCs that integrate this device are all little-endian, that's not a > problem in practice. > > Reviewed-by: Laurent Pinchart > > If you agree with the small comment about header ordering, let's get this > patch finally merged. I can make the change locally in my tree, no need to resend. Thanks. -- Sakari Ailus e-mail: sakari.ailus@iki.fi