omap_vout: fix compiler warning
[pandora-kernel.git] / drivers / media / video / omap / omap_vout.c
index ee0d0b3..36324d8 100644 (file)
@@ -206,19 +206,21 @@ static u32 omap_vout_uservirt_to_phys(u32 virtp)
        struct vm_area_struct *vma;
        struct mm_struct *mm = current->mm;
 
-       vma = find_vma(mm, virtp);
        /* For kernel direct-mapped memory, take the easy way */
-       if (virtp >= PAGE_OFFSET) {
-               physp = virt_to_phys((void *) virtp);
-       } else if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) {
+       if (virtp >= PAGE_OFFSET)
+               return virt_to_phys((void *) virtp);
+
+       down_read(&current->mm->mmap_sem);
+       vma = find_vma(mm, virtp);
+       if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) {
                /* this will catch, kernel-allocated, mmaped-to-usermode
                   addresses */
                physp = (vma->vm_pgoff << PAGE_SHIFT) + (virtp - vma->vm_start);
+               up_read(&current->mm->mmap_sem);
        } else {
                /* otherwise, use get_user_pages() for general userland pages */
                int res, nr_pages = 1;
                struct page *pages;
-               down_read(&current->mm->mmap_sem);
 
                res = get_user_pages(current, current->mm, virtp, nr_pages, 1,
                                0, &pages, NULL);
@@ -334,8 +336,6 @@ static int video_mode_to_dss_mode(struct omap_vout_device *vout)
        ovl = ovid->overlays[0];
 
        switch (pix->pixelformat) {
-       case 0:
-               break;
        case V4L2_PIX_FMT_YUYV:
                mode = OMAP_DSS_COLOR_YUV2;
                break;
@@ -357,6 +357,7 @@ static int video_mode_to_dss_mode(struct omap_vout_device *vout)
                break;
        default:
                mode = -EINVAL;
+               break;
        }
        return mode;
 }
@@ -1041,7 +1042,8 @@ static int vidioc_querycap(struct file *file, void *fh,
        strlcpy(cap->driver, VOUT_NAME, sizeof(cap->driver));
        strlcpy(cap->card, vout->vfd->name, sizeof(cap->card));
        cap->bus_info[0] = '\0';
-       cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_OUTPUT;
+       cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_OUTPUT |
+               V4L2_CAP_VIDEO_OUTPUT_OVERLAY;
 
        return 0;
 }
@@ -1823,7 +1825,9 @@ static int vidioc_g_fbuf(struct file *file, void *fh,
        ovid = &vout->vid_info;
        ovl = ovid->overlays[0];
 
-       a->flags = 0x0;
+       /* The video overlay must stay within the framebuffer and can't be
+          positioned independently. */
+       a->flags = V4L2_FBUF_FLAG_OVERLAY;
        a->capability = V4L2_FBUF_CAP_LOCAL_ALPHA | V4L2_FBUF_CAP_CHROMAKEY
                | V4L2_FBUF_CAP_SRC_CHROMAKEY;
 
@@ -2263,13 +2267,12 @@ static struct platform_driver omap_vout_driver = {
        .driver = {
                .name = VOUT_NAME,
        },
-       .probe = omap_vout_probe,
        .remove = omap_vout_remove,
 };
 
 static int __init omap_vout_init(void)
 {
-       if (platform_driver_register(&omap_vout_driver) != 0) {
+       if (platform_driver_probe(&omap_vout_driver, omap_vout_probe) != 0) {
                printk(KERN_ERR VOUT_NAME ":Could not register Video driver\n");
                return -EINVAL;
        }