]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/cx23885/cx23885-video.c
Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
[linux-2.6-omap-h63xx.git] / drivers / media / video / cx23885 / cx23885-video.c
index 6047c78d84bf5c2b26576e734e73e04f2724eb6c..c742a10be5cb2f9a94972b5f20d9eeb5ad355063 100644 (file)
@@ -244,7 +244,7 @@ static struct cx23885_ctrl cx23885_ctls[] = {
 };
 static const int CX23885_CTLS = ARRAY_SIZE(cx23885_ctls);
 
-const u32 cx23885_user_ctrls[] = {
+static const u32 cx23885_user_ctrls[] = {
        V4L2_CID_USER_CLASS,
        V4L2_CID_BRIGHTNESS,
        V4L2_CID_CONTRAST,
@@ -254,14 +254,13 @@ const u32 cx23885_user_ctrls[] = {
        V4L2_CID_AUDIO_MUTE,
        0
 };
-EXPORT_SYMBOL(cx23885_user_ctrls);
 
 static const u32 *ctrl_classes[] = {
        cx23885_user_ctrls,
        NULL
 };
 
-void cx23885_video_wakeup(struct cx23885_dev *dev,
+static void cx23885_video_wakeup(struct cx23885_dev *dev,
                 struct cx23885_dmaqueue *q, u32 count)
 {
        struct cx23885_buffer *buf;
@@ -286,17 +285,16 @@ void cx23885_video_wakeup(struct cx23885_dev *dev,
                list_del(&buf->vb.queue);
                wake_up(&buf->vb.done);
        }
-       if (list_empty(&q->active)) {
+       if (list_empty(&q->active))
                del_timer(&q->timeout);
-       } else {
+       else
                mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT);
-       }
        if (bc != 1)
                printk(KERN_ERR "%s: %d buffers handled (should be 1)\n",
                        __func__, bc);
 }
 
-int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm)
+static int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm)
 {
        dprintk(1, "%s(norm = 0x%08x) name: [%s]\n",
                __func__,
@@ -314,7 +312,7 @@ int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm)
        return 0;
 }
 
-struct video_device *cx23885_vdev_init(struct cx23885_dev *dev,
+static struct video_device *cx23885_vdev_init(struct cx23885_dev *dev,
                                    struct pci_dev *pci,
                                    struct video_device *template,
                                    char *type)
@@ -334,7 +332,7 @@ struct video_device *cx23885_vdev_init(struct cx23885_dev *dev,
        return vfd;
 }
 
-int cx23885_ctrl_query(struct v4l2_queryctrl *qctrl)
+static int cx23885_ctrl_query(struct v4l2_queryctrl *qctrl)
 {
        int i;
 
@@ -351,7 +349,6 @@ int cx23885_ctrl_query(struct v4l2_queryctrl *qctrl)
        *qctrl = cx23885_ctls[i].v;
        return 0;
 }
-EXPORT_SYMBOL(cx23885_ctrl_query);
 
 /* ------------------------------------------------------------------- */
 /* resource management                                                 */
@@ -381,12 +378,12 @@ static int res_get(struct cx23885_dev *dev, struct cx23885_fh *fh,
 
 static int res_check(struct cx23885_fh *fh, unsigned int bit)
 {
-       return (fh->resources & bit);
+       return fh->resources & bit;
 }
 
 static int res_locked(struct cx23885_dev *dev, unsigned int bit)
 {
-       return (dev->resources & bit);
+       return dev->resources & bit;
 }
 
 static void res_free(struct cx23885_dev *dev, struct cx23885_fh *fh,
@@ -402,7 +399,7 @@ static void res_free(struct cx23885_dev *dev, struct cx23885_fh *fh,
        mutex_unlock(&dev->lock);
 }
 
-int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input)
+static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input)
 {
        struct v4l2_routing route;
        memset(&route, 0, sizeof(route));
@@ -422,10 +419,9 @@ int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input)
 
        return 0;
 }
-EXPORT_SYMBOL(cx23885_video_mux);
 
 /* ------------------------------------------------------------------ */
