diff options
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r-- | drivers/acpi/thermal.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 5753d06b7860..40ddb4dd9631 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -663,7 +663,7 @@ static void acpi_thermal_run(unsigned long data) | |||
663 | static void acpi_thermal_check(void *data) | 663 | static void acpi_thermal_check(void *data) |
664 | { | 664 | { |
665 | int result = 0; | 665 | int result = 0; |
666 | struct acpi_thermal *tz = (struct acpi_thermal *)data; | 666 | struct acpi_thermal *tz = data; |
667 | unsigned long sleep_time = 0; | 667 | unsigned long sleep_time = 0; |
668 | int i = 0; | 668 | int i = 0; |
669 | struct acpi_thermal_state state; | 669 | struct acpi_thermal_state state; |
@@ -778,7 +778,7 @@ static struct proc_dir_entry *acpi_thermal_dir; | |||
778 | 778 | ||
779 | static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) | 779 | static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset) |
780 | { | 780 | { |
781 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 781 | struct acpi_thermal *tz = seq->private; |
782 | 782 | ||
783 | 783 | ||
784 | if (!tz) | 784 | if (!tz) |
@@ -813,7 +813,7 @@ static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file) | |||
813 | static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) | 813 | static int acpi_thermal_temp_seq_show(struct seq_file *seq, void *offset) |
814 | { | 814 | { |
815 | int result = 0; | 815 | int result = 0; |
816 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 816 | struct acpi_thermal *tz = seq->private; |
817 | 817 | ||
818 | 818 | ||
819 | if (!tz) | 819 | if (!tz) |
@@ -837,7 +837,7 @@ static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file) | |||
837 | 837 | ||
838 | static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) | 838 | static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset) |
839 | { | 839 | { |
840 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 840 | struct acpi_thermal *tz = seq->private; |
841 | int i = 0; | 841 | int i = 0; |
842 | int j = 0; | 842 | int j = 0; |
843 | 843 | ||
@@ -893,8 +893,8 @@ acpi_thermal_write_trip_points(struct file *file, | |||
893 | const char __user * buffer, | 893 | const char __user * buffer, |
894 | size_t count, loff_t * ppos) | 894 | size_t count, loff_t * ppos) |
895 | { | 895 | { |
896 | struct seq_file *m = (struct seq_file *)file->private_data; | 896 | struct seq_file *m = file->private_data; |
897 | struct acpi_thermal *tz = (struct acpi_thermal *)m->private; | 897 | struct acpi_thermal *tz = m->private; |
898 | 898 | ||
899 | char *limit_string; | 899 | char *limit_string; |
900 | int num, critical, hot, passive; | 900 | int num, critical, hot, passive; |
@@ -902,12 +902,10 @@ acpi_thermal_write_trip_points(struct file *file, | |||
902 | int i = 0; | 902 | int i = 0; |
903 | 903 | ||
904 | 904 | ||
905 | limit_string = kmalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); | 905 | limit_string = kzalloc(ACPI_THERMAL_MAX_LIMIT_STR_LEN, GFP_KERNEL); |
906 | if (!limit_string) | 906 | if (!limit_string) |
907 | return -ENOMEM; | 907 | return -ENOMEM; |
908 | 908 | ||
909 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); | ||
910 | |||
911 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); | 909 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); |
912 | if (!active) { | 910 | if (!active) { |
913 | kfree(limit_string); | 911 | kfree(limit_string); |
@@ -953,7 +951,7 @@ acpi_thermal_write_trip_points(struct file *file, | |||
953 | 951 | ||
954 | static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) | 952 | static int acpi_thermal_cooling_seq_show(struct seq_file *seq, void *offset) |
955 | { | 953 | { |
956 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 954 | struct acpi_thermal *tz = seq->private; |
957 | 955 | ||
958 | 956 | ||
959 | if (!tz) | 957 | if (!tz) |
@@ -984,8 +982,8 @@ acpi_thermal_write_cooling_mode(struct file *file, | |||
984 | const char __user * buffer, | 982 | const char __user * buffer, |
985 | size_t count, loff_t * ppos) | 983 | size_t count, loff_t * ppos) |
986 | { | 984 | { |
987 | struct seq_file *m = (struct seq_file *)file->private_data; | 985 | struct seq_file *m = file->private_data; |
988 | struct acpi_thermal *tz = (struct acpi_thermal *)m->private; | 986 | struct acpi_thermal *tz = m->private; |
989 | int result = 0; | 987 | int result = 0; |
990 | char mode_string[12] = { '\0' }; | 988 | char mode_string[12] = { '\0' }; |
991 | 989 | ||
@@ -1014,7 +1012,7 @@ acpi_thermal_write_cooling_mode(struct file *file, | |||
1014 | 1012 | ||
1015 | static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) | 1013 | static int acpi_thermal_polling_seq_show(struct seq_file *seq, void *offset) |
1016 | { | 1014 | { |
1017 | struct acpi_thermal *tz = (struct acpi_thermal *)seq->private; | 1015 | struct acpi_thermal *tz = seq->private; |
1018 | 1016 | ||
1019 | 1017 | ||
1020 | if (!tz) | 1018 | if (!tz) |
@@ -1043,8 +1041,8 @@ acpi_thermal_write_polling(struct file *file, | |||
1043 | const char __user * buffer, | 1041 | const char __user * buffer, |
1044 | size_t count, loff_t * ppos) | 1042 | size_t count, loff_t * ppos) |
1045 | { | 1043 | { |
1046 | struct seq_file *m = (struct seq_file *)file->private_data; | 1044 | struct seq_file *m = file->private_data; |
1047 | struct acpi_thermal *tz = (struct acpi_thermal *)m->private; | 1045 | struct acpi_thermal *tz = m->private; |
1048 | int result = 0; | 1046 | int result = 0; |
1049 | char polling_string[12] = { '\0' }; | 1047 | char polling_string[12] = { '\0' }; |
1050 | int seconds = 0; | 1048 | int seconds = 0; |
@@ -1170,7 +1168,7 @@ static int acpi_thermal_remove_fs(struct acpi_device *device) | |||
1170 | 1168 | ||
1171 | static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) | 1169 | static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) |
1172 | { | 1170 | { |
1173 | struct acpi_thermal *tz = (struct acpi_thermal *)data; | 1171 | struct acpi_thermal *tz = data; |
1174 | struct acpi_device *device = NULL; | 1172 | struct acpi_device *device = NULL; |
1175 | 1173 | ||
1176 | 1174 | ||
@@ -1271,10 +1269,9 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1271 | if (!device) | 1269 | if (!device) |
1272 | return -EINVAL; | 1270 | return -EINVAL; |
1273 | 1271 | ||
1274 | tz = kmalloc(sizeof(struct acpi_thermal), GFP_KERNEL); | 1272 | tz = kzalloc(sizeof(struct acpi_thermal), GFP_KERNEL); |
1275 | if (!tz) | 1273 | if (!tz) |
1276 | return -ENOMEM; | 1274 | return -ENOMEM; |
1277 | memset(tz, 0, sizeof(struct acpi_thermal)); | ||
1278 | 1275 | ||
1279 | tz->device = device; | 1276 | tz->device = device; |
1280 | strcpy(tz->name, device->pnp.bus_id); | 1277 | strcpy(tz->name, device->pnp.bus_id); |
@@ -1324,7 +1321,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1324 | if (!device || !acpi_driver_data(device)) | 1321 | if (!device || !acpi_driver_data(device)) |
1325 | return -EINVAL; | 1322 | return -EINVAL; |
1326 | 1323 | ||
1327 | tz = (struct acpi_thermal *)acpi_driver_data(device); | 1324 | tz = acpi_driver_data(device); |
1328 | 1325 | ||
1329 | /* avoid timer adding new defer task */ | 1326 | /* avoid timer adding new defer task */ |
1330 | tz->zombie = 1; | 1327 | tz->zombie = 1; |
@@ -1364,7 +1361,7 @@ static int acpi_thermal_resume(struct acpi_device *device, int state) | |||
1364 | if (!device || !acpi_driver_data(device)) | 1361 | if (!device || !acpi_driver_data(device)) |
1365 | return -EINVAL; | 1362 | return -EINVAL; |
1366 | 1363 | ||
1367 | tz = (struct acpi_thermal *)acpi_driver_data(device); | 1364 | tz = acpi_driver_data(device); |
1368 | 1365 | ||
1369 | acpi_thermal_get_temperature(tz); | 1366 | acpi_thermal_get_temperature(tz); |
1370 | 1367 | ||