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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(-)
---

diff -urN a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
--- a/drivers/cpuidle/sysfs.c	2007-08-13 00:02:10.000000000 -0400
+++ b/drivers/cpuidle/sysfs.c	2007-08-03 20:59:47.000000000 -0400
@@ -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;
 		}


-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux