diff options
Diffstat (limited to 'drivers/gpu/drm/drm_sysfs.c')
-rw-r--r-- | drivers/gpu/drm/drm_sysfs.c | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index de154556c405..51611722aa02 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
@@ -23,44 +23,50 @@ | |||
23 | #define to_drm_minor(d) container_of(d, struct drm_minor, kdev) | 23 | #define to_drm_minor(d) container_of(d, struct drm_minor, kdev) |
24 | #define to_drm_connector(d) container_of(d, struct drm_connector, kdev) | 24 | #define to_drm_connector(d) container_of(d, struct drm_connector, kdev) |
25 | 25 | ||
26 | static struct device_type drm_sysfs_device_minor = { | ||
27 | .name = "drm_minor" | ||
28 | }; | ||
29 | |||
26 | /** | 30 | /** |
27 | * drm_sysfs_suspend - DRM class suspend hook | 31 | * drm_class_suspend - DRM class suspend hook |
28 | * @dev: Linux device to suspend | 32 | * @dev: Linux device to suspend |
29 | * @state: power state to enter | 33 | * @state: power state to enter |
30 | * | 34 | * |
31 | * Just figures out what the actual struct drm_device associated with | 35 | * Just figures out what the actual struct drm_device associated with |
32 | * @dev is and calls its suspend hook, if present. | 36 | * @dev is and calls its suspend hook, if present. |
33 | */ | 37 | */ |
34 | static int drm_sysfs_suspend(struct device *dev, pm_message_t state) | 38 | static int drm_class_suspend(struct device *dev, pm_message_t state) |
35 | { | 39 | { |
36 | struct drm_minor *drm_minor = to_drm_minor(dev); | 40 | if (dev->type == &drm_sysfs_device_minor) { |
37 | struct drm_device *drm_dev = drm_minor->dev; | 41 | struct drm_minor *drm_minor = to_drm_minor(dev); |
38 | 42 | struct drm_device *drm_dev = drm_minor->dev; | |
39 | if (drm_minor->type == DRM_MINOR_LEGACY && | 43 | |
40 | !drm_core_check_feature(drm_dev, DRIVER_MODESET) && | 44 | if (drm_minor->type == DRM_MINOR_LEGACY && |
41 | drm_dev->driver->suspend) | 45 | !drm_core_check_feature(drm_dev, DRIVER_MODESET) && |
42 | return drm_dev->driver->suspend(drm_dev, state); | 46 | drm_dev->driver->suspend) |
43 | 47 | return drm_dev->driver->suspend(drm_dev, state); | |
48 | } | ||
44 | return 0; | 49 | return 0; |
45 | } | 50 | } |
46 | 51 | ||
47 | /** | 52 | /** |
48 | * drm_sysfs_resume - DRM class resume hook | 53 | * drm_class_resume - DRM class resume hook |
49 | * @dev: Linux device to resume | 54 | * @dev: Linux device to resume |
50 | * | 55 | * |
51 | * Just figures out what the actual struct drm_device associated with | 56 | * Just figures out what the actual struct drm_device associated with |
52 | * @dev is and calls its resume hook, if present. | 57 | * @dev is and calls its resume hook, if present. |
53 | */ | 58 | */ |
54 | static int drm_sysfs_resume(struct device *dev) | 59 | static int drm_class_resume(struct device *dev) |
55 | { | 60 | { |
56 | struct drm_minor *drm_minor = to_drm_minor(dev); | 61 | if (dev->type == &drm_sysfs_device_minor) { |
57 | struct drm_device *drm_dev = drm_minor->dev; | 62 | struct drm_minor *drm_minor = to_drm_minor(dev); |
58 | 63 | struct drm_device *drm_dev = drm_minor->dev; | |
59 | if (drm_minor->type == DRM_MINOR_LEGACY && | 64 | |
60 | !drm_core_check_feature(drm_dev, DRIVER_MODESET) && | 65 | if (drm_minor->type == DRM_MINOR_LEGACY && |
61 | drm_dev->driver->resume) | 66 | !drm_core_check_feature(drm_dev, DRIVER_MODESET) && |
62 | return drm_dev->driver->resume(drm_dev); | 67 | drm_dev->driver->resume) |
63 | 68 | return drm_dev->driver->resume(drm_dev); | |
69 | } | ||
64 | return 0; | 70 | return 0; |
65 | } | 71 | } |
66 | 72 | ||
@@ -100,8 +106,8 @@ struct class *drm_sysfs_create(struct module *owner, char *name) | |||
100 | goto err_out; | 106 | goto err_out; |
101 | } | 107 | } |
102 | 108 | ||
103 | class->suspend = drm_sysfs_suspend; | 109 | class->suspend = drm_class_suspend; |
104 | class->resume = drm_sysfs_resume; | 110 | class->resume = drm_class_resume; |
105 | 111 | ||
106 | err = class_create_file(class, &class_attr_version); | 112 | err = class_create_file(class, &class_attr_version); |
107 | if (err) | 113 | if (err) |
@@ -484,6 +490,7 @@ int drm_sysfs_device_add(struct drm_minor *minor) | |||
484 | minor->kdev.class = drm_class; | 490 | minor->kdev.class = drm_class; |
485 | minor->kdev.release = drm_sysfs_device_release; | 491 | minor->kdev.release = drm_sysfs_device_release; |
486 | minor->kdev.devt = minor->device; | 492 | minor->kdev.devt = minor->device; |
493 | minor->kdev.type = &drm_sysfs_device_minor; | ||
487 | if (minor->type == DRM_MINOR_CONTROL) | 494 | if (minor->type == DRM_MINOR_CONTROL) |
488 | minor_str = "controlD%d"; | 495 | minor_str = "controlD%d"; |
489 | else if (minor->type == DRM_MINOR_RENDER) | 496 | else if (minor->type == DRM_MINOR_RENDER) |