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)