From 9d2600fd31c1dda6f41e569fd8aff45c9e5ce54f Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 16 Jun 2010 16:41:38 -0400 Subject: [PATCH] drm/radeon/kms: only attempt to cancel delayed work if pm method is PM_METHOD_DYNPM delayed work is only scheduled if pm method is PM_METHOD_DYNPM. Signed-off-by: Alex Deucher --- drivers/gpu/drm/radeon/radeon_pm.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index b9ad366..0751fc8 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -407,11 +407,12 @@ static ssize_t radeon_set_pm_method(struct device *dev, mutex_unlock(&rdev->pm.mutex); } else if (strncmp("profile", buf, strlen("profile")) == 0) { mutex_lock(&rdev->pm.mutex); - rdev->pm.pm_method = PM_METHOD_PROFILE; + if (rdev->pm.pm_method == PM_METHOD_DYNPM) + cancel_delayed_work(&rdev->pm.dynpm_idle_work); /* disable dynpm */ rdev->pm.dynpm_state = DYNPM_STATE_DISABLED; rdev->pm.dynpm_planned_action = DYNPM_ACTION_NONE; - cancel_delayed_work(&rdev->pm.dynpm_idle_work); + rdev->pm.pm_method = PM_METHOD_PROFILE; mutex_unlock(&rdev->pm.mutex); } else { DRM_ERROR("invalid power method!\n"); @@ -428,7 +429,8 @@ static DEVICE_ATTR(power_method, S_IRUGO | S_IWUSR, radeon_get_pm_method, radeon void radeon_pm_suspend(struct radeon_device *rdev) { mutex_lock(&rdev->pm.mutex); - cancel_delayed_work(&rdev->pm.dynpm_idle_work); + if (rdev->pm.pm_method == PM_METHOD_DYNPM) + cancel_delayed_work(&rdev->pm.dynpm_idle_work); mutex_unlock(&rdev->pm.mutex); } -- 1.7.0.1