drm/fb-helper: streamline drm_fb_helper_single_fb_probe

No need to check whether we've allocated a new fb since we're not
always doing that. Also, we always need to register the fbdev and add
it to the panic notifier.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter 2013-01-21 23:38:37 +01:00
parent 2180c3c7e7
commit 8acf658ad6

View file

@ -752,10 +752,14 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
} }
EXPORT_SYMBOL(drm_fb_helper_pan_display); EXPORT_SYMBOL(drm_fb_helper_pan_display);
/*
* Allocates the backing storage through the ->fb_probe callback and then
* registers the fbdev and sets up the panic notifier.
*/
static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper, static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
int preferred_bpp) int preferred_bpp)
{ {
int new_fb = 0; int ret = 0;
int crtc_count = 0; int crtc_count = 0;
int i; int i;
struct fb_info *info; struct fb_info *info;
@ -833,9 +837,9 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
} }
/* push down into drivers */ /* push down into drivers */
new_fb = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes); ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes);
if (new_fb < 0) if (ret < 0)
return new_fb; return ret;
info = fb_helper->fbdev; info = fb_helper->fbdev;
@ -851,7 +855,6 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
fb_helper->crtc_info[i].mode_set.fb = fb_helper->fb; fb_helper->crtc_info[i].mode_set.fb = fb_helper->fb;
if (new_fb) {
info->var.pixclock = 0; info->var.pixclock = 0;
if (register_framebuffer(info) < 0) if (register_framebuffer(info) < 0)
return -EINVAL; return -EINVAL;
@ -859,8 +862,6 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
dev_info(fb_helper->dev->dev, "fb%d: %s frame buffer device\n", dev_info(fb_helper->dev->dev, "fb%d: %s frame buffer device\n",
info->node, info->fix.id); info->node, info->fix.id);
}
/* Switch back to kernel console on panic */ /* Switch back to kernel console on panic */
/* multi card linked list maybe */ /* multi card linked list maybe */
if (list_empty(&kernel_fb_helper_list)) { if (list_empty(&kernel_fb_helper_list)) {
@ -869,7 +870,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
&paniced); &paniced);
register_sysrq_key('v', &sysrq_drm_fb_helper_restore_op); register_sysrq_key('v', &sysrq_drm_fb_helper_restore_op);
} }
if (new_fb)
list_add(&fb_helper->kernel_fb_list, &kernel_fb_helper_list); list_add(&fb_helper->kernel_fb_list, &kernel_fb_helper_list);
return 0; return 0;