fb: Initialize fb_info mutexes in framebuffer_alloc()
authorPaul Mundt <lethal@linux-sh.org>
Sun, 5 Jul 2009 15:25:57 +0000 (00:25 +0900)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 6 Jul 2009 21:02:50 +0000 (14:02 -0700)
This way they'll be properly initialized early enough for users that may
touch them before the framebuffer has been registered.

Drivers that allocate their fb_info structure some other way (like
matrocfb's broken static allocation) need to be fixed up appropriately.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/fbmem.c
drivers/video/fbsysfs.c
drivers/video/matrox/matroxfb_base.c
drivers/video/sm501fb.c

index 53ea05645ff8e8bedb93e354d26f7f945628d8dd..53eb39652791deea409cc0e7776f6d03f5b31d0a 100644 (file)
@@ -1513,8 +1513,6 @@ register_framebuffer(struct fb_info *fb_info)
                if (!registered_fb[i])
                        break;
        fb_info->node = i;
-       mutex_init(&fb_info->lock);
-       mutex_init(&fb_info->mm_lock);
 
        fb_info->dev = device_create(fb_class, fb_info->device,
                                     MKDEV(FB_MAJOR, i), NULL, "fb%d", i);
index d4a2c11d980975be84131abd3a94670a1e2f7c98..afc04df39a03885cef15314f1d00b09b4baf3a0d 100644 (file)
@@ -62,6 +62,9 @@ struct fb_info *framebuffer_alloc(size_t size, struct device *dev)
        mutex_init(&info->bl_curve_mutex);
 #endif
 
+       mutex_init(&info->lock);
+       mutex_init(&info->mm_lock);
+
        return info;
 #undef PADDING
 #undef BYTES_PER_LONG
index 59c3a2e149137cfb9977a82397895360d602a131..76bc51b616d1c5cc067333a8e5659246d201a3a4 100644 (file)
@@ -2083,6 +2083,7 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm
        spin_lock_init(&ACCESS_FBINFO(lock.accel));
        init_rwsem(&ACCESS_FBINFO(crtc2.lock));
        init_rwsem(&ACCESS_FBINFO(altout.lock));
+       mutex_init(&ACCESS_FBINFO(fbcon).lock);
        mutex_init(&ACCESS_FBINFO(fbcon).mm_lock);
        ACCESS_FBINFO(irq_flags) = 0;
        init_waitqueue_head(&ACCESS_FBINFO(crtc1.vsync.wait));
index 16d4f4c7d52b5b02e6fcff002b8c0d03160b371c..98f24f0ec00df511247adcd09f692baa5cc577de 100644 (file)
@@ -1624,8 +1624,6 @@ static int __devinit sm501fb_start_one(struct sm501fb_info *info,
        if (!fbi)
                return 0;
 
-       mutex_init(&info->fb[head]->mm_lock);
-
        ret = sm501fb_init_fb(info->fb[head], head, drvname);
        if (ret) {
                dev_err(info->dev, "cannot initialise fb %s\n", drvname);