Commit 4561e822 authored by Alex Deucher's avatar Alex Deucher Committed by Luis Henriques

drm/radeon: don't try to recreate sysfs entries on resume

commit 49abb266 upstream.

Fixes a harmless error message caused by:
51a4726bSigned-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent c456feae
...@@ -1596,6 +1596,7 @@ struct radeon_pm { ...@@ -1596,6 +1596,7 @@ struct radeon_pm {
struct device *int_hwmon_dev; struct device *int_hwmon_dev;
/* dpm */ /* dpm */
bool dpm_enabled; bool dpm_enabled;
bool sysfs_initialized;
struct radeon_dpm dpm; struct radeon_dpm dpm;
}; };
......
...@@ -1390,19 +1390,23 @@ int radeon_pm_late_init(struct radeon_device *rdev) ...@@ -1390,19 +1390,23 @@ int radeon_pm_late_init(struct radeon_device *rdev)
if (rdev->pm.pm_method == PM_METHOD_DPM) { if (rdev->pm.pm_method == PM_METHOD_DPM) {
if (rdev->pm.dpm_enabled) { if (rdev->pm.dpm_enabled) {
ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state); if (!rdev->pm.sysfs_initialized) {
if (ret) ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state);
DRM_ERROR("failed to create device file for dpm state\n"); if (ret)
ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level); DRM_ERROR("failed to create device file for dpm state\n");
if (ret) ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level);
DRM_ERROR("failed to create device file for dpm state\n"); if (ret)
/* XXX: these are noops for dpm but are here for backwards compat */ DRM_ERROR("failed to create device file for dpm state\n");
ret = device_create_file(rdev->dev, &dev_attr_power_profile); /* XXX: these are noops for dpm but are here for backwards compat */
if (ret) ret = device_create_file(rdev->dev, &dev_attr_power_profile);
DRM_ERROR("failed to create device file for power profile\n"); if (ret)
ret = device_create_file(rdev->dev, &dev_attr_power_method); DRM_ERROR("failed to create device file for power profile\n");
if (ret) ret = device_create_file(rdev->dev, &dev_attr_power_method);
DRM_ERROR("failed to create device file for power method\n"); if (ret)
DRM_ERROR("failed to create device file for power method\n");
if (!ret)
rdev->pm.sysfs_initialized = true;
}
mutex_lock(&rdev->pm.mutex); mutex_lock(&rdev->pm.mutex);
ret = radeon_dpm_late_enable(rdev); ret = radeon_dpm_late_enable(rdev);
...@@ -1418,7 +1422,8 @@ int radeon_pm_late_init(struct radeon_device *rdev) ...@@ -1418,7 +1422,8 @@ int radeon_pm_late_init(struct radeon_device *rdev)
} }
} }
} else { } else {
if (rdev->pm.num_power_states > 1) { if ((rdev->pm.num_power_states > 1) &&
(!rdev->pm.sysfs_initialized)) {
/* where's the best place to put these? */ /* where's the best place to put these? */
ret = device_create_file(rdev->dev, &dev_attr_power_profile); ret = device_create_file(rdev->dev, &dev_attr_power_profile);
if (ret) if (ret)
...@@ -1426,6 +1431,8 @@ int radeon_pm_late_init(struct radeon_device *rdev) ...@@ -1426,6 +1431,8 @@ int radeon_pm_late_init(struct radeon_device *rdev)
ret = device_create_file(rdev->dev, &dev_attr_power_method); ret = device_create_file(rdev->dev, &dev_attr_power_method);
if (ret) if (ret)
DRM_ERROR("failed to create device file for power method\n"); DRM_ERROR("failed to create device file for power method\n");
if (!ret)
rdev->pm.sysfs_initialized = true;
} }
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment