aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/matrox
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2009-06-30 14:41:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-30 21:56:00 -0400
commit537a1bf059fa312355696fa6db80726e655e7f17 (patch)
tree4f5b3c6917311cfefad21eaf3dd92978334282de /drivers/video/matrox
parent70d6027ff2bc8bab180273b77e7ab3e8a62cca51 (diff)
fbdev: add mutex for fb_mmap locking
Add a mutex to avoid a circular locking problem between the mm layer semaphore and fbdev ioctl mutex through the fb_mmap() call. Also, add mutex to all places where smem_start and smem_len fields change so the mutex inside the fb_mmap() is actually used. Changing of these fields before calling the framebuffer_register() are not mutexed. This is 2.6.31 material. It removes one lockdep (fb_mmap() and register_framebuffer()) but there is still another one (fb_release() and register_framebuffer()). It also cleans up handling of the smem_start and smem_len fields used by mutexed section of the fb_mmap(). Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/matrox')
-rw-r--r--drivers/video/matrox/matroxfb_base.c3
-rw-r--r--drivers/video/matrox/matroxfb_crtc2.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c
index 8e7a275df50c..59c3a2e14913 100644
--- a/drivers/video/matrox/matroxfb_base.c
+++ b/drivers/video/matrox/matroxfb_base.c
@@ -724,8 +724,10 @@ static void matroxfb_update_fix(WPMINFO2)
724 struct fb_fix_screeninfo *fix = &ACCESS_FBINFO(fbcon).fix; 724 struct fb_fix_screeninfo *fix = &ACCESS_FBINFO(fbcon).fix;
725 DBG(__func__) 725 DBG(__func__)
726 726
727 mutex_lock(&ACCESS_FBINFO(fbcon).mm_lock);
727 fix->smem_start = ACCESS_FBINFO(video.base) + ACCESS_FBINFO(curr.ydstorg.bytes); 728 fix->smem_start = ACCESS_FBINFO(video.base) + ACCESS_FBINFO(curr.ydstorg.bytes);
728 fix->smem_len = ACCESS_FBINFO(video.len_usable) - ACCESS_FBINFO(curr.ydstorg.bytes); 729 fix->smem_len = ACCESS_FBINFO(video.len_usable) - ACCESS_FBINFO(curr.ydstorg.bytes);
730 mutex_unlock(&ACCESS_FBINFO(fbcon).mm_lock);
729} 731}
730 732
731static int matroxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 733static int matroxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
@@ -2081,6 +2083,7 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm
2081 spin_lock_init(&ACCESS_FBINFO(lock.accel)); 2083 spin_lock_init(&ACCESS_FBINFO(lock.accel));
2082 init_rwsem(&ACCESS_FBINFO(crtc2.lock)); 2084 init_rwsem(&ACCESS_FBINFO(crtc2.lock));
2083 init_rwsem(&ACCESS_FBINFO(altout.lock)); 2085 init_rwsem(&ACCESS_FBINFO(altout.lock));
2086 mutex_init(&ACCESS_FBINFO(fbcon).mm_lock);
2084 ACCESS_FBINFO(irq_flags) = 0; 2087 ACCESS_FBINFO(irq_flags) = 0;
2085 init_waitqueue_head(&ACCESS_FBINFO(crtc1.vsync.wait)); 2088 init_waitqueue_head(&ACCESS_FBINFO(crtc1.vsync.wait));
2086 init_waitqueue_head(&ACCESS_FBINFO(crtc2.vsync.wait)); 2089 init_waitqueue_head(&ACCESS_FBINFO(crtc2.vsync.wait));
diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c
index 7ac4c5f6145d..909e10a11898 100644
--- a/drivers/video/matrox/matroxfb_crtc2.c
+++ b/drivers/video/matrox/matroxfb_crtc2.c
@@ -289,13 +289,16 @@ static int matroxfb_dh_release(struct fb_info* info, int user) {
289#undef m2info 289#undef m2info
290} 290}
291 291
292static void matroxfb_dh_init_fix(struct matroxfb_dh_fb_info *m2info) { 292static void matroxfb_dh_init_fix(struct matroxfb_dh_fb_info *m2info)
293{
293 struct fb_fix_screeninfo *fix = &m2info->fbcon.fix; 294 struct fb_fix_screeninfo *fix = &m2info->fbcon.fix;
294 295
295 strcpy(fix->id, "MATROX DH"); 296 strcpy(fix->id, "MATROX DH");
296 297
298 mutex_lock(&m2info->fbcon.mm_lock);
297 fix->smem_start = m2info->video.base; 299 fix->smem_start = m2info->video.base;
298 fix->smem_len = m2info->video.len_usable; 300 fix->smem_len = m2info->video.len_usable;
301 mutex_unlock(&m2info->fbcon.mm_lock);
299 fix->ypanstep = 1; 302 fix->ypanstep = 1;
300 fix->ywrapstep = 0; 303 fix->ywrapstep = 0;
301 fix->xpanstep = 8; /* TBD */ 304 fix->xpanstep = 8; /* TBD */