drm/drm_crtc: return -EFAULT on copy_to_user errors
[safe/jmp/linux-2.6] / drivers / video / bf54x-lq043fb.c
index e49ae5e..b020ba7 100644 (file)
@@ -82,7 +82,6 @@ struct bfin_bf54xfb_info {
        unsigned char *fb_buffer;       /* RGB Buffer */
 
        dma_addr_t dma_handle;
-       int lq043_mmap;
        int lq043_open_cnt;
        int irq;
        spinlock_t lock;        /* lock */
@@ -316,7 +315,6 @@ static int bfin_bf54x_fb_release(struct fb_info *info, int user)
        spin_lock(&fbi->lock);
 
        fbi->lq043_open_cnt--;
-       fbi->lq043_mmap = 0;
 
        if (fbi->lq043_open_cnt <= 0) {
 
@@ -374,33 +372,6 @@ static int bfin_bf54x_fb_check_var(struct fb_var_screeninfo *var,
        return 0;
 }
 
-static int bfin_bf54x_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
-{
-
-       struct bfin_bf54xfb_info *fbi = info->par;
-
-       if (fbi->lq043_mmap)
-               return -1;
-
-       spin_lock(&fbi->lock);
-       fbi->lq043_mmap = 1;
-       spin_unlock(&fbi->lock);
-
-       vma->vm_start = (unsigned long)(fbi->fb_buffer);
-
-       vma->vm_end = vma->vm_start + info->fix.smem_len;
-       /* For those who don't understand how mmap works, go read
-        *   Documentation/nommu-mmap.txt.
-        * For those that do, you will know that the VM_MAYSHARE flag
-        * must be set in the vma->vm_flags structure on noMMU
-        *   Other flags can be set, and are documented in
-        *   include/linux/mm.h
-        */
-       vma->vm_flags |=  VM_MAYSHARE | VM_SHARED;
-
-       return 0;
-}
-
 int bfin_bf54x_fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
 {
        if (nocursor)
@@ -452,7 +423,6 @@ static struct fb_ops bfin_bf54x_fb_ops = {
        .fb_fillrect = cfb_fillrect,
        .fb_copyarea = cfb_copyarea,
        .fb_imageblit = cfb_imageblit,
-       .fb_mmap = bfin_bf54x_fb_mmap,
        .fb_cursor = bfin_bf54x_fb_cursor,
        .fb_setcolreg = bfin_bf54x_fb_setcolreg,
 };
@@ -463,7 +433,7 @@ static int bl_get_brightness(struct backlight_device *bd)
        return 0;
 }
 
-static struct backlight_ops bfin_lq043fb_bl_ops = {
+static const struct backlight_ops bfin_lq043fb_bl_ops = {
        .get_brightness = bl_get_brightness,
 };
 
@@ -531,6 +501,9 @@ static irqreturn_t bfin_bf54x_irq_error(int irq, void *dev_id)
 
 static int __devinit bfin_bf54x_probe(struct platform_device *pdev)
 {
+#ifndef NO_BL_SUPPORT
+       struct backlight_properties props;
+#endif
        struct bfin_bf54xfb_info *info;
        struct fb_info *fbinfo;
        int ret;
@@ -675,10 +648,17 @@ static int __devinit bfin_bf54x_probe(struct platform_device *pdev)
                goto out8;
        }
 #ifndef NO_BL_SUPPORT
-       bl_dev =
-           backlight_device_register("bf54x-bl", NULL, NULL,
-                                     &bfin_lq043fb_bl_ops);
-       bl_dev->props.max_brightness = 255;
+       memset(&props, 0, sizeof(struct backlight_properties));
+       props.max_brightness = 255;
+       bl_dev = backlight_device_register("bf54x-bl", NULL, NULL,
+                                          &bfin_lq043fb_bl_ops, &props);
+       if (IS_ERR(bl_dev)) {
+               printk(KERN_ERR DRIVER_NAME
+                       ": unable to register backlight.\n");
+               ret = -EINVAL;
+               unregister_framebuffer(fbinfo);
+               goto out8;
+       }
 
        lcd_dev = lcd_device_register(DRIVER_NAME, &pdev->dev, NULL, &bfin_lcd_ops);
        lcd_dev->props.max_contrast = 255, printk(KERN_INFO "Done.\n");