aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_sysfs.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_sysfs.c b/drivers/gpu/drm/nouveau/nouveau_sysfs.c
index 32a23895abd5..3c6962d15b26 100644
--- a/drivers/gpu/drm/nouveau/nouveau_sysfs.c
+++ b/drivers/gpu/drm/nouveau/nouveau_sysfs.c
@@ -28,6 +28,10 @@
28 28
29#include "nouveau_sysfs.h" 29#include "nouveau_sysfs.h"
30 30
31MODULE_PARM_DESC(pstate, "enable sysfs pstate file, which will be moved in the future");
32static int nouveau_pstate;
33module_param_named(pstate, nouveau_pstate, int, 0400);
34
31static inline struct drm_device * 35static inline struct drm_device *
32drm_device(struct device *d) 36drm_device(struct device *d)
33{ 37{
@@ -160,7 +164,7 @@ nouveau_sysfs_fini(struct drm_device *dev)
160 struct nouveau_drm *drm = nouveau_drm(dev); 164 struct nouveau_drm *drm = nouveau_drm(dev);
161 struct nvif_device *device = &drm->device; 165 struct nvif_device *device = &drm->device;
162 166
163 if (sysfs->ctrl.priv) { 167 if (sysfs && sysfs->ctrl.priv) {
164 device_remove_file(nv_device_base(nvkm_device(device)), &dev_attr_pstate); 168 device_remove_file(nv_device_base(nvkm_device(device)), &dev_attr_pstate);
165 nvif_object_fini(&sysfs->ctrl); 169 nvif_object_fini(&sysfs->ctrl);
166 } 170 }
@@ -177,6 +181,9 @@ nouveau_sysfs_init(struct drm_device *dev)
177 struct nouveau_sysfs *sysfs; 181 struct nouveau_sysfs *sysfs;
178 int ret; 182 int ret;
179 183
184 if (!nouveau_pstate)
185 return 0;
186
180 sysfs = drm->sysfs = kzalloc(sizeof(*sysfs), GFP_KERNEL); 187 sysfs = drm->sysfs = kzalloc(sizeof(*sysfs), GFP_KERNEL);
181 if (!sysfs) 188 if (!sysfs)
182 return -ENOMEM; 189 return -ENOMEM;