Commit 4148df9b authored by Paul Mundt's avatar Paul Mundt Committed by Linus Torvalds

fb: Initialize fb_info mutexes in framebuffer_alloc()

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: default avatarPaul Mundt <lethal@linux-sh.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 793285fc
...@@ -1513,8 +1513,6 @@ register_framebuffer(struct fb_info *fb_info) ...@@ -1513,8 +1513,6 @@ register_framebuffer(struct fb_info *fb_info)
if (!registered_fb[i]) if (!registered_fb[i])
break; break;
fb_info->node = i; 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, fb_info->dev = device_create(fb_class, fb_info->device,
MKDEV(FB_MAJOR, i), NULL, "fb%d", i); MKDEV(FB_MAJOR, i), NULL, "fb%d", i);
......
...@@ -62,6 +62,9 @@ struct fb_info *framebuffer_alloc(size_t size, struct device *dev) ...@@ -62,6 +62,9 @@ struct fb_info *framebuffer_alloc(size_t size, struct device *dev)
mutex_init(&info->bl_curve_mutex); mutex_init(&info->bl_curve_mutex);
#endif #endif
mutex_init(&info->lock);
mutex_init(&info->mm_lock);
return info; return info;
#undef PADDING #undef PADDING
#undef BYTES_PER_LONG #undef BYTES_PER_LONG
......
...@@ -2083,6 +2083,7 @@ static int matroxfb_probe(struct pci_dev* pdev, const struct pci_device_id* dumm ...@@ -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)); spin_lock_init(&ACCESS_FBINFO(lock.accel));
init_rwsem(&ACCESS_FBINFO(crtc2.lock)); init_rwsem(&ACCESS_FBINFO(crtc2.lock));
init_rwsem(&ACCESS_FBINFO(altout.lock)); init_rwsem(&ACCESS_FBINFO(altout.lock));
mutex_init(&ACCESS_FBINFO(fbcon).lock);
mutex_init(&ACCESS_FBINFO(fbcon).mm_lock); mutex_init(&ACCESS_FBINFO(fbcon).mm_lock);
ACCESS_FBINFO(irq_flags) = 0; ACCESS_FBINFO(irq_flags) = 0;
init_waitqueue_head(&ACCESS_FBINFO(crtc1.vsync.wait)); init_waitqueue_head(&ACCESS_FBINFO(crtc1.vsync.wait));
......
...@@ -1624,8 +1624,6 @@ static int __devinit sm501fb_start_one(struct sm501fb_info *info, ...@@ -1624,8 +1624,6 @@ static int __devinit sm501fb_start_one(struct sm501fb_info *info,
if (!fbi) if (!fbi)
return 0; return 0;
mutex_init(&info->fb[head]->mm_lock);
ret = sm501fb_init_fb(info->fb[head], head, drvname); ret = sm501fb_init_fb(info->fb[head], head, drvname);
if (ret) { if (ret) {
dev_err(info->dev, "cannot initialise fb %s\n", drvname); dev_err(info->dev, "cannot initialise fb %s\n", drvname);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment