From patchwork Mon Jun 20 15:39:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9187825 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 352856075F for ; Mon, 20 Jun 2016 15:41:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 210BC23B23 for ; Mon, 20 Jun 2016 15:41:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13E322793B; Mon, 20 Jun 2016 15:41:36 +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 E501D23B23 for ; Mon, 20 Jun 2016 15:41:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752601AbcFTPld (ORCPT ); Mon, 20 Jun 2016 11:41:33 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:65134 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752718AbcFTPlc (ORCPT ); Mon, 20 Jun 2016 11:41:32 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue102) with ESMTPA (Nemesis) id 0LsQ6y-1bLquE1EVs-011wW8; Mon, 20 Jun 2016 17:39:10 +0200 From: Arnd Bergmann To: Mauro Carvalho Chehab Cc: Arnd Bergmann , Laurent Pinchart , mchehab@osg.samsung.com, Hans Verkuil , Sylwester Nawrocki , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4] [media] omap3isp: support 64-bit version of omap3isp_stat_data Date: Mon, 20 Jun 2016 17:39:54 +0200 Message-Id: <20160620154055.2185851-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:Um8oE8i7BAPjyEdnsPSxjviAMvXmTQd0MelP5NUBUFRyHL33/WN 1slEXjgJF7KYydRUzcHQQmtmMoYWYa/gJpoGCk2ZM1jNcEy9QKn3i5RLAaimWfAm5GguHT4 WmeDF//vTif5f7q3V7SdjJpzMNHDF8CwXNBz2mb1/fUCL0x5G5hneRR4Zd5Mw0JmM1VjF2m /rBHG7mT4gl7uWXOX0wKg== X-UI-Out-Filterresults: notjunk:1; V01:K0:N90rI2PLUnQ=:t0n+RnDinHOMbmYNhnPIXL 2YeuSFVIOyX1qelK+E2498WuT536y22TLQDUJj2ckBrmFTSMPO6hF1YPCbEOI1rZzkSCTHaT6 2NuO56XS3WvhB8dBLdIc087R9tzvT0aeo4HpJdlnlk/VFLdCBrq0OGPY6S5JViKF9eXe9m/LF crkl0l5NXnVgNVe6UC+Rn0tdnG3q3hlBNUvJpJ9wQRIBYnY8w61k0sNafvqBZRdh70T7TmSqz ExSVlLchJ7NxStPOkN5uq2kjzW+yAKwv5y9vXs7nhKQC4RrylKscrdIocGaiHRcUPIdrLtni8 m+xdZONQFTo9Kh+jGijc8nCx3HiXD+CI/rOeiIrgIjPVO6kO6emZuZWfecjKO8MG1WroexkOJ ufABj3nD3NdwoDp/atyRAtSTemsPyCldv0jVWGRzCMfpaVa0WnRLiaY7jtq7Fwpzokh2xf6/e hKhil6gY1t4BdR6J9wMT/luYy0U5gENWMKFvJDEvJXL+J1dJW9cr0/M40xT3wZcsJwIirwEiv etHfT3qLgCQyiCUh/1KtqvbqxmKMv8GGLPFYT5F+0a52cU0RBYKByeA6IpbL8mHKSW6DZEyOg rt+8F3txXM5hwTZANYRmrnZUj+sWRA9+WlNfaP3YP+RsnbowePiQVn4QQsD9PyC7vGdjkRA1G S8WnCg8tmrQmYJDo//c+H6LBChOqXP9rLJIFaErBXQiq9fGnz3VD2WK1gVB3g/oNvCtQ= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Arnd Bergmann --- This patch was originally part of a longer series, along with other patches that we still have to rewrite for the generic ioctl interface, but the OMAP specific ioctl commands are completely independent of that, so I think we can just merge this version for 4.8. in v4, I'm fixing a build regression that was introduced v3, which separated this patch from the v4l_timeval type that I had in the earlier versions. --- 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 | 18 +++++++++++++++++- drivers/media/platform/omap3isp/ispstat.h | 2 ++ include/uapi/linux/omap3isp.h | 22 ++++++++++++++++++++++ 6 files changed, 47 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/omap3isp/isph3a_aewb.c b/drivers/media/platform/omap3isp/isph3a_aewb.c index ccaf92f39236..2d567725608f 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 92937f7eecef..2ac02371318b 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 7138b043a4aa..669b97b079ee 100644 --- a/drivers/media/platform/omap3isp/isphist.c +++ b/drivers/media/platform/omap3isp/isphist.c @@ -436,6 +436,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 1b9217d3b1b6..481604e4ec52 100644 --- a/drivers/media/platform/omap3isp/ispstat.c +++ b/drivers/media/platform/omap3isp/ispstat.c @@ -496,7 +496,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_usec; data->config_counter = buf->config_counter; data->frame_number = buf->frame_number; data->buf_size = buf->buf_size; @@ -508,6 +509,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; +} + /* * 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..0afa89de09de 100644 --- a/drivers/media/platform/omap3isp/ispstat.h +++ b/drivers/media/platform/omap3isp/ispstat.h @@ -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 c090cf9249bb..4423525b8c1c 100644 --- a/include/uapi/linux/omap3isp.h +++ b/include/uapi/linux/omap3isp.h @@ -54,6 +54,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) @@ -164,7 +166,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; +#else struct timeval ts; +#endif void __user *buf; __u32 buf_size; __u16 frame_number; @@ -172,6 +181,19 @@ struct omap3isp_stat_data { __u16 config_counter; }; +#ifdef __KERNEL__ +struct omap3isp_stat_data_time32 { + struct { + __s32 tv_sec; + __s32 tv_usec; + } ts; + __u32 buf; + __u32 buf_size; + __u16 frame_number; + __u16 cur_frame; + __u16 config_counter; +}; +#endif /* Histogram related structs */