include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / media / video / em28xx / em28xx-vbi.c
index b5802d4..7f1c4a2 100644 (file)
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/slab.h>
 
 #include "em28xx.h"
 
 static unsigned int vbibufs = 5;
-module_param(vbibufs,int,0644);
-MODULE_PARM_DESC(vbibufs,"number of vbi buffers, range 2-32");
+module_param(vbibufs, int, 0644);
+MODULE_PARM_DESC(vbibufs, "number of vbi buffers, range 2-32");
 
 static unsigned int vbi_debug;
-module_param(vbi_debug,int,0644);
-MODULE_PARM_DESC(vbi_debug,"enable debug messages [vbi]");
+module_param(vbi_debug, int, 0644);
+MODULE_PARM_DESC(vbi_debug, "enable debug messages [vbi]");
 
-#define dprintk(level,fmt, arg...)     if (vbi_debug >= level) \
+#define dprintk(level, fmt, arg...)    if (vbi_debug >= level) \
        printk(KERN_DEBUG "%s: " fmt, dev->core->name , ## arg)
 
 /* ------------------------------------------------------------------ */
@@ -71,7 +70,11 @@ free_buffer(struct videobuf_queue *vq, struct em28xx_buffer *buf)
 static int
 vbi_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
 {
-       *size = 720 * 12 * 2;
+       struct em28xx_fh     *fh  = q->priv_data;
+       struct em28xx        *dev = fh->dev;
+
+       *size = dev->vbi_width * dev->vbi_height * 2;
+
        if (0 == *count)
                *count = vbibufs;
        if (*count < 2)
@@ -86,19 +89,17 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
            enum v4l2_field field)
 {
        struct em28xx_fh     *fh  = q->priv_data;
+       struct em28xx        *dev = fh->dev;
        struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb);
        int                  rc = 0;
-       unsigned int size;
 
-       size = 720 * 12 * 2;
-
-       buf->vb.size = size;
+       buf->vb.size = dev->vbi_width * dev->vbi_height * 2;
 
        if (0 != buf->vb.baddr  &&  buf->vb.bsize < buf->vb.size)
                return -EINVAL;
 
-       buf->vb.width  = 720;
-       buf->vb.height = 12;
+       buf->vb.width  = dev->vbi_width;
+       buf->vb.height = dev->vbi_height;
        buf->vb.field  = field;
 
        if (VIDEOBUF_NEEDS_INIT == buf->vb.state) {
@@ -141,10 +142,3 @@ struct videobuf_queue_ops em28xx_vbi_qops = {
        .buf_queue    = vbi_queue,
        .buf_release  = vbi_release,
 };
-
-/* ------------------------------------------------------------------ */
-/*
- * Local variables:
- * c-basic-offset: 8
- * End:
- */