diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 6c1e5feb..6e0e70cf 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -339,7 +339,6 @@ int drm_init(struct drm_driver *driver, if (!drm_fb_loaded) pci_register_driver(&driver->pci_driver); else { - drm_pm_init(); for (i = 0; pciidlist[i].vendor != 0; i++) { pid = &pciidlist[i]; @@ -516,12 +515,17 @@ 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 8e11a16c..1a402196 100644 --- a/linux-core/drm_pm.c +++ b/linux-core/drm_pm.c @@ -62,11 +62,16 @@ static int drm_resume(struct sys_device *sysdev) return 0; } -static int drm_sysdev_class_registered = 0; +static int shutdown(struct sys_device *sysdev) +{ + return 0; +} + static struct sysdev_class drm_sysdev_class = { set_kset_name("drm"), .resume = drm_resume, .suspend = drm_suspend, + .shutdown = shutdown, }; @@ -115,17 +120,12 @@ void drm_pm_takedown(drm_device_t *dev) int drm_pm_init(void) { - int rc; DRM_DEBUG("\n"); - rc = sysdev_class_register(&drm_sysdev_class); - if (!rc) - drm_sysdev_class_registered = 1; - return rc; + return sysdev_class_register(&drm_sysdev_class); } -void drm_pm_exit(void) +void __exit drm_pm_exit(void) { DRM_DEBUG("\n"); - if (drm_sysdev_class_registered) - sysdev_class_unregister(&drm_sysdev_class); + sysdev_class_unregister(&drm_sysdev_class); }