summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_platform.c
diff options
context:
space:
mode:
authorDavid Herrmann2013-10-02 11:23:35 +0200
committerDave Airlie2013-10-09 07:54:31 +0200
commitc22f0ace1926da399d9a16dfaf09174c1b03594c (patch)
tree9c82626f939917cba7ab3626a22fe61d52940ec9 /drivers/gpu/drm/drm_platform.c
parentdrm: add drm_dev_alloc() helper (diff)
downloadkernel-qcow2-linux-c22f0ace1926da399d9a16dfaf09174c1b03594c.tar.gz
kernel-qcow2-linux-c22f0ace1926da399d9a16dfaf09174c1b03594c.tar.xz
kernel-qcow2-linux-c22f0ace1926da399d9a16dfaf09174c1b03594c.zip
drm: merge device setup into drm_dev_register()
All bus drivers do device setup themselves. This requires us to adjust all of them if we introduce new core features. Thus, merge all these into a uniform drm_dev_register() helper. Note that this removes the drm_lastclose() error path for AGP as it is horribly broken. Moreover, no bus driver called this in any other error path either. Instead, we use the recently introduced AGP cleanup helpers. We also keep a DRIVER_MODESET condition around pci_set_drvdata() to keep semantics. [airlied: keep passing flags through so drivers don't oops on load] Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_platform.c')
-rw-r--r--drivers/gpu/drm/drm_platform.c54
1 files changed, 3 insertions, 51 deletions
diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c
index fb2721738a8a..a0f91f85651f 100644
--- a/drivers/gpu/drm/drm_platform.c
+++ b/drivers/gpu/drm/drm_platform.c
@@ -53,48 +53,9 @@ static int drm_get_platform_dev(struct platform_device *platdev,
dev->platformdev = platdev;
- mutex_lock(&drm_global_mutex);
-
- ret = drm_fill_in_dev(dev, NULL, driver);
-
- if (ret) {
- printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
- goto err_g1;
- }
-
- if (drm_core_check_feature(dev, DRIVER_MODESET)) {
- ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL);
- if (ret)
- goto err_g1;
- }
-
- if (drm_core_check_feature(dev, DRIVER_RENDER) && drm_rnodes) {
- ret = drm_get_minor(dev, &dev->render, DRM_MINOR_RENDER);
- if (ret)
- goto err_g11;
- }
-
- ret = drm_get_minor(dev, &dev->primary, DRM_MINOR_LEGACY);
+ ret = drm_dev_register(dev, 0);
if (ret)
- goto err_g2;
-
- if (dev->driver->load) {
- ret = dev->driver->load(dev, 0);
- if (ret)
- goto err_g3;
- }
-
- /* setup the grouping for the legacy output */
- if (drm_core_check_feature(dev, DRIVER_MODESET)) {
- ret = drm_mode_group_init_legacy_group(dev,
- &dev->primary->mode_group);
- if (ret)
- goto err_g3;
- }
-
- list_add_tail(&dev->driver_item, &driver->device_list);
-
- mutex_unlock(&drm_global_mutex);
+ goto err_free;
DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
driver->name, driver->major, driver->minor, driver->patchlevel,
@@ -102,17 +63,8 @@ static int drm_get_platform_dev(struct platform_device *platdev,
return 0;
-err_g3:
- drm_put_minor(&dev->primary);
-err_g2:
- if (dev->render)
- drm_put_minor(&dev->render);
-err_g11:
- if (drm_core_check_feature(dev, DRIVER_MODESET))
- drm_put_minor(&dev->control);
-err_g1:
+err_free:
kfree(dev);
- mutex_unlock(&drm_global_mutex);
return ret;
}