summaryrefslogtreecommitdiffstats
path: root/fs/compat_ioctl.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2018-08-27 15:56:25 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-12 11:00:51 -0400
commit04b72322e85dd7987085a4d29a29ebc1a5ad5dd2 (patch)
tree0265a01fe624c143df6a4d4355fb6c8bba7b9bb4 /fs/compat_ioctl.c
parent8a24280b11ea49ed13d384c7426419201600c3a9 (diff)
media: dvb: move compat handlers into drivers
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 <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r--fs/compat_ioctl.c78
1 files changed, 0 insertions, 78 deletions
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 @@
103 103
104#include <linux/hiddev.h> 104#include <linux/hiddev.h>
105 105
106#define __DVB_CORE__
107#include <linux/dvb/audio.h>
108#include <linux/dvb/dmx.h>
109#include <linux/dvb/frontend.h>
110#include <linux/dvb/video.h>
111 106
112#include <linux/sort.h> 107#include <linux/sort.h>
113 108
@@ -133,73 +128,6 @@ static int do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
133 return vfs_ioctl(file, cmd, arg); 128 return vfs_ioctl(file, cmd, arg);
134} 129}
135 130
136struct compat_video_event {
137 int32_t type;
138 compat_time_t timestamp;
139 union {
140 video_size_t size;
141 unsigned int frame_rate;
142 } u;
143};
144#define VIDEO_GET_EVENT32 _IOR('o', 28, struct compat_video_event)
145
146static int do_video_get_event(struct file *file,
147 unsigned int cmd, struct compat_video_event __user *up)
148{
149 struct video_event __user *kevent =
150 compat_alloc_user_space(sizeof(*kevent));
151 int err;
152
153 if (kevent == NULL)
154 return -EFAULT;
155
156 err = do_ioctl(file, VIDEO_GET_EVENT, (unsigned long)kevent);
157 if (!err) {
158 err = convert_in_user(&kevent->type, &up->type);
159 err |= convert_in_user(&kevent->timestamp, &up->timestamp);
160 err |= convert_in_user(&kevent->u.size.w, &up->u.size.w);
161 err |= convert_in_user(&kevent->u.size.h, &up->u.size.h);
162 err |= convert_in_user(&kevent->u.size.aspect_ratio,
163 &up->u.size.aspect_ratio);
164 if (err)
165 err = -EFAULT;
166 }
167
168 return err;
169}
170
171struct compat_video_still_picture {
172 compat_uptr_t iFrame;
173 int32_t size;
174};
175#define VIDEO_STILLPICTURE32 _IOW('o', 30, struct compat_video_still_picture)
176
177static int do_video_stillpicture(struct file *file,
178 unsigned int cmd, struct compat_video_still_picture __user *up)
179{
180 struct video_still_picture __user *up_native;
181 compat_uptr_t fp;
182 int32_t size;
183 int err;
184
185 err = get_user(fp, &up->iFrame);
186 err |= get_user(size, &up->size);
187 if (err)
188 return -EFAULT;
189
190 up_native =
191 compat_alloc_user_space(sizeof(struct video_still_picture));
192
193 err = put_user(compat_ptr(fp), &up_native->iFrame);
194 err |= put_user(size, &up_native->size);
195 if (err)
196 return -EFAULT;
197
198 err = do_ioctl(file, VIDEO_STILLPICTURE, (unsigned long) up_native);
199
200 return err;
201}
202
203#ifdef CONFIG_BLOCK 131#ifdef CONFIG_BLOCK
204typedef struct sg_io_hdr32 { 132typedef struct sg_io_hdr32 {
205 compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */ 133 compat_int_t interface_id; /* [i] 'S' for SCSI generic (required) */
@@ -1250,12 +1178,6 @@ static long do_ioctl_trans(unsigned int cmd,
1250 case RTC_EPOCH_READ32: 1178 case RTC_EPOCH_READ32:
1251 case RTC_EPOCH_SET32: 1179 case RTC_EPOCH_SET32:
1252 return rtc_ioctl(file, cmd, argp); 1180 return rtc_ioctl(file, cmd, argp);
1253
1254 /* dvb */
1255 case VIDEO_GET_EVENT32:
1256 return do_video_get_event(file, cmd, argp);
1257 case VIDEO_STILLPICTURE32:
1258 return do_video_stillpicture(file, cmd, argp);
1259 } 1181 }
1260 1182
1261 /* 1183 /*