diff options
author | Jon Smirl <jonsmirl@yahoo.com> | 2005-06-24 21:50:40 +0000 |
---|---|---|
committer | Jon Smirl <jonsmirl@yahoo.com> | 2005-06-24 21:50:40 +0000 |
commit | 2b845f25c5c3a36ed6e49b9145e38a4738ce2572 (patch) | |
tree | 330fbb6f19e69ecdcd0149aaec25d90d01bc825b | |
parent | 5b0e93de32e9da390702df13d95ab63274294233 (diff) |
Make sysdev class only register when fbdev detected
-rw-r--r-- | linux-core/drm_drv.c | 9 | ||||
-rw-r--r-- | linux-core/drm_pm.c | 10 |
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); } |