summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/drmP.h1
-rw-r--r--linux-core/drm_pm.c14
2 files changed, 8 insertions, 7 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 9f836773..f38c57d4 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -724,7 +724,6 @@ typedef struct drm_device {
drm_head_t primary; /**< primary screen head */
struct sys_device sysdev; /**< Power Management device structure */
- int sysdev_registered; /**< Whether the device has been registered */
} drm_device_t;
static __inline__ int drm_core_check_feature(struct drm_device *dev,
diff --git a/linux-core/drm_pm.c b/linux-core/drm_pm.c
index b37cced1..1e93e1da 100644
--- a/linux-core/drm_pm.c
+++ b/linux-core/drm_pm.c
@@ -86,6 +86,9 @@ int drm_pm_setup(drm_device_t *dev)
{
int rc;
+ if (atomic_read(&sysdev_loaded) == -1)
+ return 0;
+
DRM_DEBUG("\n");
dev->sysdev.id = dev->primary.minor;
@@ -96,8 +99,6 @@ int drm_pm_setup(drm_device_t *dev)
#else
rc = sysdev_register(&dev->sysdev);
#endif
- if (!rc)
- dev->sysdev_registered = 1;
return rc;
}
@@ -108,15 +109,16 @@ int drm_pm_setup(drm_device_t *dev)
*/
void drm_pm_takedown(drm_device_t *dev)
{
+ if (atomic_read(&sysdev_loaded) == -1)
+ return;
+
DRM_DEBUG("\n");
- if(dev->sysdev_registered) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)
- sys_device_unregister(&dev->sysdev);
+ sys_device_unregister(&dev->sysdev);
#else
- sysdev_unregister(&dev->sysdev);
+ sysdev_unregister(&dev->sysdev);
#endif
- }
}
int drm_pm_init(void)