On Sun, Jul 05, 2009 at 07:19:33AM -0700, Linus Torvalds wrote:
> On Sun, 5 Jul 2009, Wu Zhangjin wrote:
> > then it works! so, I guess there is a deadlock introduced by the above
> > commit.
> Hmm. Perhaps more likely, the 'mm_lock' mutex hasn't even been initialized
> yet. We appear to have had that problem with matroxfb and sm501fb, and it
> may be more common than that. See commit f50bf2b2.
> That said, I do agree that the mm_lock seems to be causing more problems
> than it actually fixes, and maybe we should revert it. Krzysztof?
Looking at this a bit closer, just moving the mutex initialization in to
framebuffer_alloc() should basically fix most of these, at least it
certainly does for sm501fb and for this sis case as well. So, here's a
patch to do that.
As an aside note, matroxfb is the odd one out, as it doesn't use
framebuffer_alloc() directly for whatever reason. This actually raises an
additional issue, in that framebuffer_alloc() is already where other
mutexes are initialized, which will simply never happen on matroxfb
(suggesting that at least the FB_BACKLIGHT and matroxfb combination will
blow up, although perhaps that's not a valid combination).
Signed-off-by: Paul Mundt <email@example.com>
drivers/video/fbmem.c | 1 -
drivers/video/fbsysfs.c | 2 ++
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 53ea056..27a5271 100644
@@ -1514,7 +1514,6 @@ register_framebuffer(struct fb_info *fb_info)
fb_info->node = i;
fb_info->dev = device_create(fb_class, fb_info->device,
MKDEV(FB_MAJOR, i), NULL, "fb%d", i);
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c
index d4a2c11..dd413ad 100644
@@ -62,6 +62,8 @@ struct fb_info *framebuffer_alloc(size_t size, struct device