Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 101986
b: refs/heads/master
c: 3d532d5
h: refs/heads/master
v: v3
  • Loading branch information
Yi Yang authored and Andi Kleen committed Jul 16, 2008
1 parent 5bfdf5d commit 1705334
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6594d87ebd8371f4b67f7ab4b68f172b139b78d6
refs/heads/master: 3d532d5e3882c1387a2722df2a368c4a9224b12f
24 changes: 20 additions & 4 deletions trunk/drivers/acpi/processor_throttling.c
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,10 @@ static ssize_t acpi_processor_write_throttling(struct file *file,
int result = 0;
struct seq_file *m = file->private_data;
struct acpi_processor *pr = m->private;
char state_string[12] = { '\0' };
char state_string[5] = "";
char *charp = NULL;
size_t state_val = 0;
char tmpbuf[5] = "";

if (!pr || (count > sizeof(state_string) - 1))
return -EINVAL;
Expand All @@ -1241,10 +1244,23 @@ static ssize_t acpi_processor_write_throttling(struct file *file,
return -EFAULT;

state_string[count] = '\0';
if ((count > 0) && (state_string[count-1] == '\n'))
state_string[count-1] = '\0';

result = acpi_processor_set_throttling(pr,
simple_strtoul(state_string,
NULL, 0));
charp = state_string;
if ((state_string[0] == 't') || (state_string[0] == 'T'))
charp++;

state_val = simple_strtoul(charp, NULL, 0);
if (state_val >= pr->throttling.state_count)
return -EINVAL;

snprintf(tmpbuf, 5, "%d", state_val);

if (strcmp(tmpbuf, charp) != 0)
return -EINVAL;

result = acpi_processor_set_throttling(pr, state_val);
if (result)
return result;

Expand Down

0 comments on commit 1705334

Please sign in to comment.