From patchwork Mon Aug 27 19:56:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145209 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp341601ljw; Mon, 27 Aug 2018 12:57:05 -0700 (PDT) X-Google-Smtp-Source: ANB0VdakNx00jseMXvHrokg9SHTIH6KFkgOeQRS6QeMzQ23pqJ0e4wx89Ire2qAyEXnn2YOJIL1Z X-Received: by 2002:a62:990f:: with SMTP id d15-v6mr15758817pfe.162.1535399825033; Mon, 27 Aug 2018 12:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399825; cv=none; d=google.com; s=arc-20160816; b=H6CwYWlcNi8qrH/X5AbWKTYTwKDBdvBw6MtLq6hKQQ24Jg8Zzhfdnm+q++d5iNUOdq m7ib58GLxl2iFb26rlNUoxoAD3NvxzYMa0aC16SIq0iqtADO6YFipTZN9h6wUG2QXmyk sb9cMHKb2+tZ0kp5QCxD1fnMijhhDZ2AGJqrZjGFcuOfqqcc8RkHu0uQWPB9Ca41vezU NQgtvuMOYJp9FS2ZA0d5ZZwbuW3JSLobBSE9jHXYDbLzmNcwU4z//sX5j/988BUfpBeo /npRNk9CKUTBUXu83E3ALnnmk0LUGgvkbwpcCp9EGwYnYzTgw3ni/fu2QnsOoEmRmxH0 ZcoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=UEiifNQ0iUDWpsA31jQgNXYgcc4DhsRdH8Qsn4VzAII=; b=VJHj+75iM7RAfbo0yJg9XnibQa1YtQKB+WQpXtrdtZboKtVs8PvIbEsJxnCBBkNdri l69c7D1cVZz3TR7eMeFfr6ZM76oVGZZsxTu9DTZ2N6BZAttcrwgolt0MgH9K5iEyvV0T 4fPDl1QMNS3WvxoRjY8NOtTBjAmQBcVWzPcue9avA/jygx1hN6b9IlTknx5olt+Z5WVB kyBrtPfgiYMO+SSuENypQB10b60Ee7cfjukZrD0qdxktgJ55SMAhCGSntRWoT7MF2JW+ ylwAm+ImSi8Wg7wi4qzsJDsbEjUEJvRd79y2o8evUPICqYSDAiReEcroJKpdqhLFbwHp 3sNQ== 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 h9-v6si128016plk.461.2018.08.27.12.57.04; Mon, 27 Aug 2018 12:57:05 -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 S1727265AbeH0XpF (ORCPT + 32 others); Mon, 27 Aug 2018 19:45:05 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:34991 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbeH0XpF (ORCPT ); Mon, 27 Aug 2018 19:45:05 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MVasZ-1gR3Ln3AMR-00YzBc; Mon, 27 Aug 2018 21:56:52 +0200 From: Arnd Bergmann To: linux-media@vger.kernel.org Cc: y2038@lists.linaro.org, awalls@md.metrocast.net, hans.verkuil@cisco.com, mchehab@kernel.org, Arnd Bergmann , Alexander Viro , Mauro Carvalho Chehab , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] media: dvb: fix compat ioctl tramslation Date: Mon, 27 Aug 2018 21:56:21 +0200 Message-Id: <20180827195649.4170969-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:VS+pZMGgNlfsnNJAwaoMK+Q2vIFcxSIuYCX4pv+sU1RdZJ6em6n iTK/Z9W6Gd+Yz5jJv9bp00+JPno33PoGTuQ6VmMr9QxDkHHMzJkiel2BYDnqoqkbxxAp5FV 9GMNNo18bTq7PE8PumixwNOw4S6BXVlKeRIheJcb5aETZDfU2txkOX8U1ZQA6aABzDXBZ2I uHQIPz1nboHlO0NjnkOdw== X-UI-Out-Filterresults: notjunk:1; V01:K0:aGshKQyTFzM=:D8910VkZ+tDRT60GdWtwFp G23mWCF+8LIHz3FI1l0euo1BfXjMHgxe/gP7dm20LbJXoAqHPM7Uj+SuRkPvkrpTcx17d0W7C LEuHNLwG0wm8layj9YCCf0HFhYGgyUX22bSck6Zmds9pZJSl18KAcAId09IcHQTztYPYqMoI6 e7oD5f68JZz7YOnUKbD5FahS4CH2Knpa61OQaHjBuTY29EDQszwg9IewQN1VCTo/xeE3lnbsC E8ce5JeThwvkb6YF9GntdDnyRLlKvzF/CFGLIDH6A6pPFI0f/iayDwUGpx8dVfNV2VzmvBAET hE6w65Nkv199ZQftbdtvpOZ+rr5AU8jqXCueeRFwS+tY78VddDfFzLFAdSlN23xSUHmhysv6X 148Ngw+ZM31QbHTeg7BJIFG0p/EQO5OyhNdoPrUWW9rszJJypaUybheO4V2DXBYBfevV3MJIX HR5A/nfQP/8vnA1aBZSj25E7IB73UfpKxrpd64LCsuofx4/YxDREzHcx/Df6J1iZmLKTCoXfl PGAmQ+LHlAOmjK11caqi26mBIDJKT+dq8rKeT+PY7s5x052zAnQQNxhpkBWbEL93rfbDsu/+c HR0ilXfvxHDBzvidoY22O3Pd30NdaKEmqkXDwP61HUjZ5Z8Wq75NWoxfIWLmo4+rCmSeTiU6c vcb/IoxDJ1fp577ralgAWxArNS2+9dtJvkX5V6rOCxngqfC6zd7SBiMEsCAGbqadfBak= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The VIDEO_GET_EVENT and VIDEO_STILLPICTURE was added back in 2005 but it never worked because the command number is wrong. Using the right command number means we have a better chance of them actually doing the right thing, though clearly nobody has ever tried it successfully. I noticed these while auditing the remaining users of compat_time_t for y2038 bugs. This one is fine in that regard, it just never did anything. Fixes: 6e87abd0b8cb ("[DVB]: Add compat ioctl handling.") Signed-off-by: Arnd Bergmann --- fs/compat_ioctl.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -- 2.18.0 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index a9b00942e87d..0c46ce224590 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -141,6 +141,7 @@ struct compat_video_event { unsigned int frame_rate; } u; }; +#define VIDEO_GET_EVENT32 _IOR('o', 28, struct compat_video_event) static int do_video_get_event(struct file *file, unsigned int cmd, struct compat_video_event __user *up) @@ -152,7 +153,7 @@ static int do_video_get_event(struct file *file, if (kevent == NULL) return -EFAULT; - err = do_ioctl(file, cmd, (unsigned long)kevent); + err = do_ioctl(file, VIDEO_GET_EVENT, (unsigned long)kevent); if (!err) { err = convert_in_user(&kevent->type, &up->type); err |= convert_in_user(&kevent->timestamp, &up->timestamp); @@ -171,6 +172,7 @@ struct compat_video_still_picture { compat_uptr_t iFrame; int32_t size; }; +#define VIDEO_STILLPICTURE32 _IOW('o', 30, struct compat_video_still_picture) static int do_video_stillpicture(struct file *file, unsigned int cmd, struct compat_video_still_picture __user *up) @@ -193,7 +195,7 @@ static int do_video_stillpicture(struct file *file, if (err) return -EFAULT; - err = do_ioctl(file, cmd, (unsigned long) up_native); + err = do_ioctl(file, VIDEO_STILLPICTURE, (unsigned long) up_native); return err; } @@ -1305,9 +1307,9 @@ static long do_ioctl_trans(unsigned int cmd, return rtc_ioctl(file, cmd, argp); /* dvb */ - case VIDEO_GET_EVENT: + case VIDEO_GET_EVENT32: return do_video_get_event(file, cmd, argp); - case VIDEO_STILLPICTURE: + case VIDEO_STILLPICTURE32: return do_video_stillpicture(file, cmd, argp); } From patchwork Mon Aug 27 19:56:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145210 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp342009ljw; Mon, 27 Aug 2018 12:57:39 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbRDbqpV1NJxCSo9PLlCghJW/ndYQTZLoybOX9kA4eMqQG16Af+RsMnmIspTCvFJEI3JDRP X-Received: by 2002:a63:380d:: with SMTP id f13-v6mr13483046pga.124.1535399859238; Mon, 27 Aug 2018 12:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399859; cv=none; d=google.com; s=arc-20160816; b=nVZ9u3XZ0nN1l0Qt4eGChSXl7Wh+dZhX4uu0CbvZlW7LS5GfJj7cTRHweBp7j34MF5 O9jNmRnch90AzU6/SYUWVUsjTrxfRYoDBb9acUs2DdBBJ4WGw92EpFhGl3avrFxMcH/Q j4jqj1eSV3/Xey0O+qf97m94pNgNMj1qHSCmyESaLAseSwdQJJOiu9gFZgNGRoho/ek5 WQqL6hTMeJQ3yVjnGl50ZwmNUqStuifRh7/E8HCoIv7lyfhMANTIvtWX8bIMqRS1/R6o ibzZNyK6cyE8sBqvF1DBluNv9mLrJ4DyJAh30rkodMd4jNgSaeI/2IqH+Tbp89lbr0gT zMQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=9PgDszU5rMDcdECsrj0I+t/nul///VfMWBRhWYhKIiM=; b=fvOb0y+NUXPDY7ok9mp1F8sAtrK2t+cb+Mdx7PsmzhSCtIEQ3mbmukMlKBectetP4s /qyKgyOXDdiI9kJagNvOwP3P8Vb+ljutmCAws0nQSiqU8yd7LbQ+6GnOV6v9AJLl8Xcw DbrgqvWSOtmMwHrzlT2cOhlyP1SEh404vpTXsjVfLxPeHMGZGl8kDXHugmp/uLRXka5T apKZkuVPInrmrGQ1i7s+p5yzvRj32RXrfsDocWpvDBsHgPUU4LbwkinS6BOJ8waHFhgJ bPvsryEiOZNnTvNFDsv4kDQw4+cxxAnQBpg5OWvO5v73/GL7RcLhjmwbxzBUeYoly9Tx M7ng== 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 x69-v6si125943pfe.318.2018.08.27.12.57.34; Mon, 27 Aug 2018 12:57:39 -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 S1727397AbeH0Xpe (ORCPT + 32 others); Mon, 27 Aug 2018 19:45:34 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:48751 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbeH0Xpe (ORCPT ); Mon, 27 Aug 2018 19:45:34 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MYtjH-1gPwsS1p6x-00VgKm; Mon, 27 Aug 2018 21:57:23 +0200 From: Arnd Bergmann To: linux-media@vger.kernel.org Cc: y2038@lists.linaro.org, awalls@md.metrocast.net, hans.verkuil@cisco.com, mchehab@kernel.org, Arnd Bergmann , Alexander Viro , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 2/5] media: dvb: dmxdev: move compat_ioctl handling to dmxdev.c Date: Mon, 27 Aug 2018 21:56:22 +0200 Message-Id: <20180827195649.4170969-2-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827195649.4170969-1-arnd@arndb.de> References: <20180827195649.4170969-1-arnd@arndb.de> X-Provags-ID: V03:K1:yTkrd/yrjsF6qtZdVKa/vLv63bnVKSH1NuE9jpO3NEH7s1zpvS7 u2e1jccmxFmgrH3egH+2ieGwATqsEsoyBfgs+obMnr0LDH0EEWKk0bMFlTfahG1aWZjaKE+ 9YRHqv0N2+Qe67nyXso4EuFRSC809cVMPBoDJcdScA649ObAGkLWNe5OpTzC/TXPLikgWH9 a7bKUyHu8+qJf9yaxE8VQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:7zi6iiAcuBM=:oqJE6+6IuJyI7LJucSvC+d 81o5oURdZIDYptMOHo4MvX9FwCoOSUMF8CJYIsgwpLFM3jsCpQ+cLCHR1O9IvggtzgdjJrQEE vR7s0fFID7RSlZAIky8LCZCuXrvZ5dyJl153xEVrlEASgsh4JpTdI5d6p5BK0CaIBmul+QRjV NLP9uxDQ1mtFpFoHHwjlRAtC62I3dvQvbVoOKyrAINaCXyQBwY2KDVWC5nB4R7U+TpQOwnJaP 6N/vnFuKN32oYgEJVS6lqazonAr2+YepxWgTXoZkAXJmLOeKV3dElZoxRPp/DU1+0IoshyYxb SJht8zgbmIDlaYpIxjpSSUsvc0UmtSU/L+SxC47mby5TGiabQ+3RCxkXwvlDgypOxgCdd+7NR t535hc3mv+aEyY8Bp4iu4+4dFRtVtnOvxEypmKIO3HuN0NZ3fv1hU9ccOJz3TonfxY9Rw3+sX 60haI1U2PkjmAeNqYKgZFrEJfK99xdtB+o468ChRKNNy3zijdqafnCOMQ4KcrpjSpEnznOCe7 eJ3uXMd030T3w/HJFVQAOfv1T6YYBTzSOoQERhF/2BjDmpnv5r1HPODCUDv9EUeT0owwXp4lF +QYlw1HXE0DRiNVNJkD5YnFXAvOy75yoosK34Yblic3GomIafpCwJoSzGVEjsxOKo7haZ9g+t 80UkcjvH36L8HuP6dYwOIhcqR0Si/E8yOPuWyxNs0IBI5abcnBNrdQX6ZhC3cxSZa1H4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All dmx ioctls are compatible, and they are only implemented in one file, so we can replace the list of commands in fs/compat_ioctl.c with a single line in dmxdev. Signed-off-by: Arnd Bergmann --- drivers/media/dvb-core/dmxdev.c | 1 + fs/compat_ioctl.c | 12 ------------ 2 files changed, 1 insertion(+), 12 deletions(-) -- 2.18.0 diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c index d548f98c7a67..1544e8cef564 100644 --- a/drivers/media/dvb-core/dmxdev.c +++ b/drivers/media/dvb-core/dmxdev.c @@ -1265,6 +1265,7 @@ static const struct file_operations dvb_demux_fops = { .owner = THIS_MODULE, .read = dvb_demux_read, .unlocked_ioctl = dvb_demux_ioctl, + .compat_ioctl = dvb_demux_ioctl, .open = dvb_demux_open, .release = dvb_demux_release, .poll = dvb_demux_poll, diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 0c46ce224590..e38e6c785459 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -1180,18 +1180,6 @@ COMPATIBLE_IOCTL(AUDIO_CLEAR_BUFFER) COMPATIBLE_IOCTL(AUDIO_SET_ID) COMPATIBLE_IOCTL(AUDIO_SET_MIXER) COMPATIBLE_IOCTL(AUDIO_SET_STREAMTYPE) -COMPATIBLE_IOCTL(DMX_START) -COMPATIBLE_IOCTL(DMX_STOP) -COMPATIBLE_IOCTL(DMX_SET_FILTER) -COMPATIBLE_IOCTL(DMX_SET_PES_FILTER) -COMPATIBLE_IOCTL(DMX_SET_BUFFER_SIZE) -COMPATIBLE_IOCTL(DMX_GET_PES_PIDS) -COMPATIBLE_IOCTL(DMX_GET_STC) -COMPATIBLE_IOCTL(DMX_REQBUFS) -COMPATIBLE_IOCTL(DMX_QUERYBUF) -COMPATIBLE_IOCTL(DMX_EXPBUF) -COMPATIBLE_IOCTL(DMX_QBUF) -COMPATIBLE_IOCTL(DMX_DQBUF) COMPATIBLE_IOCTL(VIDEO_STOP) COMPATIBLE_IOCTL(VIDEO_PLAY) COMPATIBLE_IOCTL(VIDEO_FREEZE) From patchwork Mon Aug 27 19:56:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145211 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp342468ljw; Mon, 27 Aug 2018 12:58:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaPHEjH+n+/KMj9ida89ZOi42p9VyMKqOGoGzO5CESyucPzd6+boleSKzVJzR+hCMCo9K3V X-Received: by 2002:a62:e008:: with SMTP id f8-v6mr15758172pfh.208.1535399888607; Mon, 27 Aug 2018 12:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399888; cv=none; d=google.com; s=arc-20160816; b=Rehe+Ui2nqcynz7ijDd23Y2sfCPcDedXh1EQoRJ7VLDkitJqzL+Atvz4r1DG65UXec 5Yabmtd5aIIrkSaA4tXPvPZ0DMxdSnShLEBXA4HZrn+OVrzUWXonkPBAxozJiTqUNfN9 Ys4GMGTudnkuqrm4jrkRXG58qdPHAA21AesDsi+5mCo4xUkwPA5FULk/+6ooXlSSZcVH t4KONV6iZ9vO4tEv3V+8o2Kg3xMZQoYHY62/yExax4wYGpLnhhjX37+X8cW3YLCSzi3E jo1caS5xaUX6pJQisuUOmNkCDsOsKeK7IZZuWfemfO0N/IgxLACsB0H/XvSq72scCpIG oVpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=u3YN7bEdb6qiutx4g577nl7rkhtRaIcAE77tkkiGpf0=; b=JLvyVmeY6fufplnKx4ts4Drz6+PHL1r1gvQhUQGzdVC/KgZ5m9I6dEfFfCM8Fv7EKA dv/CV/N7rGmSfe0KD/eq+YlqyfU/s+h2XozItvGxSSm4hA6CwQ5kSuaXn18UxakGWdWi WMzHKmdD3jTBHngEXThjzd8T6eYLM5jUCeUOtKWJywxJ4bj+ARxNjpiwVjJGjUT0KFLP Wil/iu8KeaSfDA30EsFuUdZABFLSViMrTCNMfxW/o6CD2Rf4PKKMbC+CB8Scg4qOWxTl SrhkXn92FGfxhPoJylGkYVLmoU3HhaGl2uSN7lcf/1xQWp3VseJ4JfPi3EQHa6l5st/h rowg== 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 17-v6si148769pgl.35.2018.08.27.12.58.08; Mon, 27 Aug 2018 12:58:08 -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 S1727454AbeH0XqI (ORCPT + 32 others); Mon, 27 Aug 2018 19:46:08 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:53547 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbeH0XqH (ORCPT ); Mon, 27 Aug 2018 19:46:07 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0LvhpU-1frAcS1Kyi-017Ual; Mon, 27 Aug 2018 21:57:48 +0200 From: Arnd Bergmann To: linux-media@vger.kernel.org Cc: y2038@lists.linaro.org, awalls@md.metrocast.net, hans.verkuil@cisco.com, mchehab@kernel.org, Arnd Bergmann , Alexander Viro , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 3/5] media: cec: move compat_ioctl handling to cec-api.c Date: Mon, 27 Aug 2018 21:56:23 +0200 Message-Id: <20180827195649.4170969-3-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827195649.4170969-1-arnd@arndb.de> References: <20180827195649.4170969-1-arnd@arndb.de> X-Provags-ID: V03:K1:/0iNC4cnGPCle1odQAbs0mrIC1/OQGCfCsm/8n+B3StjPExvtlz eP6xpslKXsoTBmV1oGPUoXZ54KJtEsBSf1mU2ToNfG1jRIDY6IywLrfAaxWDW5g/bbk3ML1 VxrzKXVplT0znJa1giAUfiVWgJKwvDUgRGWjyYy0mOWo0ahINHQbi+fFVIsk2sy2FAyC5B9 vIhTyYHcwmeMHhOpOPayQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:L/QihZtH7rk=:fTjOl6Xr9HFl+q1frMpSKZ uME5psjSb8/clsVj6Rdw2oXwbEs2bt+6eoZloHbAdMQYlM1je2ZhAhpfuvV/AJ0mhuEbHIrHN 8hafgFMNLZvNrwWJ4YHj8/ySKcDLq/7YYameA6EHYSVTP3IoFvpCDQhKbcFXBlBBFzYnJujKK Odd/8/L6jbavYvn3z/J5rvgd5PcAqA2s8VJvZWE+8s/SGUVwzrwNIZ33I6X8d/MJEG2xgIgE1 K0DcklQ/Q9VrZGPu7x/8+k02ES+p/nI2opMSO8EDd37qYeQopORVI+rJOxo/+SZocngO5teAm 1XPI1u3D5G56xkWyi1MO2uPJXJSRcDNI84ckwtn2AY920+eaJZYDWqAV7bZqqsKAmieredFhA AELlPOh+es2B6clgMuvMo8Uz8vX23xo/Gd1s60MSWo67LogWGcBRWDTQ3Sl8X/jkDEYT12Iop gFgmDRnPL+fVlpls6A5GCIk87h3X/SWOkon+izuAxJfmLM6zijsJ0/+dEMWJZoLNPxZ7hPsM0 vuZngtbC0PPgyDgVtCc9FhWi2J92AuGwxhNI3kj8PWlOArwawpuLDp+tq4Hh8GG3dbl/ulV3l nBTlY69DhGkYEXB1204aPiZsQEPgs2iLz7dsbETzp7PZFTf1FTpKBHUlr2KpNXh7VPI9M0JPA yitNSK9GVjETd63DaiKTD1ZDIPwyY+8+ZHcGQplZHvrPOpJ0W1T7EItmlzDj9uFXOmbQ= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All the CEC ioctls are compatible, and they are only implemented in one driver, so we can simply let this driver handle them natively. Signed-off-by: Arnd Bergmann --- drivers/media/cec/cec-api.c | 1 + fs/compat_ioctl.c | 12 ------------ 2 files changed, 1 insertion(+), 12 deletions(-) -- 2.18.0 diff --git a/drivers/media/cec/cec-api.c b/drivers/media/cec/cec-api.c index b6536bbad530..9067728feb60 100644 --- a/drivers/media/cec/cec-api.c +++ b/drivers/media/cec/cec-api.c @@ -665,6 +665,7 @@ const struct file_operations cec_devnode_fops = { .owner = THIS_MODULE, .open = cec_open, .unlocked_ioctl = cec_ioctl, + .compat_ioctl = cec_ioctl, .release = cec_release, .poll = cec_poll, .llseek = no_llseek, diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index e38e6c785459..33f48933a865 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -1195,18 +1195,6 @@ COMPATIBLE_IOCTL(VIDEO_CLEAR_BUFFER) COMPATIBLE_IOCTL(VIDEO_SET_STREAMTYPE) COMPATIBLE_IOCTL(VIDEO_SET_FORMAT) COMPATIBLE_IOCTL(VIDEO_GET_SIZE) -/* cec */ -COMPATIBLE_IOCTL(CEC_ADAP_G_CAPS) -COMPATIBLE_IOCTL(CEC_ADAP_G_LOG_ADDRS) -COMPATIBLE_IOCTL(CEC_ADAP_S_LOG_ADDRS) -COMPATIBLE_IOCTL(CEC_ADAP_G_PHYS_ADDR) -COMPATIBLE_IOCTL(CEC_ADAP_S_PHYS_ADDR) -COMPATIBLE_IOCTL(CEC_G_MODE) -COMPATIBLE_IOCTL(CEC_S_MODE) -COMPATIBLE_IOCTL(CEC_TRANSMIT) -COMPATIBLE_IOCTL(CEC_RECEIVE) -COMPATIBLE_IOCTL(CEC_DQEVENT) - /* joystick */ COMPATIBLE_IOCTL(JSIOCGVERSION) COMPATIBLE_IOCTL(JSIOCGAXES) From patchwork Mon Aug 27 19:56:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145212 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp342867ljw; Mon, 27 Aug 2018 12:58:34 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ7CtYz/r0zD1dy5JXbf0U3KuDfAfc0pToctMG3UPG9w7at+Rv1srAFXfZDaPycaoga8RpT X-Received: by 2002:a17:902:507:: with SMTP id 7-v6mr14437703plf.232.1535399914174; Mon, 27 Aug 2018 12:58:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399914; cv=none; d=google.com; s=arc-20160816; b=oMSn7XiSjbZTBRf+/NrCig+/ayznMoTzGmozVV4j/fnXKMaypCLTYWGx3LTrspnJNv f5m/ccTy48fCM+4kJlpJu6F0yLwz1Uj3fu5AUWS6WNgKhBPTIqI8vaQHsE8m0MOAALyJ 2eJ3E0cUmJN2EikX6BGZmRvuk4EyBrtnpQMt8kUFPRPxJJ4V3ySFtBQeQ+7gahuORI6m U0vDuCJIMO4exHhgCgdrvgtqgirqA995THnjRedvc9q5vE8VZ+t7iXJmGcylLVui1MS0 dvTbpMCkf7KG/7FIeQoDNRxhyuvl9wfE1vm3DD+A+im2XY+bzYhpOKZW04JVvkWTpepV G09g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=pJvaOkF27gbP62AGbRUqfse6RCgMCqEIuBBJ4WFcdUE=; b=jUqI1ks3J2QxpCidsinUrbHaIbu1vnrA3Jllh6ZIiJ+YrkXtAGCeXNijWcAhwRSSCA a7BaVpq7MzDt/DpmfzUe8gK3cJiCGC1G7Eq39nJtuHM4e68UsPtgvdTeiIfU02u42hPq FViBZdv+a3VIENIcpp11ehe6mXLa+bHyHJDXzZPLTvWW5nrbGsCQiIUdvFSJuXuwntIr dN0ye+MOM0TvUQjPP1DTJs+Kw7/N2WA8+wRmPQkGFBb/nhIeUswY1FAhgbcm7K0R7IBB cxR/3H2AFTsqQ1sEjW0syQVrA9ZTPbSOlQdsPPWzh80eWToTEbXoO7uaPqMtaH7TB1kh rWNA== 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 x37-v6si128146pgl.544.2018.08.27.12.58.33; Mon, 27 Aug 2018 12:58:34 -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 S1727501AbeH0Xqe (ORCPT + 32 others); Mon, 27 Aug 2018 19:46:34 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:33025 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbeH0Xqe (ORCPT ); Mon, 27 Aug 2018 19:46:34 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MFRbQ-1g6Ubj1Fvo-00EQ4F; Mon, 27 Aug 2018 21:58:23 +0200 From: Arnd Bergmann To: linux-media@vger.kernel.org Cc: y2038@lists.linaro.org, awalls@md.metrocast.net, hans.verkuil@cisco.com, mchehab@kernel.org, Arnd Bergmann , Alexander Viro , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 4/5] media: dvb: move most compat_ioctl handling into drivers Date: Mon, 27 Aug 2018 21:56:24 +0200 Message-Id: <20180827195649.4170969-4-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827195649.4170969-1-arnd@arndb.de> References: <20180827195649.4170969-1-arnd@arndb.de> X-Provags-ID: V03:K1:5egVA6rFp+A1tJJqbXrYNEV0eYmpKfGlxI2RarjmXHeNb3BLMAy Klj2dtBADbPHL/U9GT7UtyoMg1AgfPkl9gDA1+vxbICRs7cGJ6vrjobnwE+RzBbVH/wEtUU s50AC+HthkkX8Kk+SQBKaQVG0Wtovvaa8+4RXmQ52L8XwihC+49j55PR4nIcHevYYTYOVhv akzbSQTM0E7O/Vuqlme1Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:5eFbzR6KJ9U=:k6e908XXoWXeoawFadEQV4 N8c+wFv9NOyWinrnyR1v34Z0i+4kfKo7buAIjNv0Da8m+bpnla00Zzo5e5jFhEU0iuyi+Teq5 nKqCQZehrpWpHI6PoLgMstAm3orjJN2/ioJcbBRtY0hkzREqA4WtdUT16uPf/u387qsYlwJPD mSymn8iLSrgJUsvHXmMgoaIzhD7uby7KODvgnACLxjDJefQ094mhNtO/HC2rJ4OIphF/p/Qw6 9Ql4fA7euqh/RJILRz2jwh4jakoSMTDA/zSpzzECk9foXvtXTSKI9tjW9WYW6d++weO/Mkupr 1vYRMsepUGlGFjomcfT2eKNJwyYNYKoLMUQltawu8tgwPMedrh5JPHNZS6oPhaWCmemQgDyxT 6idmW///X5PEQjUXHlc/CTVhwv84TSrRZcxW/W/ypxJAW9CT+FxmpG5MZSpZF4E+dAworxM0Q s2ox/pazZuQ6QxQbMn6ngzk9hS3iLrMoYRZfsraZuU1Jx/EIftSIY31V7MSwwLr0Q9qKbuJvX EFKzI1V63sYLQClvXPfiTpOXEkUqyLRlTl0oO/p882XNhuX4q/OPynjFdRmmfRQNU7P1S6ED+ vhdy9ktFWBXY+sP4Sjqo30LBFito2o5DxURXuompBPadZceiJwWDEUFpSKeGFv9MuXOVX9pBa XHEOgPBcyw5UjboX2TS10CEZ5xvBCKN0Mf9Fa9P5+Wo2pcua7gJHpm7x2WYLK35q+TFI= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Most DVB audio and video ioctl commands are completely compatible, and are implemented by just two drivers: ttpci and ivtv. In both cases, we can use the same ioctl handler for both native and compat ioctl handling, and remove the entries from the global lookup table. In case of ttpci, this directly hooks into the file_operations structure, and for ivtv, we have to set the compat_ioctl32 method in v4l2_file_operations. For all I can tell, setting it to video_ioctl2 will still do the right thing for all commands. Note that for the VIDEO_STILLPICTURE and VIDEO_GET_EVENT commands, a translation handler in fs/compat_ioctl.c is still used. This works because the command numbers are different on 32-bit systems. Signed-off-by: Arnd Bergmann --- drivers/media/pci/ivtv/ivtv-streams.c | 9 ++++++++ drivers/media/pci/ttpci/av7110_av.c | 2 ++ fs/compat_ioctl.c | 31 --------------------------- 3 files changed, 11 insertions(+), 31 deletions(-) -- 2.18.0 diff --git a/drivers/media/pci/ivtv/ivtv-streams.c b/drivers/media/pci/ivtv/ivtv-streams.c index d27c6df97566..a641f20e3f86 100644 --- a/drivers/media/pci/ivtv/ivtv-streams.c +++ b/drivers/media/pci/ivtv/ivtv-streams.c @@ -51,6 +51,9 @@ static const struct v4l2_file_operations ivtv_v4l2_enc_fops = { .write = ivtv_v4l2_write, .open = ivtv_v4l2_open, .unlocked_ioctl = video_ioctl2, +#ifdef CONFIG_COMPAT + .compat_ioctl32 = video_ioctl2, /* for ivtv_default() */ +#endif .release = ivtv_v4l2_close, .poll = ivtv_v4l2_enc_poll, }; @@ -61,6 +64,9 @@ static const struct v4l2_file_operations ivtv_v4l2_dec_fops = { .write = ivtv_v4l2_write, .open = ivtv_v4l2_open, .unlocked_ioctl = video_ioctl2, +#ifdef CONFIG_COMPAT + .compat_ioctl32 = video_ioctl2, /* for ivtv_default() */ +#endif .release = ivtv_v4l2_close, .poll = ivtv_v4l2_dec_poll, }; @@ -69,6 +75,9 @@ static const struct v4l2_file_operations ivtv_v4l2_radio_fops = { .owner = THIS_MODULE, .open = ivtv_v4l2_open, .unlocked_ioctl = video_ioctl2, +#ifdef CONFIG_COMPAT + .compat_ioctl32 = video_ioctl2, /* for ivtv_default() */ +#endif .release = ivtv_v4l2_close, .poll = ivtv_v4l2_enc_poll, }; diff --git a/drivers/media/pci/ttpci/av7110_av.c b/drivers/media/pci/ttpci/av7110_av.c index ef1bc17cdc4d..e738b2cef6f6 100644 --- a/drivers/media/pci/ttpci/av7110_av.c +++ b/drivers/media/pci/ttpci/av7110_av.c @@ -1533,6 +1533,7 @@ static const struct file_operations dvb_video_fops = { .owner = THIS_MODULE, .write = dvb_video_write, .unlocked_ioctl = dvb_generic_ioctl, + .compat_ioctl = dvb_generic_ioctl, .open = dvb_video_open, .release = dvb_video_release, .poll = dvb_video_poll, @@ -1552,6 +1553,7 @@ static const struct file_operations dvb_audio_fops = { .owner = THIS_MODULE, .write = dvb_audio_write, .unlocked_ioctl = dvb_generic_ioctl, + .compat_ioctl = dvb_generic_ioctl, .open = dvb_audio_open, .release = dvb_audio_release, .poll = dvb_audio_poll, diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 33f48933a865..7a1fac9cd1c2 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -1164,37 +1164,6 @@ COMPATIBLE_IOCTL(HIDIOCGFLAG) COMPATIBLE_IOCTL(HIDIOCSFLAG) COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX) COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO) -/* dvb */ -COMPATIBLE_IOCTL(AUDIO_STOP) -COMPATIBLE_IOCTL(AUDIO_PLAY) -COMPATIBLE_IOCTL(AUDIO_PAUSE) -COMPATIBLE_IOCTL(AUDIO_CONTINUE) -COMPATIBLE_IOCTL(AUDIO_SELECT_SOURCE) -COMPATIBLE_IOCTL(AUDIO_SET_MUTE) -COMPATIBLE_IOCTL(AUDIO_SET_AV_SYNC) -COMPATIBLE_IOCTL(AUDIO_SET_BYPASS_MODE) -COMPATIBLE_IOCTL(AUDIO_CHANNEL_SELECT) -COMPATIBLE_IOCTL(AUDIO_GET_STATUS) -COMPATIBLE_IOCTL(AUDIO_GET_CAPABILITIES) -COMPATIBLE_IOCTL(AUDIO_CLEAR_BUFFER) -COMPATIBLE_IOCTL(AUDIO_SET_ID) -COMPATIBLE_IOCTL(AUDIO_SET_MIXER) -COMPATIBLE_IOCTL(AUDIO_SET_STREAMTYPE) -COMPATIBLE_IOCTL(VIDEO_STOP) -COMPATIBLE_IOCTL(VIDEO_PLAY) -COMPATIBLE_IOCTL(VIDEO_FREEZE) -COMPATIBLE_IOCTL(VIDEO_CONTINUE) -COMPATIBLE_IOCTL(VIDEO_SELECT_SOURCE) -COMPATIBLE_IOCTL(VIDEO_SET_BLANK) -COMPATIBLE_IOCTL(VIDEO_GET_STATUS) -COMPATIBLE_IOCTL(VIDEO_SET_DISPLAY_FORMAT) -COMPATIBLE_IOCTL(VIDEO_FAST_FORWARD) -COMPATIBLE_IOCTL(VIDEO_SLOWMOTION) -COMPATIBLE_IOCTL(VIDEO_GET_CAPABILITIES) -COMPATIBLE_IOCTL(VIDEO_CLEAR_BUFFER) -COMPATIBLE_IOCTL(VIDEO_SET_STREAMTYPE) -COMPATIBLE_IOCTL(VIDEO_SET_FORMAT) -COMPATIBLE_IOCTL(VIDEO_GET_SIZE) /* joystick */ COMPATIBLE_IOCTL(JSIOCGVERSION) COMPATIBLE_IOCTL(JSIOCGAXES) From patchwork Mon Aug 27 19:56:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 145213 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp343463ljw; Mon, 27 Aug 2018 12:59:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY7bPIXfRwOmzd+jFhFHAD4vav42tMELZGfg+rdkXk3ErtEDWfAW8XnUDofT0KVcYRq24Rf X-Received: by 2002:a63:c114:: with SMTP id w20-v6mr13045719pgf.234.1535399959907; Mon, 27 Aug 2018 12:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399959; cv=none; d=google.com; s=arc-20160816; b=mGMoiumsJnOOY7E1LPElX8Al4NuQviJ/P8EriOutXcYftkb2t/3QY92q54fX/wIepo eKmSNxCmIKOkFmGqlv/YJ2GDPWJLYEGHwLQ5ShxdiPSkIcekFo2NR/+0gMzYJ/7VIzuv tqO8kNq22iTRnLYptDxoueJvTlj0/tMFeAi9FXUrz24dL9mujQ/mOsBGE+xJRbujz/ff tEiePK+z+YjCCFXc2y5CV8KQOLy3aQ9d47E2h7+tH9yqxC9w8ILnhQOdU4MHKzTptAwh RbUe44Vi+lKOLZGVTdptNoTAwtnnXJ1kKzF9LH/jDkWWd2a6XVBKCPzqAB9roh4kxhK8 pDHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=fUKnCpShPhJdPGRkPID93xXcqPbF0KSUkPkfV6/YTJA=; b=qcnoNHOb9BgdeJOdiNrbDoYbCU/3+ElCg9iNY5UA5lflZTtc2996DifVcwaplfLu4w D68dN7krRBSu2mxgXGyGCdH3dnX9oH/diCboACIzV8cJi0/MgzNU+gyrVU6Aoedd/lhw TB4qWgXZhHMLgnLd7qxwA1kNN6ACN0cKXzb1ocTkKSD6vcmLi0mzcR+E2YUWWPghN4iT 7QB0xg7X9L/XubVUNmUIpQBRJPKpAqGJqUljtRUjLAFkmpDmug7RnpN6gZqwtAAAh/tG Tv+5cVYIYjMaDjuaon6sJUyMMYfqTmAoPZBZsHBFBwW4oETJX1qUyNL1O716ZV4m252x f2Sw== 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 n6-v6si124043pla.398.2018.08.27.12.59.19; Mon, 27 Aug 2018 12:59:19 -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 S1727547AbeH0XrU (ORCPT + 32 others); Mon, 27 Aug 2018 19:47:20 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:39627 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726826AbeH0XrU (ORCPT ); Mon, 27 Aug 2018 19:47:20 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0Li23m-1fZ5cK2Etu-00nD7R; Mon, 27 Aug 2018 21:59:02 +0200 From: Arnd Bergmann To: linux-media@vger.kernel.org Cc: y2038@lists.linaro.org, awalls@md.metrocast.net, hans.verkuil@cisco.com, mchehab@kernel.org, Arnd Bergmann , Alexander Viro , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 5/5] media: dvb: move compat handlers into drivers Date: Mon, 27 Aug 2018 21:56:25 +0200 Message-Id: <20180827195649.4170969-5-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180827195649.4170969-1-arnd@arndb.de> References: <20180827195649.4170969-1-arnd@arndb.de> X-Provags-ID: V03:K1:Ze3Fi6oCnqWzqCWinKMeBn/hCvpKRm5eJE/FVqmNpZddz+b0wdU OxEwqEwGphhAlRsLKacj1/2r4JNV4lj5wU+zsZcstNcreP5rr4BNjoCgKhBAuGe0tszWPNE ToHXUMIA+tkmOgWAIcPHrY+BITffHLTKuoS1q0be9YLktJDvmwzQwX9Q3cGfmnrHtzZvCS2 mlShDy45z/DsLuIYpKhjw== X-UI-Out-Filterresults: notjunk:1; V01:K0:YPqcsUVoVwc=:QtWRYBzERocYcc6+54c0Mx tsMeTv8Ix8UeCitjOi3dBb3LzQKpIneWNYoEPbVQwP8leh+hAuap4avdEZhHQTrTgmhHmyNL4 POmRR61qiUucel/1sQuM3duEQzjIlStbWoERb3f7xwowZ6JX5dvbpfITDaxyUWI6EVgO61VVc t9pFesuMGgfJTWtuC3LGitvVZOTWyUyMStd3s8/ZxkXPFnATbOm2AtHV+vMmu77qNviUYDjNx zsxH1hAF127TmIe01JU5NSe7Go5aFsELWdlJG2kzjHEsGDgk2MLK3PrKNU/70l1knHKvWuJKd JTc4/Ve1PzszZRaM014iHBsY9YSKsbsb+77T/x7coQuBlN6ZHdnEz4ycB03f0ytIyijGHrVvS qcNm1dSsMoNh5UAYorBQ045QYHJ7KnKNlwnuARhYONjPJe7kHdcM60KhtiBPZA6uyULeznWEZ ECP7dSTKLzwmrovhbV1rZMH/pVCf3EbxmKEvzLeELMl49aXNbBtPXGkUVZzeox8b1+rmqMaCf lRHGIWZ98wSfB1xDjyozsH0ysUBUL8wt4zzh3VWQmL/rYKamAS+0Rey8CR0YmB9VE4t4Xt3TT xgBb0jOjdMPXctiRPSkH5TEftk6fcrdQ3Zz7pJbT+HApk78uaoxMw786I8VoU2s81w10hKleH a9An13k2ramajW9HbkvvZ8sJSVP2sPMClViLRx3pVBXsQcxa+v82YiE3hOIugGd3xc4M= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The VIDEO_STILLPICTURE is only implemented by one driver, while VIDEO_GET_EVENT has two users in tree. In both cases, it is fairly easy to handle the compat ioctls in the native handler rather than relying on translation in fs/compat_ioctls. In effect, this means that now the drivers implement both structure layouts in both native and compat mode, but I don't see anything wrong with that. Signed-off-by: Arnd Bergmann --- drivers/media/pci/ivtv/ivtv-ioctl.c | 34 ++++++++++++- drivers/media/pci/ttpci/av7110_av.c | 56 ++++++++++++++++++++- fs/compat_ioctl.c | 78 ----------------------------- 3 files changed, 87 insertions(+), 81 deletions(-) -- 2.18.0 diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c index 4cdc6d2be85d..785dbd4be420 100644 --- a/drivers/media/pci/ivtv/ivtv-ioctl.c +++ b/drivers/media/pci/ivtv/ivtv-ioctl.c @@ -36,6 +36,7 @@ #include #include #ifdef CONFIG_VIDEO_IVTV_DEPRECATED_IOCTLS +#include #include #include #endif @@ -1627,6 +1628,21 @@ static __inline__ void warn_deprecated_ioctl(const char *name) pr_warn_once("warning: the %s ioctl is deprecated. Don't use it, as it will be removed soon\n", name); } + +#ifdef CONFIG_COMPAT +struct compat_video_event { + __s32 type; + /* unused, make sure to use atomic time for y2038 if it ever gets used */ + compat_long_t timestamp; + union { + video_size_t size; + unsigned int frame_rate; /* in frames per 1000sec */ + unsigned char vsync_field; /* unknown/odd/even/progressive */ + } u; +}; +#define VIDEO_GET_EVENT32 _IOR('o', 28, struct compat_video_event) +#endif + #endif static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) @@ -1749,7 +1765,13 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) return ivtv_video_command(itv, id, dc, try); } +#ifdef CONFIG_COMPAT + case VIDEO_GET_EVENT32: +#endif case VIDEO_GET_EVENT: { +#ifdef CONFIG_COMPAT + struct compat_video_event *ev32 = arg; +#endif struct video_event *ev = arg; DEFINE_WAIT(wait); @@ -1763,14 +1785,22 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) if (test_and_clear_bit(IVTV_F_I_EV_DEC_STOPPED, &itv->i_flags)) ev->type = VIDEO_EVENT_DECODER_STOPPED; else if (test_and_clear_bit(IVTV_F_I_EV_VSYNC, &itv->i_flags)) { + unsigned char vsync_field; + ev->type = VIDEO_EVENT_VSYNC; - ev->u.vsync_field = test_bit(IVTV_F_I_EV_VSYNC_FIELD, &itv->i_flags) ? + vsync_field = test_bit(IVTV_F_I_EV_VSYNC_FIELD, &itv->i_flags) ? VIDEO_VSYNC_FIELD_ODD : VIDEO_VSYNC_FIELD_EVEN; if (itv->output_mode == OUT_UDMA_YUV && (itv->yuv_info.lace_mode & IVTV_YUV_MODE_MASK) == IVTV_YUV_MODE_PROGRESSIVE) { - ev->u.vsync_field = VIDEO_VSYNC_FIELD_PROGRESSIVE; + vsync_field = VIDEO_VSYNC_FIELD_PROGRESSIVE; } +#ifdef CONFIG_COMPAT + if (cmd == VIDEO_GET_EVENT32) + ev32->u.vsync_field = vsync_field; + else +#endif + ev->u.vsync_field = vsync_field; } if (ev->type) return 0; diff --git a/drivers/media/pci/ttpci/av7110_av.c b/drivers/media/pci/ttpci/av7110_av.c index e738b2cef6f6..fd49ee5a380a 100644 --- a/drivers/media/pci/ttpci/av7110_av.c +++ b/drivers/media/pci/ttpci/av7110_av.c @@ -932,7 +932,6 @@ static int dvb_video_get_event (struct av7110 *av7110, struct video_event *event return 0; } - /****************************************************************************** * DVB device file operations ******************************************************************************/ @@ -1095,6 +1094,42 @@ static int play_iframe(struct av7110 *av7110, char __user *buf, unsigned int len return 0; } +#ifdef CONFIG_COMPAT +struct compat_video_still_picture { + compat_uptr_t iFrame; + int32_t size; +}; +#define VIDEO_STILLPICTURE32 _IOW('o', 30, struct compat_video_still_picture) + +struct compat_video_event { + __s32 type; + /* unused, make sure to use atomic time for y2038 if it ever gets used */ + compat_long_t timestamp; + union { + video_size_t size; + unsigned int frame_rate; /* in frames per 1000sec */ + unsigned char vsync_field; /* unknown/odd/even/progressive */ + } u; +}; +#define VIDEO_GET_EVENT32 _IOR('o', 28, struct compat_video_event) + +static int dvb_compat_video_get_event(struct av7110 *av7110, + struct compat_video_event *event, int flags) +{ + struct video_event ev; + int ret; + + ret = dvb_video_get_event(av7110, &ev, flags); + + *event = (struct compat_video_event) { + .type = ev.type, + .timestamp = ev.timestamp, + .u.size = ev.u.size, + }; + + return ret; +} +#endif static int dvb_video_ioctl(struct file *file, unsigned int cmd, void *parg) @@ -1184,6 +1219,12 @@ static int dvb_video_ioctl(struct file *file, memcpy(parg, &av7110->videostate, sizeof(struct video_status)); break; +#ifdef CONFIG_COMPAT + case VIDEO_GET_EVENT32: + ret = dvb_compat_video_get_event(av7110, parg, file->f_flags); + break; +#endif + case VIDEO_GET_EVENT: ret = dvb_video_get_event(av7110, parg, file->f_flags); break; @@ -1226,6 +1267,19 @@ static int dvb_video_ioctl(struct file *file, 1, (u16) arg); break; +#ifdef CONFIG_COMPAT + case VIDEO_STILLPICTURE32: + { + struct compat_video_still_picture *pic = + (struct compat_video_still_picture *) parg; + av7110->videostate.stream_source = VIDEO_SOURCE_MEMORY; + dvb_ringbuffer_flush_spinlock_wakeup(&av7110->avout); + ret = play_iframe(av7110, compat_ptr(pic->iFrame), + pic->size, file->f_flags & O_NONBLOCK); + break; + } +#endif + case VIDEO_STILLPICTURE: { struct video_still_picture *pic = diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 7a1fac9cd1c2..5b2e22e7a316 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -103,11 +103,6 @@ #include -#define __DVB_CORE__ -#include -#include -#include -#include #include @@ -133,73 +128,6 @@ static int do_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return vfs_ioctl(file, cmd, arg); } -struct compat_video_event { - int32_t type; - compat_time_t timestamp; - union { - video_size_t size; - unsigned int frame_rate; - } u; -}; -#define VIDEO_GET_EVENT32 _IOR('o', 28, struct compat_video_event) - -static int do_video_get_event(struct file *file, - unsigned int cmd, struct compat_video_event __user *up) -{ - struct video_event __user *kevent = - compat_alloc_user_space(sizeof(*kevent)); - int err; - - if (kevent == NULL) - return -EFAULT; - - err = do_ioctl(file, VIDEO_GET_EVENT, (unsigned long)kevent); - if (!err) { - err = convert_in_user(&kevent->type, &up->type); - err |= convert_in_user(&kevent->timestamp, &up->timestamp); - err |= convert_in_user(&kevent->u.size.w, &up->u.size.w); - err |= convert_in_user(&kevent->u.size.h, &up->u.size.h); - err |= convert_in_user(&kevent->u.size.aspect_ratio, - &up->u.size.aspect_ratio); - if (err) - err = -EFAULT; - } - - return err; -} - -struct compat_video_still_picture { - compat_uptr_t iFrame; - int32_t size; -}; -#define VIDEO_STILLPICTURE32 _IOW('o', 30, struct compat_video_still_picture) - -static int do_video_stillpicture(struct file *file, - unsigned int cmd, struct compat_video_still_picture __user *up) -{ - struct video_still_picture __user *up_native; - compat_uptr_t fp; - int32_t size; - int err; - - err = get_user(fp, &up->iFrame); - err |= get_user(size, &up->size); - if (err) - return -EFAULT; - - up_native = - compat_alloc_user_space(sizeof(struct video_still_picture)); - - err = put_user(compat_ptr(fp), &up_native->iFrame); - err |= put_user(size, &up_native->size); - if (err) - return -EFAULT; - - err = do_ioctl(file, VIDEO_STILLPICTURE, (unsigned long) up_native); - - return err; -} - #ifdef CONFIG_BLOCK typedef struct sg_io_hdr32 { compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */ @@ -1250,12 +1178,6 @@ static long do_ioctl_trans(unsigned int cmd, case RTC_EPOCH_READ32: case RTC_EPOCH_SET32: return rtc_ioctl(file, cmd, argp); - - /* dvb */ - case VIDEO_GET_EVENT32: - return do_video_get_event(file, cmd, argp); - case VIDEO_STILLPICTURE32: - return do_video_stillpicture(file, cmd, argp); } /*