Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Pull thermal into release branch

Len Brown f697b677 de560374

+2 -102
+2 -102
drivers/acpi/thermal.c
··· 59 59 #define ACPI_THERMAL_NOTIFY_CRITICAL 0xF0 60 60 #define ACPI_THERMAL_NOTIFY_HOT 0xF1 61 61 #define ACPI_THERMAL_MODE_ACTIVE 0x00 62 - #define ACPI_THERMAL_MODE_PASSIVE 0x01 63 - #define ACPI_THERMAL_MODE_CRITICAL 0xff 64 62 #define ACPI_THERMAL_PATH_POWEROFF "/sbin/poweroff" 65 63 66 64 #define ACPI_THERMAL_MAX_ACTIVE 10 ··· 84 86 static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); 85 87 static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); 86 88 static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); 87 - static ssize_t acpi_thermal_write_trip_points(struct file *, 88 - const char __user *, size_t, 89 - loff_t *); 90 89 static int acpi_thermal_cooling_open_fs(struct inode *inode, struct file *file); 91 90 static ssize_t acpi_thermal_write_cooling_mode(struct file *, 92 91 const char __user *, size_t, ··· 162 167 unsigned long temperature; 163 168 unsigned long last_temperature; 164 169 unsigned long polling_frequency; 165 - u8 cooling_mode; 166 170 volatile u8 zombie; 167 171 struct acpi_thermal_flags flags; 168 172 struct acpi_thermal_state state; ··· 187 193 static const struct file_operations acpi_thermal_trip_fops = { 188 194 .open = acpi_thermal_trip_open_fs, 189 195 .read = seq_read, 190 - .write = acpi_thermal_write_trip_points, 191 196 .llseek = seq_lseek, 192 197 .release = single_release, 193 198 }; ··· 289 296 status = acpi_evaluate_object(handle, NULL, &arg_list, NULL); 290 297 if (ACPI_FAILURE(status)) 291 298 return -ENODEV; 292 - 293 - tz->cooling_mode = mode; 294 - 295 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Cooling mode [%s]\n", 296 - mode ? "passive" : "active")); 297 299 298 300 return 0; 299 301 } ··· 877 889 return single_open(file, acpi_thermal_trip_seq_show, PDE(inode)->data); 878 890 } 879 891 880 - static ssize_t 881 - acpi_thermal_write_trip_points(struct file *file, 882 - const char __user * buffer, 883 - size_t count, loff_t * ppos) 884 - { 885 - struct seq_file *m = file->private_data; 886 - struct acpi_thermal *tz = m->private; 887 - 888 - char *limit_string; 889 - int num, critical, hot, passive; 890 - int *active; 891 - int i = 0; 892 - 893 - 894 - limit_string = kzalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); 895 - if (!limit_string) 896 - return -ENOMEM; 897 - 898 - active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); 899 - if (!active) { 900 - kfree(limit_string); 901 - return -ENOMEM; 902 - } 903 - 904 - if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { 905 - count = -EINVAL; 906 - goto end; 907 - } 908 - 909 - if (copy_from_user(limit_string, buffer, count)) { 910 - count = -EFAULT; 911 - goto end; 912 - } 913 - 914 - limit_string[count] = '\0'; 915 - 916 - num = sscanf(limit_string, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d", 917 - &critical, &hot, &passive, 918 - &active[0], &active[1], &active[2], &active[3], &active[4], 919 - &active[5], &active[6], &active[7], &active[8], 920 - &active[9]); 921 - if (!(num >= 5 && num < (ACPI_THERMAL_MAX_ACTIVE + 3))) { 922 - count = -EINVAL; 923 - goto end; 924 - } 925 - 926 - tz->trips.critical.temperature = CELSIUS_TO_KELVIN(critical); 927 - tz->trips.hot.temperature = CELSIUS_TO_KELVIN(hot); 928 - tz->trips.passive.temperature = CELSIUS_TO_KELVIN(passive); 929 - for (i = 0; i < num - 3; i++) { 930 - if (!(tz->trips.active[i].flags.valid)) 931 - break; 932 - tz->trips.active[i].temperature = CELSIUS_TO_KELVIN(active[i]); 933 - } 934 - 935 - end: 936 - kfree(active); 937 - kfree(limit_string); 938 - return count; 939 - } 940 - 941 892 static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) 942 893 { 943 894 struct acpi_thermal *tz = seq->private; ··· 885 958 if (!tz) 886 959 goto end; 887 960 888 - if (!tz->flags.cooling_mode) { 961 + if (!tz->flags.cooling_mode) 889 962 seq_puts(seq, "<setting not supported>\n"); 890 - } 891 - 892 - if (tz->cooling_mode == ACPI_THERMAL_MODE_CRITICAL) 893 - seq_printf(seq, "cooling mode: critical\n"); 894 963 else 895 - seq_printf(seq, "cooling mode: %s\n", 896 - tz->cooling_mode ? "passive" : "active"); 964 + seq_puts(seq, "0 - Active; 1 - Passive\n"); 897 965 898 966 end: 899 967 return 0; ··· 1145 1223 result = acpi_thermal_set_cooling_mode(tz, ACPI_THERMAL_MODE_ACTIVE); 1146 1224 if (!result) 1147 1225 tz->flags.cooling_mode = 1; 1148 - else { 1149 - /* Oh,we have not _SCP method. 1150 - Generally show cooling_mode by _ACx, _PSV,spec 12.2 */ 1151 - tz->flags.cooling_mode = 0; 1152 - if (tz->trips.active[0].flags.valid 1153 - && tz->trips.passive.flags.valid) { 1154 - if (tz->trips.passive.temperature > 1155 - tz->trips.active[0].temperature) 1156 - tz->cooling_mode = ACPI_THERMAL_MODE_ACTIVE; 1157 - else 1158 - tz->cooling_mode = ACPI_THERMAL_MODE_PASSIVE; 1159 - } else if (!tz->trips.active[0].flags.valid 1160 - && tz->trips.passive.flags.valid) { 1161 - tz->cooling_mode = ACPI_THERMAL_MODE_PASSIVE; 1162 - } else if (tz->trips.active[0].flags.valid 1163 - && !tz->trips.passive.flags.valid) { 1164 - tz->cooling_mode = ACPI_THERMAL_MODE_ACTIVE; 1165 - } else { 1166 - /* _ACx and _PSV are optional, but _CRT is required */ 1167 - tz->cooling_mode = ACPI_THERMAL_MODE_CRITICAL; 1168 - } 1169 - } 1170 1226 1171 1227 /* Get default polling frequency [_TZP] (optional) */ 1172 1228 if (tzp)