[PATCH 2/2] drm/radeon: make pm method file show default + option.

Dave Airlie airlied at gmail.com
Mon Sep 19 12:53:19 PDT 2011


From: Dave Airlie <airlied at redhat.com>

If we add more options in the future this will need rework.

this is modelled after the example in /sys/power/disk.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/radeon/radeon_pm.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 2a44332..25bc75e 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -390,9 +390,13 @@ static ssize_t radeon_get_pm_method(struct device *dev,
 	struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev));
 	struct radeon_device *rdev = ddev->dev_private;
 	int pm = rdev->pm.pm_method;
+	char *start = buf;
 
-	return snprintf(buf, PAGE_SIZE, "%s\n",
-			(pm == PM_METHOD_DYNPM) ? "dynpm" : "profile");
+	if (pm == PM_METHOD_DYNPM)
+		buf += snprintf(buf, PAGE_SIZE, "[dynpm] profile\n");
+	else
+		buf += snprintf(buf, PAGE_SIZE, "dynpm [profile]\n");
+	return buf - start;
 }
 
 static ssize_t radeon_set_pm_method(struct device *dev,
-- 
1.7.6



More information about the dri-devel mailing list