diff options
| -rw-r--r-- | drivers/acpi/thermal.c | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 589b98b7b216..73b6fe7093e9 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
| @@ -86,9 +86,6 @@ static int acpi_thermal_resume(struct acpi_device *device); | |||
| 86 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); | 86 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); |
| 87 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); | 87 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); |
| 88 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); | 88 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); |
| 89 | static ssize_t acpi_thermal_write_trip_points(struct file *, | ||
| 90 | const char __user *, size_t, | ||
| 91 | loff_t *); | ||
| 92 | static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); | 89 | static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); |
| 93 | static ssize_t acpi_thermal_write_cooling_mode(struct file *, | 90 | static ssize_t acpi_thermal_write_cooling_mode(struct file *, |
| 94 | const char __user *, size_t, | 91 | const char __user *, size_t, |
| @@ -193,7 +190,6 @@ static const struct file_operations acpi_thermal_temp_fops = { | |||
| 193 | static const struct file_operations acpi_thermal_trip_fops = { | 190 | static const struct file_operations acpi_thermal_trip_fops = { |
| 194 | .open = acpi_thermal_trip_open_fs, | 191 | .open = acpi_thermal_trip_open_fs, |
| 195 | .read = seq_read, | 192 | .read = seq_read, |
| 196 | .write = acpi_thermal_write_trip_points, | ||
| 197 | .llseek = seq_lseek, | 193 | .llseek = seq_lseek, |
| 198 | .release = single_release, | 194 | .release = single_release, |
| 199 | }; | 195 | }; |
| @@ -889,67 +885,6 @@ static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file) | |||
| 889 | return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data); | 885 | return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data); |
| 890 | } | 886 | } |
| 891 | 887 | ||
| 892 | static ssize_t | ||
| 893 | acpi_thermal_write_trip_points(struct file *file, | ||
| 894 | const char __user * buffer, | ||
| 895 | size_t count, loff_t * ppos) | ||
| 896 | { | ||
| 897 | struct seq_file *m = file->private_data; | ||
| 898 | struct acpi_thermal *tz = m->private; | ||
| 899 | |||
| 900 | char *limit_string; | ||
| 901 | int num, critical, hot, passive; | ||
| 902 | int *active; | ||
| 903 | int i = 0; | ||
| 904 | |||
| 905 | |||
| 906 | limit_string = kzalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); | ||
| 907 | if (!limit_string) | ||
| 908 | return -ENOMEM; | ||
| 909 | |||
| 910 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); | ||
| 911 | if (!active) { | ||
| 912 | kfree(limit_string); | ||
| 913 | return -ENOMEM; | ||
| 914 | } | ||
| 915 | |||
| 916 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { | ||
| 917 | count = -EINVAL; | ||
| 918 | goto end; | ||
| 919 | } | ||
| 920 | |||
| 921 | if (copy_from_user(limit_string, buffer, count)) { | ||
| 922 | count = -EFAULT; | ||
| 923 | goto end; | ||
| 924 | } | ||
| 925 | |||
| 926 | limit_string[count] = '\0'; | ||
| 927 | |||
| 928 | num = sscanf(limit_string, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d", | ||
| 929 | &critical, &hot, &passive, | ||
| 930 | &active[0], &active[1], &active[2], &active[3], &active[4], | ||
| 931 | &active[5], &active[6], &active[7], &active[8], | ||
| 932 | &active[9]); | ||
| 933 | if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) { | ||
| 934 | count = -EINVAL; | ||
| 935 | goto end; | ||
| 936 | } | ||
| 937 | |||
| 938 | tz->trips.critical.temperature = CELSIUS_TO_KELVIN(critical); | ||
| 939 | tz->trips.hot.temperature = CELSIUS_TO_KELVIN(hot); | ||
| 940 | tz->trips.passive.temperature = CELSIUS_TO_KELVIN(passive); | ||
| 941 | for (i = 0; i < num - 3; i++) { | ||
| 942 | if (!(tz->trips.active[i].flags.valid)) | ||
| 943 | break; | ||
| 944 | tz->trips.active[i].temperature = CELSIUS_TO_KELVIN(active[i]); | ||
| 945 | } | ||
| 946 | |||
| 947 | end: | ||
| 948 | kfree(active); | ||
| 949 | kfree(limit_string); | ||
| 950 | return count; | ||
| 951 | } | ||
| 952 | |||
| 953 | static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) | 888 | static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) |
| 954 | { | 889 | { |
| 955 | struct acpi_thermal *tz = seq->private; | 890 | struct acpi_thermal *tz = seq->private; |
