summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_drv.c9
-rw-r--r--linux-core/drm_pm.c10
2 files changed, 12 insertions, 7 deletions
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index 6e0e70cf..f981631b 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -339,6 +339,9 @@ int drm_init(struct drm_driver *driver,
if (!drm_fb_loaded)
pci_register_driver(&driver->pci_driver);
else {
+ if ((rc = drm_pm_init()))
+ return rc;
+
for (i = 0; pciidlist[i].vendor != 0; i++) {
pid = &pciidlist[i];
@@ -352,6 +355,7 @@ int drm_init(struct drm_driver *driver,
pci_dev_get(pdev);
if ((rc = drm_get_dev(pdev, &pciidlist[i], driver))) {
pci_dev_put(pdev);
+ drm_pm_exit();
return rc;
}
}
@@ -515,17 +519,12 @@ static int __init drm_core_init(void)
goto err_p3;
}
- if ((ret = drm_pm_init()))
- goto err_p4;
-
drm_mem_init();
DRM_INFO("Initialized %s %d.%d.%d %s\n",
CORE_NAME,
CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE);
return 0;
-err_p4:
- remove_proc_entry("dri", NULL);
err_p3:
drm_sysfs_destroy(drm_class);
err_p2:
diff --git a/linux-core/drm_pm.c b/linux-core/drm_pm.c
index 1a402196..f0dc4db6 100644
--- a/linux-core/drm_pm.c
+++ b/linux-core/drm_pm.c
@@ -67,6 +67,7 @@ static int shutdown(struct sys_device *sysdev)
return 0;
}
+static int sysdev_loaded = 0;
static struct sysdev_class drm_sysdev_class = {
set_kset_name("drm"),
.resume = drm_resume,
@@ -120,12 +121,17 @@ void drm_pm_takedown(drm_device_t *dev)
int drm_pm_init(void)
{
+ int rc;
DRM_DEBUG("\n");
- return sysdev_class_register(&drm_sysdev_class);
+
+ if (!(rc = sysdev_class_register(&drm_sysdev_class)))
+ sysdev_loaded = 1;
+ return rc;
}
void __exit drm_pm_exit(void)
{
DRM_DEBUG("\n");
- sysdev_class_unregister(&drm_sysdev_class);
+ if (sysdev_loaded)
+ sysdev_class_unregister(&drm_sysdev_class);
}