diff options
Diffstat (limited to 'drivers/video/fbmem.c')
-rw-r--r-- | drivers/video/fbmem.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index f8a09bf8d0cd..a85c818be945 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/compat.h> | 16 | #include <linux/compat.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
19 | #include <linux/smp_lock.h> | ||
20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
21 | #include <linux/major.h> | 20 | #include <linux/major.h> |
22 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
@@ -1310,8 +1309,6 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd, | |||
1310 | 1309 | ||
1311 | static int | 1310 | static int |
1312 | fb_mmap(struct file *file, struct vm_area_struct * vma) | 1311 | fb_mmap(struct file *file, struct vm_area_struct * vma) |
1313 | __acquires(&info->lock) | ||
1314 | __releases(&info->lock) | ||
1315 | { | 1312 | { |
1316 | int fbidx = iminor(file->f_path.dentry->d_inode); | 1313 | int fbidx = iminor(file->f_path.dentry->d_inode); |
1317 | struct fb_info *info = registered_fb[fbidx]; | 1314 | struct fb_info *info = registered_fb[fbidx]; |
@@ -1325,16 +1322,14 @@ __releases(&info->lock) | |||
1325 | off = vma->vm_pgoff << PAGE_SHIFT; | 1322 | off = vma->vm_pgoff << PAGE_SHIFT; |
1326 | if (!fb) | 1323 | if (!fb) |
1327 | return -ENODEV; | 1324 | return -ENODEV; |
1325 | mutex_lock(&info->mm_lock); | ||
1328 | if (fb->fb_mmap) { | 1326 | if (fb->fb_mmap) { |
1329 | int res; | 1327 | int res; |
1330 | mutex_lock(&info->lock); | ||
1331 | res = fb->fb_mmap(info, vma); | 1328 | res = fb->fb_mmap(info, vma); |
1332 | mutex_unlock(&info->lock); | 1329 | mutex_unlock(&info->mm_lock); |
1333 | return res; | 1330 | return res; |
1334 | } | 1331 | } |
1335 | 1332 | ||
1336 | mutex_lock(&info->lock); | ||
1337 | |||
1338 | /* frame buffer memory */ | 1333 | /* frame buffer memory */ |
1339 | start = info->fix.smem_start; | 1334 | start = info->fix.smem_start; |
1340 | len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len); | 1335 | len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len); |
@@ -1342,13 +1337,13 @@ __releases(&info->lock) | |||
1342 | /* memory mapped io */ | 1337 | /* memory mapped io */ |
1343 | off -= len; | 1338 | off -= len; |
1344 | if (info->var.accel_flags) { | 1339 | if (info->var.accel_flags) { |
1345 | mutex_unlock(&info->lock); | 1340 | mutex_unlock(&info->mm_lock); |
1346 | return -EINVAL; | 1341 | return -EINVAL; |
1347 | } | 1342 | } |
1348 | start = info->fix.mmio_start; | 1343 | start = info->fix.mmio_start; |
1349 | len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len); | 1344 | len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len); |
1350 | } | 1345 | } |
1351 | mutex_unlock(&info->lock); | 1346 | mutex_unlock(&info->mm_lock); |
1352 | start &= PAGE_MASK; | 1347 | start &= PAGE_MASK; |
1353 | if ((vma->vm_end - vma->vm_start + off) > len) | 1348 | if ((vma->vm_end - vma->vm_start + off) > len) |
1354 | return -EINVAL; | 1349 | return -EINVAL; |
@@ -1518,6 +1513,7 @@ register_framebuffer(struct fb_info *fb_info) | |||
1518 | break; | 1513 | break; |
1519 | fb_info->node = i; | 1514 | fb_info->node = i; |
1520 | mutex_init(&fb_info->lock); | 1515 | mutex_init(&fb_info->lock); |
1516 | mutex_init(&fb_info->mm_lock); | ||
1521 | 1517 | ||
1522 | fb_info->dev = device_create(fb_class, fb_info->device, | 1518 | fb_info->dev = device_create(fb_class, fb_info->device, |
1523 | MKDEV(FB_MAJOR, i), NULL, "fb%d", i); | 1519 | MKDEV(FB_MAJOR, i), NULL, "fb%d", i); |