]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/stk-webcam.c
V4L/DVB (8482): videodev: move all ioctl callbacks to a new v4l2_ioctl_ops struct
[linux-2.6-omap-h63xx.git] / drivers / media / video / stk-webcam.c
index ceba45ad02942622edd1c67f8aecb9d65306c1e7..8d5fa95ad95a2375a65f6fc71df6fa3cfeccfa84 100644 (file)
 #include <linux/kref.h>
 
 #include <linux/usb.h>
+#include <linux/mm.h>
 #include <linux/vmalloc.h>
 #include <linux/videodev2.h>
 #include <media/v4l2-common.h>
+#include <media/v4l2-ioctl.h>
 
 #include "stk-webcam.h"
 
@@ -245,6 +247,8 @@ static int stk_initialise(struct stk_camera *dev)
                return -1;
 }
 
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
+
 /* sysfs functions */
 /*FIXME cleanup this */
 
@@ -350,6 +354,10 @@ static void stk_remove_sysfs_files(struct video_device *vdev)
        video_device_remove_file(vdev, &dev_attr_vflip);
 }
 
+#else
+#define stk_create_sysfs_files(a)
+#define stk_remove_sysfs_files(a)
+#endif
 
 /* *********************************************** */
 /*
@@ -974,7 +982,7 @@ static int stk_vidioc_s_ctrl(struct file *filp,
 }
 
 
-static int stk_vidioc_enum_fmt_cap(struct file *filp,
+static int stk_vidioc_enum_fmt_vid_cap(struct file *filp,
                void *priv, struct v4l2_fmtdesc *fmtd)
 {
        fmtd->flags = 0;
@@ -1018,7 +1026,7 @@ static struct stk_size {
        { .w = 176,  .h = 144,  .m = MODE_QCIF, },
 };
 
-static int stk_vidioc_g_fmt_cap(struct file *filp,
+static int stk_vidioc_g_fmt_vid_cap(struct file *filp,
                void *priv, struct v4l2_format *f)
 {
        struct v4l2_pix_format *pix_format = &f->fmt.pix;
@@ -1047,7 +1055,7 @@ static int stk_vidioc_g_fmt_cap(struct file *filp,
        return 0;
 }
 
-static int stk_vidioc_try_fmt_cap(struct file *filp,
+static int stk_vidioc_try_fmt_vid_cap(struct file *filp,
                void *priv, struct v4l2_format *fmtd)
 {
        int i;
@@ -1100,7 +1108,7 @@ static int stk_setup_format(struct stk_camera *dev)
                        && i < ARRAY_SIZE(stk_sizes))
                i++;
        if (i == ARRAY_SIZE(stk_sizes)) {
-               STK_ERROR("Something is broken in %s\n", __FUNCTION__);
+               STK_ERROR("Something is broken in %s\n", __func__);
                return -EFAULT;
        }
        /* This registers controls some timings, not sure of what. */
@@ -1124,7 +1132,7 @@ static int stk_setup_format(struct stk_camera *dev)
        return stk_sensor_configure(dev);
 }
 
-static int stk_vidioc_s_fmt_cap(struct file *filp,
+static int stk_vidioc_s_fmt_vid_cap(struct file *filp,
                void *priv, struct v4l2_format *fmtd)
 {
        int ret;
@@ -1138,7 +1146,7 @@ static int stk_vidioc_s_fmt_cap(struct file *filp,
                return -EBUSY;
        if (dev->owner && dev->owner != filp)
                return -EBUSY;
-       ret = stk_vidioc_try_fmt_cap(filp, priv, fmtd);
+       ret = stk_vidioc_try_fmt_vid_cap(filp, priv, fmtd);
        if (ret)
                return ret;
        dev->owner = filp;
@@ -1320,25 +1328,12 @@ static struct file_operations v4l_stk_fops = {
        .llseek = no_llseek
 };
 
-static void stk_v4l_dev_release(struct video_device *vd)
-{
-}
-
-static struct video_device stk_v4l_data = {
-       .name = "stkwebcam",
-       .type = VFL_TYPE_GRABBER,
-       .type2 = VID_TYPE_CAPTURE,
-       .minor = -1,
-       .tvnorms = V4L2_STD_UNKNOWN,
-       .current_norm = V4L2_STD_UNKNOWN,
-       .fops = &v4l_stk_fops,
-       .release = stk_v4l_dev_release,
-
+static const struct v4l2_ioctl_ops v4l_stk_ioctl_ops = {
        .vidioc_querycap = stk_vidioc_querycap,
-       .vidioc_enum_fmt_cap = stk_vidioc_enum_fmt_cap,
-       .vidioc_try_fmt_cap = stk_vidioc_try_fmt_cap,
-       .vidioc_s_fmt_cap = stk_vidioc_s_fmt_cap,
-       .vidioc_g_fmt_cap = stk_vidioc_g_fmt_cap,
+       .vidioc_enum_fmt_vid_cap = stk_vidioc_enum_fmt_vid_cap,
+       .vidioc_try_fmt_vid_cap = stk_vidioc_try_fmt_vid_cap,
+       .vidioc_s_fmt_vid_cap = stk_vidioc_s_fmt_vid_cap,
+       .vidioc_g_fmt_vid_cap = stk_vidioc_g_fmt_vid_cap,
        .vidioc_enum_input = stk_vidioc_enum_input,
        .vidioc_s_input = stk_vidioc_s_input,
        .vidioc_g_input = stk_vidioc_g_input,
@@ -1355,6 +1350,22 @@ static struct video_device stk_v4l_data = {
        .vidioc_g_parm = stk_vidioc_g_parm,
 };
 
+static void stk_v4l_dev_release(struct video_device *vd)
+{
+}
+
+static struct video_device stk_v4l_data = {
+       .name = "stkwebcam",
+       .type = VFL_TYPE_GRABBER,
+       .type2 = VID_TYPE_CAPTURE,
+       .minor = -1,
+       .tvnorms = V4L2_STD_UNKNOWN,
+       .current_norm = V4L2_STD_UNKNOWN,
+       .fops = &v4l_stk_fops,
+       .ioctl_ops = &v4l_stk_ioctl_ops,
+       .release = stk_v4l_dev_release,
+};
+
 
 static int stk_register_video_device(struct stk_camera *dev)
 {
@@ -1362,7 +1373,7 @@ static int stk_register_video_device(struct stk_camera *dev)
 
        dev->vdev = stk_v4l_data;
        dev->vdev.debug = debug;
-       dev->vdev.dev = &dev->interface->dev;
+       dev->vdev.parent = &dev->interface->dev;
        dev->vdev.priv = dev;
        err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1);
        if (err)
@@ -1465,7 +1476,7 @@ static void stk_camera_disconnect(struct usb_interface *interface)
 }
 
 #ifdef CONFIG_PM
-int stk_camera_suspend(struct usb_interface *intf, pm_message_t message)
+static int stk_camera_suspend(struct usb_interface *intf, pm_message_t message)
 {
        struct stk_camera *dev = usb_get_intfdata(intf);
        if (is_streaming(dev)) {
@@ -1476,7 +1487,7 @@ int stk_camera_suspend(struct usb_interface *intf, pm_message_t message)
        return 0;
 }
 
-int stk_camera_resume(struct usb_interface *intf)
+static int stk_camera_resume(struct usb_interface *intf)
 {
        struct stk_camera *dev = usb_get_intfdata(intf);
        if (!is_initialised(dev))