drm: Propagate error from drm_fb_helper_init().
[safe/jmp/linux-2.6] / drivers / gpu / drm / nouveau / nouveau_fbcon.c
index 292c7ff..c9a4a0d 100644 (file)
@@ -183,7 +183,6 @@ nouveau_fbcon_create(struct nouveau_fbdev *nfbdev,
        struct drm_mode_fb_cmd mode_cmd;
        struct pci_dev *pdev = dev->pdev;
        struct device *device = &pdev->dev;
-       struct apertures_struct *aper;
        int size, ret;
 
        mode_cmd.width = sizes->surface_width;
@@ -267,28 +266,12 @@ nouveau_fbcon_create(struct nouveau_fbdev *nfbdev,
        info->fix.mmio_len = pci_resource_len(pdev, 1);
 
        /* Set aperture base/size for vesafb takeover */
-       aper = info->apertures = alloc_apertures(3);
+       info->apertures = dev_priv->apertures;
        if (!info->apertures) {
                ret = -ENOMEM;
                goto out_unref;
        }
 
-       aper->ranges[0].base = pci_resource_start(pdev, 1);
-       aper->ranges[0].size = pci_resource_len(pdev, 1);
-       aper->count = 1;
-
-       if (pci_resource_len(pdev, 2)) {
-               aper->ranges[aper->count].base = pci_resource_start(pdev, 2);
-               aper->ranges[aper->count].size = pci_resource_len(pdev, 2);
-               aper->count++;
-       }
-
-       if (pci_resource_len(pdev, 3)) {
-               aper->ranges[aper->count].base = pci_resource_start(pdev, 3);
-               aper->ranges[aper->count].size = pci_resource_len(pdev, 3);
-               aper->count++;
-       }
-
        info->pixmap.size = 64*1024;
        info->pixmap.buf_align = 8;
        info->pixmap.access_align = 32;
@@ -343,15 +326,11 @@ nouveau_fbcon_find_or_create_single(struct drm_fb_helper *helper,
        return new_fb;
 }
 
-void nouveau_fbcon_hotplug(struct drm_device *dev)
+void
+nouveau_fbcon_output_poll_changed(struct drm_device *dev)
 {
        struct drm_nouveau_private *dev_priv = dev->dev_private;
-       drm_helper_fb_hpd_irq_event(&dev_priv->nfbdev->helper);
-}
-
-static void nouveau_fbcon_output_status_changed(struct drm_fb_helper *fb_helper)
-{
-       drm_helper_fb_hotplug_event(fb_helper, true);
+       drm_fb_helper_hotplug_event(&dev_priv->nfbdev->helper);
 }
 
 int
@@ -391,7 +370,6 @@ static struct drm_fb_helper_funcs nouveau_fbcon_helper_funcs = {
        .gamma_set = nouveau_fbcon_gamma_set,
        .gamma_get = nouveau_fbcon_gamma_get,
        .fb_probe = nouveau_fbcon_find_or_create_single,
-       .fb_output_status_changed = nouveau_fbcon_output_status_changed,
 };
 
 
@@ -399,6 +377,7 @@ int nouveau_fbcon_init(struct drm_device *dev)
 {
        struct drm_nouveau_private *dev_priv = dev->dev_private;
        struct nouveau_fbdev *nfbdev;
+       int ret;
 
        nfbdev = kzalloc(sizeof(struct nouveau_fbdev), GFP_KERNEL);
        if (!nfbdev)
@@ -408,8 +387,12 @@ int nouveau_fbcon_init(struct drm_device *dev)
        dev_priv->nfbdev = nfbdev;
        nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs;
 
-       drm_fb_helper_init(dev, &nfbdev->helper,
-                          2, 4, true);
+       ret = drm_fb_helper_init(dev, &nfbdev->helper, 2, 4);
+       if (ret) {
+               kfree(nfbdev);
+               return ret;
+       }
+
        drm_fb_helper_single_add_all_connectors(&nfbdev->helper);
        drm_fb_helper_initial_config(&nfbdev->helper, 32);
        return 0;