-int cx23885_set_scale(struct cx23885_dev *dev, unsigned int width,
+static int cx23885_set_scale(struct cx23885_dev *dev, unsigned int width,
        unsigned int height, enum v4l2_field field)
 {
        dprintk(1, "%s()\n", __func__);
@@ -731,6 +727,7 @@ static int video_open(struct inode *inode, struct file *file)
        enum v4l2_buf_type type = 0;
        int radio = 0;
 
+       lock_kernel();
        list_for_each(list, &cx23885_devlist) {
                h = list_entry(list, struct cx23885_dev, devlist);
                if (h->video_dev->minor == minor) {
@@ -748,16 +745,20 @@ static int video_open(struct inode *inode, struct file *file)
                        dev   = h;
                }
        }
-       if (NULL == dev)
+       if (NULL == dev) {
+               unlock_kernel();
                return -ENODEV;
+       }
 
        dprintk(1, "open minor=%d radio=%d type=%s\n",
                minor, radio, v4l2_type_names[type]);
 
        /* allocate + initialize per filehandle data */
        fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-       if (NULL == fh)
+       if (NULL == fh) {
+               unlock_kernel();
                return -ENOMEM;
+       }
        file->private_data = fh;
        fh->dev      = dev;
        fh->radio    = radio;
@@ -775,6 +776,7 @@ static int video_open(struct inode *inode, struct file *file)
 
        dprintk(1, "post videobuf_queue_init()\n");
 
+       unlock_kernel();
 
        return 0;
 }
@@ -884,21 +886,21 @@ static int video_mmap(struct file *file, struct vm_area_struct *vma)
 /* ------------------------------------------------------------------ */
 /* VIDEO CTRL IOCTLS                                                  */
 
-int cx23885_get_control(struct cx23885_dev *dev, struct v4l2_control *ctl)
+static int cx23885_get_control(struct cx23885_dev *dev,
+       struct v4l2_control *ctl)
 {
        dprintk(1, "%s() calling cx25840(VIDIOC_G_CTRL)\n", __func__);
        cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_G_CTRL, ctl);
        return 0;
 }
-EXPORT_SYMBOL(cx23885_get_control);
 
-int cx23885_set_control(struct cx23885_dev *dev, struct v4l2_control *ctl)
+static int cx23885_set_control(struct cx23885_dev *dev,
+       struct v4l2_control *ctl)
 {
        dprintk(1, "%s() calling cx25840(VIDIOC_S_CTRL)"
                " (disabled - no action)\n", __func__);
        return 0;
 }
-EXPORT_SYMBOL(cx23885_set_control);
 
 static void init_controls(struct cx23885_dev *dev)
 {
@@ -1072,29 +1074,29 @@ static int vidioc_reqbufs(struct file *file, void *priv,
        struct v4l2_requestbuffers *p)
 {
        struct cx23885_fh *fh = priv;
-       return (videobuf_reqbufs(get_queue(fh), p));
+       return videobuf_reqbufs(get_queue(fh), p);
 }
 
 static int vidioc_querybuf(struct file *file, void *priv,
        struct v4l2_buffer *p)
 {
        struct cx23885_fh *fh = priv;
-       return (videobuf_querybuf(get_queue(fh), p));
+       return videobuf_querybuf(get_queue(fh), p);
 }
 
 static int vidioc_qbuf(struct file *file, void *priv,
        struct v4l2_buffer *p)
 {
        struct cx23885_fh *fh = priv;
-       return (videobuf_qbuf(get_queue(fh), p));
+       return videobuf_qbuf(get_queue(fh), p);
 }
 
 static int vidioc_dqbuf(struct file *file, void *priv,
        struct v4l2_buffer *p)
 {
        struct cx23885_fh *fh = priv;
-       return (videobuf_dqbuf(get_queue(fh), p,
-                               file->f_flags & O_NONBLOCK));
+       return videobuf_dqbuf(get_queue(fh), p,
+                               file->f_flags & O_NONBLOCK);
 }
 
 static int vidioc_streamon(struct file *file, void *priv,
@@ -1146,7 +1148,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *tvnorms)
        return 0;
 }
 
-int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i)
+static int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i)
 {
        static const char *iname[] = {
                [CX23885_VMUX_COMPOSITE1] = "Composite1",
@@ -1179,7 +1181,6 @@ int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i)
                i->std = CX23885_NORMS;
        return 0;
 }
-EXPORT_SYMBOL(cx23885_enum_input);
 
 static int vidioc_enum_input(struct file *file, void *priv,
                                struct v4l2_input *i)
@@ -1288,7 +1289,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
        return 0;
 }
 
-int cx23885_set_freq(struct cx23885_dev *dev, struct v4l2_frequency *f)
+static int cx23885_set_freq(struct cx23885_dev *dev, struct v4l2_frequency *f)
 {
        if (unlikely(UNSET == dev->tuner_type))
                return -EINVAL;
@@ -1307,7 +1308,6 @@ int cx23885_set_freq(struct cx23885_dev *dev, struct v4l2_frequency *f)
 
        return 0;
 }
-EXPORT_SYMBOL(cx23885_set_freq);
 
 static int vidioc_s_frequency(struct file *file, void *priv,
                                struct v4l2_frequency *f)
@@ -1543,7 +1543,7 @@ int cx23885_video_register(struct cx23885_dev *dev)
                goto fail_unreg;
        }
        printk(KERN_INFO "%s/0: registered device video%d [v4l2]\n",
-              dev->name, dev->video_dev->minor & 0x1f);
+              dev->name, dev->video_dev->num);
        /* initial device configuration */
        mutex_lock(&dev->lock);
        cx23885_set_tvnorm(dev, dev->tvnorm);