Skip to content

Commit

Permalink
[PATCH] rivafb/nvidiafb: race between register_framebuffer and *_bl_init
Browse files Browse the repository at this point in the history
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" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
agx authored and Linus Torvalds committed Jul 31, 2006
1 parent b1367d2 commit ce38cac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions drivers/video/nvidia/nvidia.c
Original file line number Diff line number Diff line change
Expand Up @@ -1299,20 +1299,19 @@ static int __devinit nvidiafb_probe(struct pci_dev *pd,

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;

Expand Down
7 changes: 3 additions & 4 deletions drivers/video/riva/fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2132,24 +2132,23 @@ static int __devinit rivafb_probe(struct pci_dev *pd,

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
"error registering riva framebuffer\n");
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,
RIVAFB_VERSION,
info->fix.smem_len / (1024 * 1024),
info->fix.smem_start);

riva_bl_init(info->par);

NVTRACE_LEAVE();
return 0;

Expand Down

0 comments on commit ce38cac

Please sign in to comment.