Skip to contentSkip to conversation

CPUIDLE: fix 'current_governor' sysfs entry

PATCH New Adam Belay 1 participant 1 message Aug 21, 2007

Subsystems (2)
lore
Share & tools
lore

Adam Belay

author
#0 lore raw

PATCH 1/6 CPUIDLE: fix 'current_governor' sysfs entry

This patch allows the "current_governor" sysfs entry to properly handle input terminated with '\n'.

Please Apply,
Adam

Change Summary:

 sysfs.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

---

drivers/cpuidle/sysfs.c +3 -6
diff -urN a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
@@ -80,16 +80,13 @@
 
 	memcpy(gov_name, buf, len);
 	gov_name[len] = '\0';
-
-	len = strlen(gov_name);
-
-	if (len && gov_name[len - 1] == '\n')
-		gov_name[len - 1] = '\0';
+	if (gov_name[len - 1] == '\n')
+		gov_name[--len] = '\0';
 
 	mutex_lock(&cpuidle_lock);
 
 	list_for_each_entry(gov, &cpuidle_governors, governor_list) {
-		if (strlen(gov->name) == len && !strcmp(gov->name, buf)) {
+		if (strlen(gov->name) == len && !strcmp(gov->name, gov_name)) {
 			ret = cpuidle_switch_governor(gov);
 			break;
 		}