[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    [PATCH] rivafb/nvidiafb: race between register_framebuffer and *_bl_init
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2006-07-31 21:01:03
Message-ID: 200607312101.k6VL13Jp014605 () hera ! kernel ! org
[Download RAW message or body]

commit ce38cac48209d270d07fd6d1a8e94446b37abcd5
tree c7840212a8dbc2002734e20ed2e3b0e8f63c857c
parent b1367d2a2817e6199092b43fe01c1eed3374c4e4
author Guido Guenther <agx@sigxcpu.org> Sun, 30 Jul 2006 17:04:21 -0700
committer Linus Torvalds <torvalds@g5.osdl.org> Tue, 01 Aug 2006 03:28:45 -0700

[PATCH] rivafb/nvidiafb: race between register_framebuffer and *_bl_init

Since we now use the generic backlight infrastructure, I think we need to
call rivafb_bl_init before calling register_framebuffer since otherwise
rivafb_bl_init might race with the framebuffer layer already opening the
device and setting up the video mode.  In this case we might end up with a
not yet fully intialized backlight (info->bl_dev still NULL) when calling
riva_bl_set_power via rivafb_set_par/rivafb_load_video_mode and the kernel
dies without any further notice during boot.

This fixes booting current git on a PB 6,1.  In this case radeonfb/atyfb
would be affected too - I can fix that too but don't have any hardware to
test this on.

Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

 drivers/video/nvidia/nvidia.c |    5 ++---
 drivers/video/riva/fbdev.c    |    7 +++----
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/video/nvidia/nvidia.c b/drivers/video/nvidia/nvidia.c
index d0ca0d8..d4f8501 100644
--- a/drivers/video/nvidia/nvidia.c
+++ b/drivers/video/nvidia/nvidia.c
@@ -1299,20 +1299,19 @@ #endif				/* CONFIG_MTRR */
 
 	nvidia_save_vga(par, &par->SavedReg);
 
+	pci_set_drvdata(pd, info);
+	nvidia_bl_init(par);
 	if (register_framebuffer(info) < 0) {
 		printk(KERN_ERR PFX "error registering nVidia framebuffer\n");
 		goto err_out_iounmap_fb;
 	}
 
-	pci_set_drvdata(pd, info);
 
 	printk(KERN_INFO PFX
 	       "PCI nVidia %s framebuffer (%dMB @ 0x%lX)\n",
 	       info->fix.id,
 	       par->FbMapSize / (1024 * 1024), info->fix.smem_start);
 
-	nvidia_bl_init(par);
-
 	NVTRACE_LEAVE();
 	return 0;
 
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 33dddba..76fc9d3 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -2132,6 +2132,9 @@ #endif /* CONFIG_MTRR */
 
 	fb_destroy_modedb(info->monspecs.modedb);
 	info->monspecs.modedb = NULL;
+
+	pci_set_drvdata(pd, info);
+	riva_bl_init(info->par);
 	ret = register_framebuffer(info);
 	if (ret < 0) {
 		printk(KERN_ERR PFX
@@ -2139,8 +2142,6 @@ #endif /* CONFIG_MTRR */
 		goto err_iounmap_screen_base;
 	}
 
-	pci_set_drvdata(pd, info);
-
 	printk(KERN_INFO PFX
 		"PCI nVidia %s framebuffer ver %s (%dMB @ 0x%lX)\n",
 		info->fix.id,
@@ -2148,8 +2149,6 @@ #endif /* CONFIG_MTRR */
 		info->fix.smem_len / (1024 * 1024),
 		info->fix.smem_start);
 
-	riva_bl_init(info->par);
-
 	NVTRACE_LEAVE();
 	return 0;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic