diff options
Diffstat (limited to 'drivers/media')
23 files changed, 4 insertions, 2017 deletions
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index c21dfc28482..9ea1a6d70f0 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -53,21 +53,6 @@ config VIDEO_ALLOW_V4L1 If you are unsure as to whether this is required, answer Y. -config VIDEO_V4L1_COMPAT - bool "Enable Video For Linux API 1 compatible Layer" if !VIDEO_ALLOW_V4L1 - depends on VIDEO_DEV - default y - ---help--- - Enables a compatibility API used by most V4L2 devices to allow - its usage with legacy applications that supports only V4L1 api. - - Documentation for the original API is included in the file - <Documentation/video4linux/API.html>. - - User tools for this are available from - <ftp://ftp.uk.linux.org/pub/linux/video4linux/>. - - If you are unsure as to whether this is required, answer Y. # # DVB Core diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index d246910129e..0ac5c619aec 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c @@ -1129,35 +1129,6 @@ static int vidioc_g_chip_ident(struct file *file, void *__fh, core, g_chip_ident, chip); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *__fh, struct video_mbuf *mbuf) -{ - struct saa7146_fh *fh = __fh; - struct videobuf_queue *q = &fh->video_q; - int err, i; - - /* fixme: number of capture buffers and sizes for v4l apps */ - int gbuffers = 2; - int gbufsize = 768 * 576 * 4; - - DEB_D(("VIDIOCGMBUF \n")); - - q = &fh->video_q; - err = videobuf_mmap_setup(q, gbuffers, gbufsize, - V4L2_MEMORY_MMAP); - if (err < 0) - return err; - - gbuffers = err; - memset(mbuf, 0, sizeof(*mbuf)); - mbuf->frames = gbuffers; - mbuf->size = gbuffers * gbufsize; - for (i = 0; i < gbuffers; i++) - mbuf->offsets[i] = i * gbufsize; - return 0; -} -#endif - const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = { .vidioc_querycap = vidioc_querycap, .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, @@ -1186,9 +1157,6 @@ const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = { .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, .vidioc_g_parm = vidioc_g_parm, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif }; /*********************************************************************************/ diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 482f14b3ff8..ace7b6eaf5b 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -22,10 +22,6 @@ endif obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o -ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y) - obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o -endif - # All i2c modules must come first: obj-$(CONFIG_VIDEO_TUNER) += tuner.o diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index 48682af911f..e41e4ad5cc4 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c @@ -1809,15 +1809,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct au0828_fh *fh = priv; - - return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); -} -#endif - static struct v4l2_file_operations au0828_v4l_fops = { .owner = THIS_MODULE, .open = au0828_v4l2_open, @@ -1861,9 +1852,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_s_register = vidioc_s_register, #endif .vidioc_g_chip_ident = vidioc_g_chip_ident, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif }; static const struct video_device au0828_video_template = { diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 54fbab95b88..961d0805d87 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -2597,31 +2597,6 @@ static int bttv_s_fmt_vid_overlay(struct file *file, void *priv, return setup_window_lock(fh, btv, &f->fmt.win, 1); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - int retval; - unsigned int i; - struct bttv_fh *fh = priv; - - retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, - V4L2_MEMORY_MMAP); - if (retval < 0) { - return retval; - } - - gbuffers = retval; - memset(mbuf, 0, sizeof(*mbuf)); - mbuf->frames = gbuffers; - mbuf->size = gbuffers * gbufsize; - - for (i = 0; i < gbuffers; i++) - mbuf->offsets[i] = i * gbufsize; - - return 0; -} -#endif - static int bttv_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { @@ -3354,9 +3329,6 @@ static const struct v4l2_ioctl_ops bttv_ioctl_ops = { .vidioc_streamoff = bttv_streamoff, .vidioc_g_tuner = bttv_g_tuner, .vidioc_s_tuner = bttv_s_tuner, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif .vidioc_g_crop = bttv_g_crop, .vidioc_s_crop = bttv_s_crop, .vidioc_g_fbuf = bttv_g_fbuf, diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 46b433bbf2c..7edf80b0d01 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c @@ -419,28 +419,6 @@ static int sync(struct camera_data *cam, int frame_nr) /****************************************************************************** * - * ioctl_get_mbuf - * - *****************************************************************************/ -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int ioctl_get_mbuf(void *arg, struct camera_data *cam) -{ - struct video_mbuf *vm; - int i; - vm = arg; - - memset(vm, 0, sizeof(*vm)); - vm->size = cam->frame_size*cam->num_frames; - vm->frames = cam->num_frames; - for (i = 0; i < cam->num_frames; i++) - vm->offsets[i] = cam->frame_size * i; - - return 0; -} -#endif - -/****************************************************************************** - * * ioctl_set_gpio * *****************************************************************************/ @@ -1380,17 +1358,6 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) } break; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCGMBUF: - { - struct cpia2_fh *fh = file->private_data; - if(fh->prio != V4L2_PRIORITY_RECORD) { - mutex_unlock(&cam->busy_lock); - return -EBUSY; - } - break; - } -#endif default: break; } @@ -1400,11 +1367,6 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) case CPIA2_IOC_SET_GPIO: retval = ioctl_set_gpio(arg, cam); break; -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCGMBUF: /* mmap interface */ - retval = ioctl_get_mbuf(arg, cam); - break; -#endif case VIDIOC_QUERYCAP: retval = ioctl_querycap(arg,cam); break; diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c index b13b69fb2af..7e3e8c4f19b 100644 --- a/drivers/media/video/cx231xx/cx231xx-video.c +++ b/drivers/media/video/cx231xx/cx231xx-video.c @@ -2044,15 +2044,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct cx231xx_fh *fh = priv; - - return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); -} -#endif - /* ----------------------------------------------------------- */ /* RADIO ESPECIFIC IOCTLS */ /* ----------------------------------------------------------- */ @@ -2507,9 +2498,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_g_register = vidioc_g_register, .vidioc_s_register = vidioc_s_register, #endif -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif }; static struct video_device cx231xx_vbi_template; diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 8b2fb8a4375..796a797b520 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c @@ -1024,35 +1024,6 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, return 0; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, - struct video_mbuf *mbuf) -{ - struct cx23885_fh *fh = priv; - struct videobuf_queue *q; - struct v4l2_requestbuffers req; - unsigned int i; - int err; - - q = get_queue(fh); - memset(&req, 0, sizeof(req)); - req.type = q->type; - req.count = 8; - req.memory = V4L2_MEMORY_MMAP; - err = videobuf_reqbufs(q, &req); - if (err < 0) - return err; - - mbuf->frames = req.count; - mbuf->size = 0; - for (i = 0; i < mbuf->frames; i++) { - mbuf->offsets[i] = q->bufs[i]->boff; - mbuf->size += q->bufs[i]->bsize; - } - return 0; -} -#endif - static int vidioc_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p) { @@ -1427,9 +1398,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif .vidioc_g_tuner = vidioc_g_tuner, .vidioc_s_tuner = vidioc_s_tuner, .vidioc_g_frequency = vidioc_g_frequency, diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 62cea954940..9a37b839c67 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -1179,15 +1179,6 @@ static int vidioc_enum_fmt_vid_cap (struct file *file, void *priv, return 0; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct cx8800_fh *fh = priv; - - return videobuf_cgmbuf (get_queue(fh), mbuf, 8); -} -#endif - static int vidioc_reqbufs (struct file *file, void *priv, struct v4l2_requestbuffers *p) { struct cx8800_fh *fh = priv; @@ -1731,9 +1722,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif .vidioc_g_tuner = vidioc_g_tuner, .vidioc_s_tuner = vidioc_s_tuner, .vidioc_g_frequency = vidioc_g_frequency, diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 908e3bc8830..7be9bbad79b 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -1934,19 +1934,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) O_NONBLOCK); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct em28xx_fh *fh = priv; - - if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) - return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); - else - return videobuf_cgmbuf(&fh->vb_vbiq, mbuf, 8); -} -#endif - - /* ----------------------------------------------------------- */ /* RADIO ESPECIFIC IOCTLS */ /* ----------------------------------------------------------- */ @@ -2359,9 +2346,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_s_register = vidioc_s_register, .vidioc_g_chip_ident = vidioc_g_chip_ident, #endif -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif }; static const struct video_device em28xx_video_template = { diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index aaafa0398fd..58617fc656c 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -852,8 +852,8 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) #endif default : - ret = v4l_compat_translate_ioctl(file, cmd, - arg, pvr2_v4l2_do_ioctl); + ret = -EINVAL; + break; } pvr2_hdw_commit_ctl(hdw); diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index 2ef1668638f..8ca4d22b438 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c @@ -362,23 +362,6 @@ long pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg) switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - /* mmap() functions */ - case VIDIOCGMBUF: - { - /* Tell the user program how much memory is needed for a mmap() */ - struct video_mbuf *vm = arg; - int i; - - memset(vm, 0, sizeof(*vm)); - vm->size = pwc_mbufs * pdev->len_per_image; - vm->frames = pwc_mbufs; /* double buffering should be enough for most applications */ - for (i = 0; i < pwc_mbufs; i++) - vm->offsets[i] = i * pdev->len_per_image; - break; - } -#endif - /* V4L2 Layer */ case VIDIOC_QUERYCAP: { diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index cf03372d1d1..b63f8cafa67 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c @@ -1097,15 +1097,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) return rc; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidioc_cgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct s2255_fh *fh = priv; - - return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); -} -#endif - /* write to the configuration pipe, synchronously */ static int s2255_write_config(struct usb_device *udev, unsigned char *pbuf, int size) @@ -1909,9 +1900,6 @@ static const struct v4l2_ioctl_ops s2255_ioctl_ops = { .vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidioc_cgmbuf, -#endif .vidioc_s_jpegcomp = vidioc_s_jpegcomp, .vidioc_g_jpegcomp = vidioc_g_jpegcomp, .vidioc_s_parm = vidioc_s_parm, diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index f0b1573137f..ad22be27bd3 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -2211,14 +2211,6 @@ static int saa7134_overlay(struct file *file, void *f, unsigned int on) return 0; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct saa7134_fh *fh = file->private_data; - return videobuf_cgmbuf(saa7134_queue(fh), mbuf, 8); -} -#endif - static int saa7134_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p) { @@ -2456,9 +2448,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { .vidioc_streamoff = saa7134_streamoff, .vidioc_g_tuner = saa7134_g_tuner, .vidioc_s_tuner = saa7134_s_tuner, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif .vidioc_g_crop = saa7134_g_crop, .vidioc_s_crop = saa7134_s_crop, .vidioc_g_fbuf = saa7134_g_fbuf, diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 011c0c38699..20da6ea2cdf 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c @@ -1273,9 +1273,6 @@ static const struct v4l2_ioctl_ops usbvision_ioctl_ops = { .vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_streamon = vidioc_streamon, .vidioc_streamoff = vidioc_streamoff, -#ifdef CONFIG_VIDEO_V4L1_COMPAT -/* .vidiocgmbuf = vidiocgmbuf, */ -#endif .vidioc_g_tuner = vidioc_g_tuner, .vidioc_s_tuner = vidioc_s_tuner, .vidioc_g_frequency = vidioc_g_frequency, diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c index 8cf61e8a634..9005a8d9d5f 100644 --- a/drivers/media/video/uvc/uvc_v4l2.c +++ b/drivers/media/video/uvc/uvc_v4l2.c @@ -1035,11 +1035,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) return uvc_xu_ctrl_query(chain, arg, 1); default: - if ((ret = v4l_compat_translate_ioctl(file, cmd, arg, - uvc_v4l2_do_ioctl)) == -ENOIOCTLCMD) - uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", - cmd); - return ret; + uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", cmd); + return -EINVAL; } return ret; diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c deleted file mode 100644 index d4ac751036a..00000000000 --- a/drivers/media/video/v4l1-compat.c +++ /dev/null @@ -1,1277 +0,0 @@ -/* - * - * Video for Linux Two - * Backward Compatibility Layer - * - * Support subroutines for providing V4L2 drivers with backward - * compatibility with applications using the old API. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - * Author: Bill Dirks <bill@thedirks.org> - * et al. - * - */ - - -#include <linux/init.h> -#include <linux/module.h> -#include <linux/types.h> -#include <linux/kernel.h> -#include <linux/sched.h> -#include <linux/mm.h> -#include <linux/fs.h> -#include <linux/file.h> -#include <linux/string.h> -#include <linux/errno.h> -#include <linux/slab.h> -#include <linux/videodev.h> -#include <media/v4l2-common.h> -#include <media/v4l2-ioctl.h> - -#include <asm/uaccess.h> -#include <asm/system.h> -#include <asm/pgtable.h> - -static unsigned int debug; -module_param(debug, int, 0644); -MODULE_PARM_DESC(debug, "enable debug messages"); -MODULE_AUTHOR("Bill Dirks"); -MODULE_DESCRIPTION("v4l(1) compatibility layer for v4l2 drivers."); -MODULE_LICENSE("GPL"); - -#define dprintk(fmt, arg...) \ - do { \ - if (debug) \ - printk(KERN_DEBUG "v4l1-compat: " fmt , ## arg);\ - } while (0) - -/* - * I O C T L T R A N S L A T I O N - * - * From here on down is the code for translating the numerous - * ioctl commands from the old API to the new API. - */ - -static int -get_v4l_control(struct file *file, - int cid, - v4l2_kioctl drv) -{ - struct v4l2_queryctrl qctrl2; - struct v4l2_control ctrl2; - int err; - - qctrl2.id = cid; - err = drv(file, VIDIOC_QUERYCTRL, &qctrl2); - if (err < 0) - dprintk("VIDIOC_QUERYCTRL: %d\n", err); - if (err == 0 && !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) { - ctrl2.id = qctrl2.id; - err = drv(file, VIDIOC_G_CTRL, &ctrl2); - if (err < 0) { - dprintk("VIDIOC_G_CTRL: %d\n", err); - return 0; - } - return DIV_ROUND_CLOSEST((ctrl2.value-qctrl2.minimum) * 65535, - qctrl2.maximum - qctrl2.minimum); - } - return 0; -} - -static int -set_v4l_control(struct file *file, - int cid, - int value, - v4l2_kioctl drv) -{ - struct v4l2_queryctrl qctrl2; - struct v4l2_control ctrl2; - int err; - - qctrl2.id = cid; - err = drv(file, VIDIOC_QUERYCTRL, &qctrl2); - if (err < 0) - dprintk("VIDIOC_QUERYCTRL: %d\n", err); - if (err == 0 && - !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED) && - !(qctrl2.flags & V4L2_CTRL_FLAG_GRABBED)) { - if (value < 0) - value = 0; - if (value > 65535) - value = 65535; - if (value && qctrl2.type == V4L2_CTRL_TYPE_BOOLEAN) - value = 65535; - ctrl2.id = qctrl2.id; - ctrl2.value = - (value * (qctrl2.maximum - qctrl2.minimum) - + 32767) - / 65535; - ctrl2.value += qctrl2.minimum; - err = drv(file, VIDIOC_S_CTRL, &ctrl2); - if (err < 0) - dprintk("VIDIOC_S_CTRL: %d\n", err); - } - return 0; -} - -/* ----------------------------------------------------------------- */ - -static const unsigned int palette2pixelformat[] = { - [VIDEO_PALETTE_GREY] = V4L2_PIX_FMT_GREY, - [VIDEO_PALETTE_RGB555] = V4L2_PIX_FMT_RGB555, - [VIDEO_PALETTE_RGB565] = V4L2_PIX_FMT_RGB565, - [VIDEO_PALETTE_RGB24] = V4L2_PIX_FMT_BGR24, - [VIDEO_PALETTE_RGB32] = V4L2_PIX_FMT_BGR32, - /* yuv packed pixel */ - [VIDEO_PALETTE_YUYV] = V4L2_PIX_FMT_YUYV, - [VIDEO_PALETTE_YUV422] = V4L2_PIX_FMT_YUYV, - [VIDEO_PALETTE_UYVY] = V4L2_PIX_FMT_UYVY, - /* yuv planar */ - [VIDEO_PALETTE_YUV410P] = V4L2_PIX_FMT_YUV410, - [VIDEO_PALETTE_YUV420] = V4L2_PIX_FMT_YUV420, - [VIDEO_PALETTE_YUV420P] = V4L2_PIX_FMT_YUV420, - [VIDEO_PALETTE_YUV411P] = V4L2_PIX_FMT_YUV411P, - [VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P, -}; - -static unsigned int __pure -palette_to_pixelformat(unsigned int palette) -{ - if (palette < ARRAY_SIZE(palette2pixelformat)) - return palette2pixelformat[palette]; - else - return 0; -} - -static unsigned int __attribute_const__ -pixelformat_to_palette(unsigned int pixelformat) -{ - int palette = 0; - switch (pixelformat) { - case V4L2_PIX_FMT_GREY: - palette = VIDEO_PALETTE_GREY; - break; - case V4L2_PIX_FMT_RGB555: - palette = VIDEO_PALETTE_RGB555; - break; - case V4L2_PIX_FMT_RGB565: - palette = VIDEO_PALETTE_RGB565; - break; - case V4L2_PIX_FMT_BGR24: - palette = VIDEO_PALETTE_RGB24; - break; - case V4L2_PIX_FMT_BGR32: - palette = VIDEO_PALETTE_RGB32; - break; - /* yuv packed pixel */ - case V4L2_PIX_FMT_YUYV: - palette = VIDEO_PALETTE_YUYV; - break; - case V4L2_PIX_FMT_UYVY: - palette = VIDEO_PALETTE_UYVY; - break; - /* yuv planar */ - case V4L2_PIX_FMT_YUV410: - palette = VIDEO_PALETTE_YUV420; - break; - case V4L2_PIX_FMT_YUV420: - palette = VIDEO_PALETTE_YUV420; - break; - case V4L2_PIX_FMT_YUV411P: - palette = VIDEO_PALETTE_YUV411P; - break; - case V4L2_PIX_FMT_YUV422P: - palette = VIDEO_PALETTE_YUV422P; - break; - } - return palette; -} - -/* ----------------------------------------------------------------- */ - -static int poll_one(struct file *file, struct poll_wqueues *pwq) -{ - int retval = 1; - poll_table *table; - - poll_initwait(pwq); - table = &pwq->pt; - for (;;) { - int mask; - mask = file->f_op->poll(file, table); - if (mask & POLLIN) - break; - table = NULL; - if (signal_pending(current)) { - retval = -ERESTARTSYS; - break; - } - poll_schedule(pwq, TASK_INTERRUPTIBLE); - } - poll_freewait(pwq); - return retval; -} - -static int count_inputs( - struct file *file, - v4l2_kioctl drv) -{ - struct v4l2_input input2; - int i; - - for (i = 0;; i++) { - memset(&input2, 0, sizeof(input2)); - input2.index = i; - if (0 != drv(file, VIDIOC_ENUMINPUT, &input2)) - break; - } - return i; -} - -static int check_size( - struct file *file, - v4l2_kioctl drv, - int *maxw, - int *maxh) -{ - struct v4l2_fmtdesc desc2; - struct v4l2_format fmt2; - - memset(&desc2, 0, sizeof(desc2)); - memset(&fmt2, 0, sizeof(fmt2)); - - desc2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (0 != drv(file, VIDIOC_ENUM_FMT, &desc2)) - goto done; - - fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - fmt2.fmt.pix.width = 10000; - fmt2.fmt.pix.height = 10000; - fmt2.fmt.pix.pixelformat = desc2.pixelformat; - if (0 != drv(file, VIDIOC_TRY_FMT, &fmt2)) - goto done; - - *maxw = fmt2.fmt.pix.width; - *maxh = fmt2.fmt.pix.height; - -done: - return 0; -} - -/* ----------------------------------------------------------------- */ - -static noinline long v4l1_compat_get_capabilities( - struct video_capability *cap, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_framebuffer fbuf; - struct v4l2_capability *cap2; - - cap2 = kzalloc(sizeof(*cap2), GFP_KERNEL); - if (!cap2) { - err = -ENOMEM; - return err; - } - memset(cap, 0, sizeof(*cap)); - memset(&fbuf, 0, sizeof(fbuf)); - - err = drv(file, VIDIOC_QUERYCAP, cap2); - if (err < 0) { - dprintk("VIDIOCGCAP / VIDIOC_QUERYCAP: %ld\n", err); - goto done; - } - if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) { - err = drv(file, VIDIOC_G_FBUF, &fbuf); - if (err < 0) { - dprintk("VIDIOCGCAP / VIDIOC_G_FBUF: %ld\n", err); - memset(&fbuf, 0, sizeof(fbuf)); - } - err = 0; - } - - memcpy(cap->name, cap2->card, - min(sizeof(cap->name), sizeof(cap2->card))); - cap->name[sizeof(cap->name) - 1] = 0; - if (cap2->capabilities & V4L2_CAP_VIDEO_CAPTURE) - cap->type |= VID_TYPE_CAPTURE; - if (cap2->capabilities & V4L2_CAP_TUNER) - cap->type |= VID_TYPE_TUNER; - if (cap2->capabilities & V4L2_CAP_VBI_CAPTURE) - cap->type |= VID_TYPE_TELETEXT; - if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) - cap->type |= VID_TYPE_OVERLAY; - if (fbuf.capability & V4L2_FBUF_CAP_LIST_CLIPPING) - cap->type |= VID_TYPE_CLIPPING; - - cap->channels = count_inputs(file, drv); - check_size(file, drv, - &cap->maxwidth, &cap->maxheight); - cap->audios = 0; /* FIXME */ - cap->minwidth = 48; /* FIXME */ - cap->minheight = 32; /* FIXME */ - -done: - kfree(cap2); - return err; -} - -static noinline long v4l1_compat_get_frame_buffer( - struct video_buffer *buffer, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_framebuffer fbuf; - - memset(buffer, 0, sizeof(*buffer)); - memset(&fbuf, 0, sizeof(fbuf)); - - err = drv(file, VIDIOC_G_FBUF, &fbuf); - if (err < 0) { - dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %ld\n", err); - goto done; - } - buffer->base = fbuf.base; - buffer->height = fbuf.fmt.height; - buffer->width = fbuf.fmt.width; - - switch (fbuf.fmt.pixelformat) { - case V4L2_PIX_FMT_RGB332: - buffer->depth = 8; - break; - case V4L2_PIX_FMT_RGB555: - buffer->depth = 15; - break; - case V4L2_PIX_FMT_RGB565: - buffer->depth = 16; - break; - case V4L2_PIX_FMT_BGR24: - buffer->depth = 24; - break; - case V4L2_PIX_FMT_BGR32: - buffer->depth = 32; - break; - default: - buffer->depth = 0; - } - if (fbuf.fmt.bytesperline) { - buffer->bytesperline = fbuf.fmt.bytesperline; - if (!buffer->depth && buffer->width) - buffer->depth = ((fbuf.fmt.bytesperline<<3) - + (buffer->width-1)) - / buffer->width; - } else { - buffer->bytesperline = - (buffer->width * buffer->depth + 7) & 7; - buffer->bytesperline >>= 3; - } -done: - return err; -} - -static noinline long v4l1_compat_set_frame_buffer( - struct video_buffer *buffer, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_framebuffer fbuf; - - memset(&fbuf, 0, sizeof(fbuf)); - fbuf.base = buffer->base; - fbuf.fmt.height = buffer->height; - fbuf.fmt.width = buffer->width; - switch (buffer->depth) { - case 8: - fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB332; - break; - case 15: - fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB555; - break; - case 16: - fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB565; - break; - case 24: - fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR24; - break; - case 32: - fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR32; - break; - } - fbuf.fmt.bytesperline = buffer->bytesperline; - err = drv(file, VIDIOC_S_FBUF, &fbuf); - if (err < 0) - dprintk("VIDIOCSFBUF / VIDIOC_S_FBUF: %ld\n", err); - return err; -} - -static noinline long v4l1_compat_get_win_cap_dimensions( - struct video_window *win, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_format *fmt; - - fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); - if (!fmt) { - err = -ENOMEM; - return err; - } - memset(win, 0, sizeof(*win)); - - fmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; - err = drv(file, VIDIOC_G_FMT, fmt); - if (err < 0) - dprintk("VIDIOCGWIN / VIDIOC_G_WIN: %ld\n", err); - if (err == 0) { - win->x = fmt->fmt.win.w.left; - win->y = fmt->fmt.win.w.top; - win->width = fmt->fmt.win.w.width; - win->height = fmt->fmt.win.w.height; - win->chromakey = fmt->fmt.win.chromakey; - win->clips = NULL; - win->clipcount = 0; - goto done; - } - - fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(file, VIDIOC_G_FMT, fmt); - if (err < 0) { - dprintk("VIDIOCGWIN / VIDIOC_G_FMT: %ld\n", err); - goto done; - } - win->x = 0; - win->y = 0; - win->width = fmt->fmt.pix.width; - win->height = fmt->fmt.pix.height; - win->chromakey = 0; - win->clips = NULL; - win->clipcount = 0; -done: - kfree(fmt); - return err; -} - -static noinline long v4l1_compat_set_win_cap_dimensions( - struct video_window *win, - struct file *file, - v4l2_kioctl drv) -{ - long err, err1, err2; - struct v4l2_format *fmt; - - fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); - if (!fmt) { - err = -ENOMEM; - return err; - } - fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - drv(file, VIDIOC_STREAMOFF, &fmt->type); - err1 = drv(file, VIDIOC_G_FMT, fmt); - if (err1 < 0) - dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %ld\n", err1); - if (err1 == 0) { - fmt->fmt.pix.width = win->width; - fmt->fmt.pix.height = win->height; - fmt->fmt.pix.field = V4L2_FIELD_ANY; - fmt->fmt.pix.bytesperline = 0; - err = drv(file, VIDIOC_S_FMT, fmt); - if (err < 0) - dprintk("VIDIOCSWIN / VIDIOC_S_FMT #1: %ld\n", - err); - win->width = fmt->fmt.pix.width; - win->height = fmt->fmt.pix.height; - } - - memset(fmt, 0, sizeof(*fmt)); - fmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; - fmt->fmt.win.w.left = win->x; - fmt->fmt.win.w.top = win->y; - fmt->fmt.win.w.width = win->width; - fmt->fmt.win.w.height = win->height; - fmt->fmt.win.chromakey = win->chromakey; - fmt->fmt.win.clips = (void __user *)win->clips; - fmt->fmt.win.clipcount = win->clipcount; - err2 = drv(file, VIDIOC_S_FMT, fmt); - if (err2 < 0) - dprintk("VIDIOCSWIN / VIDIOC_S_FMT #2: %ld\n", err2); - - if (err1 != 0 && err2 != 0) - err = err1; - else - err = 0; - kfree(fmt); - return err; -} - -static noinline long v4l1_compat_turn_preview_on_off( - int *on, - struct file *file, - v4l2_kioctl drv) -{ - long err; - enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - if (0 == *on) { - /* dirty hack time. But v4l1 has no STREAMOFF - * equivalent in the API, and this one at - * least comes close ... */ - drv(file, VIDIOC_STREAMOFF, &captype); - } - err = drv(file, VIDIOC_OVERLAY, on); - if (err < 0) - dprintk("VIDIOCCAPTURE / VIDIOC_PREVIEW: %ld\n", err); - return err; -} - -static noinline long v4l1_compat_get_input_info( - struct video_channel *chan, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_input input2; - v4l2_std_id sid; - - memset(&input2, 0, sizeof(input2)); - input2.index = chan->channel; - err = drv(file, VIDIOC_ENUMINPUT, &input2); - if (err < 0) { - dprintk("VIDIOCGCHAN / VIDIOC_ENUMINPUT: " - "channel=%d err=%ld\n", chan->channel, err); - goto done; - } - chan->channel = input2.index; - memcpy(chan->name, input2.name, - min(sizeof(chan->name), sizeof(input2.name))); - chan->name[sizeof(chan->name) - 1] = 0; - chan->tuners = (input2.type == V4L2_INPUT_TYPE_TUNER) ? 1 : 0; - chan->flags = (chan->tuners) ? VIDEO_VC_TUNER : 0; - switch (input2.type) { - case V4L2_INPUT_TYPE_TUNER: - chan->type = VIDEO_TYPE_TV; - break; - default: - case V4L2_INPUT_TYPE_CAMERA: - chan->type = VIDEO_TYPE_CAMERA; - break; - } - chan->norm = 0; - /* Note: G_STD might not be present for radio receivers, - * so we should ignore any errors. */ - if (drv(file, VIDIOC_G_STD, &sid) == 0) { - if (sid & V4L2_STD_PAL) - chan->norm = VIDEO_MODE_PAL; - if (sid & V4L2_STD_NTSC) - chan->norm = VIDEO_MODE_NTSC; - if (sid & V4L2_STD_SECAM) - chan->norm = VIDEO_MODE_SECAM; - if (sid == V4L2_STD_ALL) - chan->norm = VIDEO_MODE_AUTO; - } -done: - return err; -} - -static noinline long v4l1_compat_set_input( - struct video_channel *chan, - struct file *file, - v4l2_kioctl drv) -{ - long err; - v4l2_std_id sid = 0; - - err = drv(file, VIDIOC_S_INPUT, &chan->channel); - if (err < 0) - dprintk("VIDIOCSCHAN / VIDIOC_S_INPUT: %ld\n", err); - switch (chan->norm) { - case VIDEO_MODE_PAL: - sid = V4L2_STD_PAL; - break; - case VIDEO_MODE_NTSC: - sid = V4L2_STD_NTSC; - break; - case VIDEO_MODE_SECAM: - sid = V4L2_STD_SECAM; - break; - case VIDEO_MODE_AUTO: - sid = V4L2_STD_ALL; - break; - } - if (0 != sid) { - err = drv(file, VIDIOC_S_STD, &sid); - if (err < 0) - dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %ld\n", err); - } - return err; -} - -static noinline long v4l1_compat_get_picture( - struct video_picture *pict, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_format *fmt; - - fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); - if (!fmt) { - err = -ENOMEM; - return err; - } - - pict->brightness = get_v4l_control(file, - V4L2_CID_BRIGHTNESS, drv); - pict->hue = get_v4l_control(file, - V4L2_CID_HUE, drv); - pict->contrast = get_v4l_control(file, - V4L2_CID_CONTRAST, drv); - pict->colour = get_v4l_control(file, - V4L2_CID_SATURATION, drv); - pict->whiteness = get_v4l_control(file, - V4L2_CID_WHITENESS, drv); - - fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(file, VIDIOC_G_FMT, fmt); - if (err < 0) { - dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %ld\n", err); - goto done; - } - - if (fmt->fmt.pix.width) - { - pict->depth = ((fmt->fmt.pix.bytesperline << 3) - + (fmt->fmt.pix.width - 1)) - / fmt->fmt.pix.width; - } else { - err = -EINVAL; - goto done; - } - - pict->palette = pixelformat_to_palette( - fmt->fmt.pix.pixelformat); -done: - kfree(fmt); - return err; -} - -static noinline long v4l1_compat_set_picture( - struct video_picture *pict, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_framebuffer fbuf; - int mem_err = 0, ovl_err = 0; - struct v4l2_format *fmt; - - fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); - if (!fmt) { - err = -ENOMEM; - return err; - } - memset(&fbuf, 0, sizeof(fbuf)); - - set_v4l_control(file, - V4L2_CID_BRIGHTNESS, pict->brightness, drv); - set_v4l_control(file, - V4L2_CID_HUE, pict->hue, drv); - set_v4l_control(file, - V4L2_CID_CONTRAST, pict->contrast, drv); - set_v4l_control(file, - V4L2_CID_SATURATION, pict->colour, drv); - set_v4l_control(file, - V4L2_CID_WHITENESS, pict->whiteness, drv); - /* - * V4L1 uses this ioctl to set both memory capture and overlay - * pixel format, while V4L2 has two different ioctls for this. - * Some cards may not support one or the other, and may support - * different pixel formats for memory vs overlay. - */ - - fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(file, VIDIOC_G_FMT, fmt); - /* If VIDIOC_G_FMT failed, then the driver likely doesn't - support memory capture. Trying to set the memory capture - parameters would be pointless. */ - if (err < 0) { - dprintk("VIDIOCSPICT / VIDIOC_G_FMT: %ld\n", err); - mem_err = -1000; /* didn't even try */ - } else if (fmt->fmt.pix.pixelformat != - palette_to_pixelformat(pict->palette)) { - fmt->fmt.pix.pixelformat = palette_to_pixelformat( - pict->palette); - mem_err = drv(file, VIDIOC_S_FMT, fmt); - if (mem_err < 0) - dprintk("VIDIOCSPICT / VIDIOC_S_FMT: %d\n", - mem_err); - } - - err = drv(file, VIDIOC_G_FBUF, &fbuf); - /* If VIDIOC_G_FBUF failed, then the driver likely doesn't - support overlay. Trying to set the overlay parameters - would be quite pointless. */ - if (err < 0) { - dprintk("VIDIOCSPICT / VIDIOC_G_FBUF: %ld\n", err); - ovl_err = -1000; /* didn't even try */ - } else if (fbuf.fmt.pixelformat != - palette_to_pixelformat(pict->palette)) { - fbuf.fmt.pixelformat = palette_to_pixelformat( - pict->palette); - ovl_err = drv(file, VIDIOC_S_FBUF, &fbuf); - if (ovl_err < 0) - dprintk("VIDIOCSPICT / VIDIOC_S_FBUF: %d\n", - ovl_err); - } - if (ovl_err < 0 && mem_err < 0) { - /* ioctl failed, couldn't set either parameter */ - if (mem_err != -1000) - err = mem_err; - else if (ovl_err == -EPERM) - err = 0; - else - err = ovl_err; - } else - err = 0; - kfree(fmt); - return err; -} - -static noinline long v4l1_compat_get_tuner( - struct video_tuner *tun, - struct file *file, - v4l2_kioctl drv) -{ - long err; - int i; - struct v4l2_tuner tun2; - struct v4l2_standard std2; - v4l2_std_id sid; - - memset(&tun2, 0, sizeof(tun2)); - err = drv(file, VIDIOC_G_TUNER, &tun2); - if (err < 0) { - dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %ld\n", err); - goto done; - } - memcpy(tun->name, tun2.name, - min(sizeof(tun->name), sizeof(tun2.name))); - tun->name[sizeof(tun->name) - 1] = 0; - tun->rangelow = tun2.rangelow; - tun->rangehigh = tun2.rangehigh; - tun->flags = 0; - tun->mode = VIDEO_MODE_AUTO; - - for (i = 0; i < 64; i++) { - memset(&std2, 0, sizeof(std2)); - std2.index = i; - if (0 != drv(file, VIDIOC_ENUMSTD, &std2)) - break; - if (std2.id & V4L2_STD_PAL) - tun->flags |= VIDEO_TUNER_PAL; - if (std2.id & V4L2_STD_NTSC) - tun->flags |= VIDEO_TUNER_NTSC; - if (std2.id & V4L2_STD_SECAM) - tun->flags |= VIDEO_TUNER_SECAM; - } - - /* Note: G_STD might not be present for radio receivers, - * so we should ignore any errors. */ - if (drv(file, VIDIOC_G_STD, &sid) == 0) { - if (sid & V4L2_STD_PAL) - tun->mode = VIDEO_MODE_PAL; - if (sid & V4L2_STD_NTSC) - tun->mode = VIDEO_MODE_NTSC; - if (sid & V4L2_STD_SECAM) - tun->mode = VIDEO_MODE_SECAM; - } - - if (tun2.capability & V4L2_TUNER_CAP_LOW) - tun->flags |= VIDEO_TUNER_LOW; - if (tun2.rxsubchans & V4L2_TUNER_SUB_STEREO) - tun->flags |= VIDEO_TUNER_STEREO_ON; - tun->signal = tun2.signal; -done: - return err; -} - -static noinline long v4l1_compat_select_tuner( - struct video_tuner *tun, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_tuner t;/*84 bytes on x86_64*/ - memset(&t, 0, sizeof(t)); - - t.index = tun->tuner; - - err = drv(file, VIDIOC_S_TUNER, &t); - if (err < 0) - dprintk("VIDIOCSTUNER / VIDIOC_S_TUNER: %ld\n", err); - return err; -} - -static noinline long v4l1_compat_get_frequency( - unsigned long *freq, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_frequency freq2; - memset(&freq2, 0, sizeof(freq2)); - - freq2.tuner = 0; - err = drv(file, VIDIOC_G_FREQUENCY, &freq2); - if (err < 0) - dprintk("VIDIOCGFREQ / VIDIOC_G_FREQUENCY: %ld\n", err); - if (0 == err) - *freq = freq2.frequency; - return err; -} - -static noinline long v4l1_compat_set_frequency( - unsigned long *freq, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_frequency freq2; - memset(&freq2, 0, sizeof(freq2)); - - drv(file, VIDIOC_G_FREQUENCY, &freq2); - freq2.frequency = *freq; - err = drv(file, VIDIOC_S_FREQUENCY, &freq2); - if (err < 0) - dprintk("VIDIOCSFREQ / VIDIOC_S_FREQUENCY: %ld\n", err); - return err; -} - -static noinline long v4l1_compat_get_audio( - struct video_audio *aud, - struct file *file, - v4l2_kioctl drv) -{ - long err; - int i; - struct v4l2_queryctrl qctrl2; - struct v4l2_audio aud2; - struct v4l2_tuner tun2; - memset(&aud2, 0, sizeof(aud2)); - - err = drv(file, VIDIOC_G_AUDIO, &aud2); - if (err < 0) { - dprintk("VIDIOCGAUDIO / VIDIOC_G_AUDIO: %ld\n", err); - goto done; - } - memcpy(aud->name, aud2.name, - min(sizeof(aud->name), sizeof(aud2.name))); - aud->name[sizeof(aud->name) - 1] = 0; - aud->audio = aud2.index; - aud->flags = 0; - i = get_v4l_control(file, V4L2_CID_AUDIO_VOLUME, drv); - if (i >= 0) { - aud->volume = i; - aud->flags |= VIDEO_AUDIO_VOLUME; - } - i = get_v4l_control(file, V4L2_CID_AUDIO_BASS, drv); - if (i >= 0) { - aud->bass = i; - aud->flags |= VIDEO_AUDIO_BASS; - } - i = get_v4l_control(file, V4L2_CID_AUDIO_TREBLE, drv); - if (i >= 0) { - aud->treble = i; - aud->flags |= VIDEO_AUDIO_TREBLE; - } - i = get_v4l_control(file, V4L2_CID_AUDIO_BALANCE, drv); - if (i >= 0) { - aud->balance = i; - aud->flags |= VIDEO_AUDIO_BALANCE; - } - i = get_v4l_control(file, V4L2_CID_AUDIO_MUTE, drv); - if (i >= 0) { - if (i) - aud->flags |= VIDEO_AUDIO_MUTE; - aud->flags |= VIDEO_AUDIO_MUTABLE; - } - aud->step = 1; - qctrl2.id = V4L2_CID_AUDIO_VOLUME; - if (drv(file, VIDIOC_QUERYCTRL, &qctrl2) == 0 && - !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) - aud->step = qctrl2.step; - aud->mode = 0; - - memset(&tun2, 0, sizeof(tun2)); - err = drv(file, VIDIOC_G_TUNER, &tun2); - if (err < 0) { - dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %ld\n", err); - err = 0; - goto done; - } - - if (tun2.rxsubchans & V4L2_TUNER_SUB_LANG2) - aud->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; - else if (tun2.rxsubchans & V4L2_TUNER_SUB_STEREO) - aud->mode = VIDEO_SOUND_STEREO; - else if (tun2.rxsubchans & V4L2_TUNER_SUB_MONO) - aud->mode = VIDEO_SOUND_MONO; -done: - return err; -} - -static noinline long v4l1_compat_set_audio( - struct video_audio *aud, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_audio aud2; - struct v4l2_tuner tun2; - - memset(&aud2, 0, sizeof(aud2)); - memset(&tun2, 0, sizeof(tun2)); - - aud2.index = aud->audio; - err = drv(file, VIDIOC_S_AUDIO, &aud2); - if (err < 0) { - dprintk("VIDIOCSAUDIO / VIDIOC_S_AUDIO: %ld\n", err); - goto done; - } - - set_v4l_control(file, V4L2_CID_AUDIO_VOLUME, - aud->volume, drv); - set_v4l_control(file, V4L2_CID_AUDIO_BASS, - aud->bass, drv); - set_v4l_control(file, V4L2_CID_AUDIO_TREBLE, - aud->treble, drv); - set_v4l_control(file, V4L2_CID_AUDIO_BALANCE, - aud->balance, drv); - set_v4l_control(file, V4L2_CID_AUDIO_MUTE, - !!(aud->flags & VIDEO_AUDIO_MUTE), drv); - - err = drv(file, VIDIOC_G_TUNER, &tun2); - if (err < 0) - dprintk("VIDIOCSAUDIO / VIDIOC_G_TUNER: %ld\n", err); - if (err == 0) { - switch (aud->mode) { - default: - case VIDEO_SOUND_MONO: - case VIDEO_SOUND_LANG1: - tun2.audmode = V4L2_TUNER_MODE_MONO; - break; - case VIDEO_SOUND_STEREO: - tun2.audmode = V4L2_TUNER_MODE_STEREO; - break; - case VIDEO_SOUND_LANG2: - tun2.audmode = V4L2_TUNER_MODE_LANG2; - break; - } - err = drv(file, VIDIOC_S_TUNER, &tun2); - if (err < 0) - dprintk("VIDIOCSAUDIO / VIDIOC_S_TUNER: %ld\n", err); - } - err = 0; -done: - return err; -} - -static noinline long v4l1_compat_capture_frame( - struct video_mmap *mm, - struct file *file, - v4l2_kioctl drv) -{ - long err; - enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; - struct v4l2_buffer buf; - struct v4l2_format *fmt; - - fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); - if (!fmt) { - err = -ENOMEM; - return err; - } - memset(&buf, 0, sizeof(buf)); - - fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(file, VIDIOC_G_FMT, fmt); - if (err < 0) { - dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %ld\n", err); - goto done; - } - if (mm->width != fmt->fmt.pix.width || - mm->height != fmt->fmt.pix.height || - palette_to_pixelformat(mm->format) != - fmt->fmt.pix.pixelformat) { - /* New capture format... */ - fmt->fmt.pix.width = mm->width; - fmt->fmt.pix.height = mm->height; - fmt->fmt.pix.pixelformat = - palette_to_pixelformat(mm->format); - fmt->fmt.pix.field = V4L2_FIELD_ANY; - fmt->fmt.pix.bytesperline = 0; - err = drv(file, VIDIOC_S_FMT, fmt); - if (err < 0) { - dprintk("VIDIOCMCAPTURE / VIDIOC_S_FMT: %ld\n", err); - goto done; - } - } - buf.index = mm->frame; - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(file, VIDIOC_QUERYBUF, &buf); - if (err < 0) { - dprintk("VIDIOCMCAPTURE / VIDIOC_QUERYBUF: %ld\n", err); - goto done; - } - err = drv(file, VIDIOC_QBUF, &buf); - if (err < 0) { - dprintk("VIDIOCMCAPTURE / VIDIOC_QBUF: %ld\n", err); - goto done; - } - err = drv(file, VIDIOC_STREAMON, &captype); - if (err < 0) - dprintk("VIDIOCMCAPTURE / VIDIOC_STREAMON: %ld\n", err); -done: - kfree(fmt); - return err; -} - -static noinline long v4l1_compat_sync( - int *i, - struct file *file, - v4l2_kioctl drv) -{ - long err; - enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; - struct v4l2_buffer buf; - struct poll_wqueues *pwq; - - memset(&buf, 0, sizeof(buf)); - buf.index = *i; - buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - err = drv(file, VIDIOC_QUERYBUF, &buf); - if (err < 0) { - /* No such buffer */ - dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %ld\n", err); - goto done; - } - if (!(buf.flags & V4L2_BUF_FLAG_MAPPED)) { - /* Buffer is not mapped */ - err = -EINVAL; - goto done; - } - - /* make sure capture actually runs so we don't block forever */ - err = drv(file, VIDIOC_STREAMON, &captype); - if (err < 0) { - dprintk("VIDIOCSYNC / VIDIOC_STREAMON: %ld\n", err); - goto done; - } - - pwq = kmalloc(sizeof(*pwq), GFP_KERNEL); - /* Loop as long as the buffer is queued, but not done */ - while ((buf.flags & (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)) - == V4L2_BUF_FLAG_QUEUED) { - err = poll_one(file, pwq); - if (err < 0 || /* error or sleep was interrupted */ - err == 0) /* timeout? Shouldn't occur. */ - break; - err = drv(file, VIDIOC_QUERYBUF, &buf); - if (err < 0) - dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %ld\n", err); - } - kfree(pwq); - if (!(buf.flags & V4L2_BUF_FLAG_DONE)) /* not done */ - goto done; - do { - err = drv(file, VIDIOC_DQBUF, &buf); - if (err < 0) - dprintk("VIDIOCSYNC / VIDIOC_DQBUF: %ld\n", err); - } while (err == 0 && buf.index != *i); -done: - return err; -} - -static noinline long v4l1_compat_get_vbi_format( - struct vbi_format *fmt, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_format *fmt2; - - fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); - if (!fmt2) { - err = -ENOMEM; - return err; - } - fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; - - err = drv(file, VIDIOC_G_FMT, fmt2); - if (err < 0) { - dprintk("VIDIOCGVBIFMT / VIDIOC_G_FMT: %ld\n", err); - goto done; - } - if (fmt2->fmt.vbi.sample_format != V4L2_PIX_FMT_GREY) { - err = -EINVAL; - goto done; - } - memset(fmt, 0, sizeof(*fmt)); - fmt->samples_per_line = fmt2->fmt.vbi.samples_per_line; - fmt->sampling_rate = fmt2->fmt.vbi.sampling_rate; - fmt->sample_format = VIDEO_PALETTE_RAW; - fmt->start[0] = fmt2->fmt.vbi.start[0]; - fmt->count[0] = fmt2->fmt.vbi.count[0]; - fmt->start[1] = fmt2->fmt.vbi.start[1]; - fmt->count[1] = fmt2->fmt.vbi.count[1]; - fmt->flags = fmt2->fmt.vbi.flags & 0x03; -done: - kfree(fmt2); - return err; -} - -static noinline long v4l1_compat_set_vbi_format( - struct vbi_format *fmt, - struct file *file, - v4l2_kioctl drv) -{ - long err; - struct v4l2_format *fmt2 = NULL; - - if (VIDEO_PALETTE_RAW != fmt->sample_format) { - err = -EINVAL; - return err; - } - - fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); - if (!fmt2) { - err = -ENOMEM; - return err; - } - fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; - fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line; - fmt2->fmt.vbi.sampling_rate = fmt->sampling_rate; - fmt2->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; - fmt2->fmt.vbi.start[0] = fmt->start[0]; - fmt2->fmt.vbi.count[0] = fmt->count[0]; - fmt2->fmt.vbi.start[1] = fmt->start[1]; - fmt2->fmt.vbi.count[1] = fmt->count[1]; - fmt2->fmt.vbi.flags = fmt->flags; - err = drv(file, VIDIOC_TRY_FMT, fmt2); - if (err < 0) { - dprintk("VIDIOCSVBIFMT / VIDIOC_TRY_FMT: %ld\n", err); - goto done; - } - - if (fmt2->fmt.vbi.samples_per_line != fmt->samples_per_line || - fmt2->fmt.vbi.sampling_rate != fmt->sampling_rate || - fmt2->fmt.vbi.sample_format != V4L2_PIX_FMT_GREY || - fmt2->fmt.vbi.start[0] != fmt->start[0] || - fmt2->fmt.vbi.count[0] != fmt->count[0] || - fmt2->fmt.vbi.start[1] != fmt->start[1] || - fmt2->fmt.vbi.count[1] != fmt->count[1] || - fmt2->fmt.vbi.flags != fmt->flags) { - err = -EINVAL; - goto done; - } - err = drv(file, VIDIOC_S_FMT, fmt2); - if (err < 0) - dprintk("VIDIOCSVBIFMT / VIDIOC_S_FMT: %ld\n", err); -done: - kfree(fmt2); - return err; -} - -/* - * This function is exported. - */ -long -v4l_compat_translate_ioctl(struct file *file, - int cmd, - void *arg, - v4l2_kioctl drv) -{ - long err; - - switch (cmd) { - case VIDIOCGCAP: /* capability */ - err = v4l1_compat_get_capabilities(arg, file, drv); - break; - case VIDIOCGFBUF: /* get frame buffer */ - err = v4l1_compat_get_frame_buffer(arg, file, drv); - break; - case VIDIOCSFBUF: /* set frame buffer */ - err = v4l1_compat_set_frame_buffer(arg, file, drv); - break; - case VIDIOCGWIN: /* get window or capture dimensions */ - err = v4l1_compat_get_win_cap_dimensions(arg, file, drv); - break; - case VIDIOCSWIN: /* set window and/or capture dimensions */ - err = v4l1_compat_set_win_cap_dimensions(arg, file, drv); - break; - case VIDIOCCAPTURE: /* turn on/off preview */ - err = v4l1_compat_turn_preview_on_off(arg, file, drv); - break; - case VIDIOCGCHAN: /* get input information */ - err = v4l1_compat_get_input_info(arg, file, drv); - break; - case VIDIOCSCHAN: /* set input */ - err = v4l1_compat_set_input(arg, file, drv); - break; - case VIDIOCGPICT: /* get tone controls & partial capture format */ - err = v4l1_compat_get_picture(arg, file, drv); - break; - case VIDIOCSPICT: /* set tone controls & partial capture format */ - err = v4l1_compat_set_picture(arg, file, drv); - break; - case VIDIOCGTUNER: /* get tuner information */ - err = v4l1_compat_get_tuner(arg, file, drv); - break; - case VIDIOCSTUNER: /* select a tuner input */ - err = v4l1_compat_select_tuner(arg, file, drv); - break; - case VIDIOCGFREQ: /* get frequency */ - err = v4l1_compat_get_frequency(arg, file, drv); - break; - case VIDIOCSFREQ: /* set frequency */ - err = v4l1_compat_set_frequency(arg, file, drv); - break; - case VIDIOCGAUDIO: /* get audio properties/controls */ - err = v4l1_compat_get_audio(arg, file, drv); - break; - case VIDIOCSAUDIO: /* set audio controls */ - err = v4l1_compat_set_audio(arg, file, drv); - break; - case VIDIOCMCAPTURE: /* capture a frame */ - err = v4l1_compat_capture_frame(arg, file, drv); - break; - case VIDIOCSYNC: /* wait for a frame */ - err = v4l1_compat_sync(arg, file, drv); - break; - case VIDIOCGVBIFMT: /* query VBI data capture format */ - err = v4l1_compat_get_vbi_format(arg, file, drv); - break; - case VIDIOCSVBIFMT: - err = v4l1_compat_set_vbi_format(arg, file, drv); - break; - default: - err = -ENOIOCTLCMD; - break; - } - - return err; -} -EXPORT_SYMBOL(v4l_compat_translate_ioctl); - -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index e30e8dfb620..425ac1e4a00 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c @@ -22,212 +22,6 @@ #ifdef CONFIG_COMPAT -#ifdef CONFIG_VIDEO_V4L1_COMPAT -struct video_tuner32 { - compat_int_t tuner; - char name[32]; - compat_ulong_t rangelow, rangehigh; - u32 flags; /* It is really u32 in videodev.h */ - u16 mode, signal; -}; - -static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up) -{ - if (!access_ok(VERIFY_READ, up, sizeof(struct video_tuner32)) || - get_user(kp->tuner, &up->tuner) || - copy_from_user(kp->name, up->name, 32) || - get_user(kp->rangelow, &up->rangelow) || - get_user(kp->rangehigh, &up->rangehigh) || - get_user(kp->flags, &up->flags) || - get_user(kp->mode, &up->mode) || - get_user(kp->signal, &up->signal)) - return -EFAULT; - return 0; -} - -static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up) -{ - if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_tuner32)) || - put_user(kp->tuner, &up->tuner) || - copy_to_user(up->name, kp->name, 32) || - put_user(kp->rangelow, &up->rangelow) || - put_user(kp->rangehigh, &up->rangehigh) || - put_user(kp->flags, &up->flags) || - put_user(kp->mode, &up->mode) || - put_user(kp->signal, &up->signal)) - return -EFAULT; - return 0; -} - -struct video_buffer32 { - compat_caddr_t base; - compat_int_t height, width, depth, bytesperline; -}; - -static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up) -{ - u32 tmp; - - if (!access_ok(VERIFY_READ, up, sizeof(struct video_buffer32)) || - get_user(tmp, &up->base) || - get_user(kp->height, &up->height) || - get_user(kp->width, &up->width) || - get_user(kp->depth, &up->depth) || - get_user(kp->bytesperline, &up->bytesperline)) - return -EFAULT; - - /* This is actually a physical address stored - * as a void pointer. - */ - kp->base = (void *)(unsigned long) tmp; - - return 0; -} - -static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up) -{ - u32 tmp = (u32)((unsigned long)kp->base); - - if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_buffer32)) || - put_user(tmp, &up->base) || - put_user(kp->height, &up->height) || - put_user(kp->width, &up->width) || - put_user(kp->depth, &up->depth) || - put_user(kp->bytesperline, &up->bytesperline)) - return -EFAULT; - return 0; -} - -struct video_clip32 { - s32 x, y, width, height; /* It's really s32 in videodev.h */ - compat_caddr_t next; -}; - -struct video_window32 { - u32 x, y, width, height, chromakey, flags; - compat_caddr_t clips; - compat_int_t clipcount; -}; - -static int get_video_window32(struct video_window *kp, struct video_window32 __user *up) -{ - struct video_clip __user *uclips; - struct video_clip __user *kclips; - compat_caddr_t p; - int nclips; - - if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32))) - return -EFAULT; - - if (get_user(nclips, &up->clipcount)) - return -EFAULT; - - if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32)) || - get_user(kp->x, &up->x) || - get_user(kp->y, &up->y) || - get_user(kp->width, &up->width) || - get_user(kp->height, &up->height) || - get_user(kp->chromakey, &up->chromakey) || - get_user(kp->flags, &up->flags) || - get_user(kp->clipcount, &up->clipcount)) - return -EFAULT; - - nclips = kp->clipcount; - kp->clips = NULL; - - if (nclips == 0) - return 0; - if (get_user(p, &up->clips)) - return -EFAULT; - uclips = compat_ptr(p); - - /* If nclips < 0, then it is a clipping bitmap of size - VIDEO_CLIPMAP_SIZE */ - if (nclips < 0) { - if (!access_ok(VERIFY_READ, uclips, VIDEO_CLIPMAP_SIZE)) - return -EFAULT; - kp->clips = compat_alloc_user_space(VIDEO_CLIPMAP_SIZE); - if (copy_in_user(kp->clips, uclips, VIDEO_CLIPMAP_SIZE)) - return -EFAULT; - return 0; - } - - /* Otherwise it is an array of video_clip structs. */ - if (!access_ok(VERIFY_READ, uclips, nclips * sizeof(struct video_clip))) - return -EFAULT; - - kp->clips = compat_alloc_user_space(nclips * sizeof(struct video_clip)); - kclips = kp->clips; - while (nclips--) { - int err; - - err = copy_in_user(&kclips->x, &uclips->x, sizeof(kclips->x)); - err |= copy_in_user(&kclips->y, &uclips->y, sizeof(kclips->y)); - err |= copy_in_user(&kclips->width, &uclips->width, sizeof(kclips->width)); - err |= copy_in_user(&kclips->height, &uclips->height, sizeof(kclips->height)); - kclips->next = NULL; - if (err) - return -EFAULT; - kclips++; - uclips++; - } - return 0; -} - -/* You get back everything except the clips... */ -static int put_video_window32(struct video_window *kp, struct video_window32 __user *up) -{ - if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_window32)) || - put_user(kp->x, &up->x) || - put_user(kp->y, &up->y) || - put_user(kp->width, &up->width) || - put_user(kp->height, &up->height) || - put_user(kp->chromakey, &up->chromakey) || - put_user(kp->flags, &up->flags) || - put_user(kp->clipcount, &up->clipcount)) - return -EFAULT; - return 0; -} - -struct video_code32 { - char loadwhat[16]; /* name or tag of file being passed */ - compat_int_t datasize; - compat_uptr_t data; -}; - -static struct video_code __user *get_microcode32(struct video_code32 *kp) -{ - struct video_code __user *up; - - up = compat_alloc_user_space(sizeof(*up)); - - /* - * NOTE! We don't actually care if these fail. If the - * user address is invalid, the native ioctl will do - * the error handling for us - */ - (void) copy_to_user(up->loadwhat, kp->loadwhat, sizeof(up->loadwhat)); - (void) put_user(kp->datasize, &up->datasize); - (void) put_user(compat_ptr(kp->data), &up->data); - return up; -} - -#define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32) -#define VIDIOCSTUNER32 _IOW('v', 5, struct video_tuner32) -#define VIDIOCGWIN32 _IOR('v', 9, struct video_window32) -#define VIDIOCSWIN32 _IOW('v', 10, struct video_window32) -#define VIDIOCGFBUF32 _IOR('v', 11, struct video_buffer32) -#define VIDIOCSFBUF32 _IOW('v', 12, struct video_buffer32) -#define VIDIOCGFREQ32 _IOR('v', 14, u32) -#define VIDIOCSFREQ32 _IOW('v', 15, u32) -#define VIDIOCSMICROCODE32 _IOW('v', 27, struct video_code32) - -#define VIDIOCCAPTURE32 _IOW('v', 8, s32) -#define VIDIOCSYNC32 _IOW('v', 18, s32) -#define VIDIOCSWRITEMODE32 _IOW('v', 25, s32) - -#endif - static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { long ret = -ENOIOCTLCMD; @@ -741,13 +535,6 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { union { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - struct video_tuner vt; - struct video_buffer vb; - struct video_window vw; - struct video_code32 vc; - struct video_audio va; -#endif struct v4l2_format v2f; struct v4l2_buffer v2b; struct v4l2_framebuffer v2fb; @@ -763,17 +550,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar /* First, convert the command. */ switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break; - case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break; - case VIDIOCGWIN32: cmd = VIDIOCGWIN; break; - case VIDIOCSWIN32: cmd = VIDIOCSWIN; break; - case VIDIOCGFBUF32: cmd = VIDIOCGFBUF; break; - case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break; - case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break; - case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break; - case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break; -#endif case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break; case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break; case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break; @@ -800,46 +576,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar } switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCSTUNER: - case VIDIOCGTUNER: - err = get_video_tuner32(&karg.vt, up); - compatible_arg = 0; - break; - - case VIDIOCSFBUF: - err = get_video_buffer32(&karg.vb, up); - compatible_arg = 0; - break; - - case VIDIOCSWIN: - err = get_video_window32(&karg.vw, up); - compatible_arg = 0; - break; - - case VIDIOCGWIN: - case VIDIOCGFBUF: - case VIDIOCGFREQ: - compatible_arg = 0; - break; - - case VIDIOCSMICROCODE: - /* Copy the 32-bit "video_code32" to kernel space */ - if (copy_from_user(&karg.vc, up, sizeof(karg.vc))) - return -EFAULT; - /* Convert the 32-bit version to a 64-bit version in user space */ - up = get_microcode32(&karg.vc); - break; - - case VIDIOCSFREQ: - err = get_user(karg.vx, (u32 __user *)up); - compatible_arg = 0; - break; - - case VIDIOCCAPTURE: - case VIDIOCSYNC: - case VIDIOCSWRITEMODE: -#endif case VIDIOC_OVERLAY: case VIDIOC_STREAMON: case VIDIOC_STREAMOFF: @@ -922,23 +658,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar return err; switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCGTUNER: - err = put_video_tuner32(&karg.vt, up); - break; - - case VIDIOCGWIN: - err = put_video_window32(&karg.vw, up); - break; - - case VIDIOCGFBUF: - err = put_video_buffer32(&karg.vb, up); - break; - - case VIDIOCGFREQ: - err = put_user(((u32)karg.vx), (u32 __user *)up); - break; -#endif case VIDIOC_S_INPUT: case VIDIOC_S_OUTPUT: case VIDIOC_G_INPUT: @@ -981,37 +700,6 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) return ret; switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCGCAP: - case VIDIOCGCHAN: - case VIDIOCSCHAN: - case VIDIOCGTUNER32: - case VIDIOCSTUNER32: - case VIDIOCGPICT: - case VIDIOCSPICT: - case VIDIOCCAPTURE32: - case VIDIOCGWIN32: - case VIDIOCSWIN32: - case VIDIOCGFBUF32: - case VIDIOCSFBUF32: - case VIDIOCKEY: - case VIDIOCGFREQ32: - case VIDIOCSFREQ32: - case VIDIOCGAUDIO: - case VIDIOCSAUDIO: - case VIDIOCSYNC32: - case VIDIOCMCAPTURE: - case VIDIOCGMBUF: - case VIDIOCGUNIT: - case VIDIOCGCAPTURE: - case VIDIOCSCAPTURE: - case VIDIOCSPLAYMODE: - case VIDIOCSWRITEMODE32: - case VIDIOCGPLAYINFO: - case VIDIOCSMICROCODE32: - case VIDIOCGVBIFMT: - case VIDIOCSVBIFMT: -#endif #ifdef __OLD_VIDIOC_ case VIDIOC_OVERLAY32_OLD: case VIDIOC_S_PARM_OLD: @@ -1096,19 +784,6 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) ret = do_video_ioctl(file, cmd, arg); break; -#ifdef CONFIG_VIDEO_V4L1_COMPAT - /* BTTV specific... */ - case _IOW('v', BASE_VIDIOCPRIVATE+0, char [256]): - case _IOR('v', BASE_VIDIOCPRIVATE+1, char [256]): - case _IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int): - case _IOW('v' , BASE_VIDIOCPRIVATE+3, char [16]): /* struct bttv_pll_info */ - case _IOR('v' , BASE_VIDIOCPRIVATE+4, int): - case _IOR('v' , BASE_VIDIOCPRIVATE+5, int): - case _IOR('v' , BASE_VIDIOCPRIVATE+6, int): - case _IOR('v' , BASE_VIDIOCPRIVATE+7, int): - ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); - break; -#endif default: printk(KERN_WARNING "compat_ioctl32: " "unknown ioctl '%c', dir=%d, #%d (0x%08x)\n", diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index dd9283fcb56..7e47f15f350 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c @@ -18,12 +18,8 @@ #include <linux/kernel.h> #define __OLD_VIDIOC_ /* To allow fixing old calls */ -#include <linux/videodev.h> #include <linux/videodev2.h> -#ifdef CONFIG_VIDEO_V4L1 -#include <linux/videodev.h> -#endif #include <media/v4l2-common.h> #include <media/v4l2-ioctl.h> #include <media/v4l2-ctrls.h> @@ -183,42 +179,6 @@ static const char *v4l2_memory_names[] = { /* ------------------------------------------------------------------ */ /* debug help functions */ - -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static const char *v4l1_ioctls[] = { - [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", - [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", - [_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN", - [_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER", - [_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER", - [_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT", - [_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT", - [_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE", - [_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN", - [_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN", - [_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF", - [_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF", - [_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY", - [_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ", - [_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ", - [_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO", - [_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO", - [_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC", - [_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE", - [_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF", - [_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT", - [_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE", - [_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE", - [_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE", - [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE", - [_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO", - [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE", - [_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT", - [_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT" -}; -#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls) -#endif - static const char *v4l2_ioctls[] = { [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP", [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED", @@ -310,15 +270,6 @@ void v4l_printk_ioctl(unsigned int cmd) case 'd': type = "v4l2_int"; break; -#ifdef CONFIG_VIDEO_V4L1_COMPAT - case 'v': - if (_IOC_NR(cmd) >= V4L1_IOCTLS) { - type = "v4l1"; - break; - } - printk("%s", v4l1_ioctls[_IOC_NR(cmd)]); - return; -#endif case 'V': if (_IOC_NR(cmd) >= V4L2_IOCTLS) { type = "v4l2"; @@ -622,20 +573,6 @@ static long __video_do_ioctl(struct file *file, return -EINVAL; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT - /******************************************************** - All other V4L1 calls are handled by v4l1_compat module. - Those calls will be translated into V4L2 calls, and - __video_do_ioctl will be called again, with one or more - V4L2 ioctls. - ********************************************************/ - if (_IOC_TYPE(cmd) == 'v' && cmd != VIDIOCGMBUF && - _IOC_NR(cmd) < BASE_VIDIOCPRIVATE) { - return v4l_compat_translate_ioctl(file, cmd, arg, - __video_do_ioctl); - } -#endif - if ((vfd->debug & V4L2_DEBUG_IOCTL) && !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { v4l_print_ioctl(vfd->name, cmd); @@ -644,29 +581,6 @@ static long __video_do_ioctl(struct file *file, switch (cmd) { -#ifdef CONFIG_VIDEO_V4L1_COMPAT - /*********************************************************** - Handles calls to the obsoleted V4L1 API - Due to the nature of VIDIOCGMBUF, each driver that supports - V4L1 should implement its own handler for this ioctl. - ***********************************************************/ - - /* --- streaming capture ------------------------------------- */ - case VIDIOCGMBUF: - { - struct video_mbuf *p = arg; - - if (!ops->vidiocgmbuf) - break; - ret = ops->vidiocgmbuf(file, fh, p); - if (!ret) - dbgarg(cmd, "size=%d, frames=%d, offsets=0x%08lx\n", - p->size, p->frames, - (unsigned long)p->offsets); - break; - } -#endif - /* --- capabilities ------------------------------------------ */ case VIDIOC_QUERYCAP: { diff --git a/drivers/media/video/via-camera.c b/drivers/media/video/via-camera.c index 9eda7cc0312..e25aca5759f 100644 --- a/drivers/media/video/via-camera.c +++ b/drivers/media/video/via-camera.c @@ -1161,16 +1161,6 @@ out: return ret; } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int viacam_vidiocgmbuf(struct file *filp, void *priv, - struct video_mbuf *mbuf) -{ - struct via_camera *cam = priv; - - return videobuf_cgmbuf(&cam->vb_queue, mbuf, 6); -} -#endif - /* G/S_PARM */ static int viacam_g_parm(struct file *filp, void *priv, @@ -1251,9 +1241,6 @@ static const struct v4l2_ioctl_ops viacam_ioctl_ops = { .vidioc_s_parm = viacam_s_parm, .vidioc_enum_framesizes = viacam_enum_framesizes, .vidioc_enum_frameintervals = viacam_enum_frameintervals, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = viacam_vidiocgmbuf, -#endif }; /*----------------------------------------------------------------------------*/ diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 8979f91fa8e..de4fa4eb884 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -1202,33 +1202,3 @@ int videobuf_mmap_mapper(struct videobuf_queue *q, struct vm_area_struct *vma) return rc; } EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); - -#ifdef CONFIG_VIDEO_V4L1_COMPAT -int videobuf_cgmbuf(struct videobuf_queue *q, - struct video_mbuf *mbuf, int count) -{ - struct v4l2_requestbuffers req; - int rc, i; - - MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); - - memset(&req, 0, sizeof(req)); - req.type = q->type; - req.count = count; - req.memory = V4L2_MEMORY_MMAP; - rc = videobuf_reqbufs(q, &req); - if (rc < 0) - return rc; - - mbuf->frames = req.count; - mbuf->size = 0; - for (i = 0; i < mbuf->frames; i++) { - mbuf->offsets[i] = q->bufs[i]->boff; - mbuf->size += PAGE_ALIGN(q->bufs[i]->bsize); - } - - return 0; -} -EXPORT_SYMBOL_GPL(videobuf_cgmbuf); -#endif - diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index ab684e80703..9d520601c70 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c @@ -570,29 +570,6 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, } last = first; -#ifdef CONFIG_VIDEO_V4L1_COMPAT - if (size != (vma->vm_end - vma->vm_start)) { - /* look for last buffer to map */ - for (last = first + 1; last < VIDEO_MAX_FRAME; last++) { - if (NULL == q->bufs[last]) - continue; - if (V4L2_MEMORY_MMAP != q->bufs[last]->memory) - continue; - if (q->bufs[last]->map) { - retval = -EBUSY; - goto done; - } - size += PAGE_ALIGN(q->bufs[last]->bsize); - if (size == (vma->vm_end - vma->vm_start)) - break; - } - if (VIDEO_MAX_FRAME == last) { - dprintk(1, "mmap app bug: size invalid [size=0x%lx]\n", - (vma->vm_end - vma->vm_start)); - goto done; - } - } -#endif /* create mapping + update buffer list */ retval = -ENOMEM; diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 9797e5a6926..c49c39386bd 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -870,15 +870,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) file->f_flags & O_NONBLOCK); } -#ifdef CONFIG_VIDEO_V4L1_COMPAT -static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) -{ - struct vivi_dev *dev = video_drvdata(file); - - return videobuf_cgmbuf(&dev->vb_vidq, mbuf, 8); -} -#endif - static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) { struct vivi_dev *dev = video_drvdata(file); @@ -1105,9 +1096,6 @@ static const struct v4l2_ioctl_ops vivi_ioctl_ops = { .vidioc_queryctrl = vidioc_queryctrl, .vidioc_g_ctrl = vidioc_g_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl, -#ifdef CONFIG_VIDEO_V4L1_COMPAT - .vidiocgmbuf = vidiocgmbuf, -#endif }; static struct video_device vivi_template = { |