diff options
author | Alexey Starikovskiy <astarikovskiy@suse.de> | 2007-08-31 16:11:59 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-09-05 14:23:18 -0400 |
commit | 6e2157858ac94530fddbf19dc59ab6b392baf1f3 (patch) | |
tree | f8c6072404758a24c65bc04c63f84344672e2b0e /drivers/acpi/thermal.c | |
parent | 21bc42ab852549f4a547d18d77e0e4d1b24ffd96 (diff) |
ACPI: Thermal: Drop concurrent thermal checks
Fix for #3686, where get_temperature() may cause thermal notify, which
causes one more get_temperature().
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r-- | drivers/acpi/thermal.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 15d5fdc66a96..69ec73b0239d 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -195,6 +195,7 @@ struct acpi_thermal { | |||
195 | struct acpi_thermal_trips trips; | 195 | struct acpi_thermal_trips trips; |
196 | struct acpi_handle_list devices; | 196 | struct acpi_handle_list devices; |
197 | struct timer_list timer; | 197 | struct timer_list timer; |
198 | struct mutex lock; | ||
198 | }; | 199 | }; |
199 | 200 | ||
200 | static const struct file_operations acpi_thermal_state_fops = { | 201 | static const struct file_operations acpi_thermal_state_fops = { |
@@ -721,11 +722,15 @@ static void acpi_thermal_check(void *data) | |||
721 | return; | 722 | return; |
722 | } | 723 | } |
723 | 724 | ||
725 | /* Check if someone else is already running */ | ||
726 | if (!mutex_trylock(&tz->lock)) | ||
727 | return; | ||
728 | |||
724 | state = tz->state; | 729 | state = tz->state; |
725 | 730 | ||
726 | result = acpi_thermal_get_temperature(tz); | 731 | result = acpi_thermal_get_temperature(tz); |
727 | if (result) | 732 | if (result) |
728 | return; | 733 | goto unlock; |
729 | 734 | ||
730 | memset(&tz->state, 0, sizeof(tz->state)); | 735 | memset(&tz->state, 0, sizeof(tz->state)); |
731 | 736 | ||
@@ -816,8 +821,8 @@ static void acpi_thermal_check(void *data) | |||
816 | add_timer(&(tz->timer)); | 821 | add_timer(&(tz->timer)); |
817 | } | 822 | } |
818 | } | 823 | } |
819 | 824 | unlock: | |
820 | return; | 825 | mutex_unlock(&tz->lock); |
821 | } | 826 | } |
822 | 827 | ||
823 | /* -------------------------------------------------------------------------- | 828 | /* -------------------------------------------------------------------------- |
@@ -1254,7 +1259,7 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1254 | strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); | 1259 | strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); |
1255 | strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); | 1260 | strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); |
1256 | acpi_driver_data(device) = tz; | 1261 | acpi_driver_data(device) = tz; |
1257 | 1262 | mutex_init(&tz->lock); | |
1258 | result = acpi_thermal_get_info(tz); | 1263 | result = acpi_thermal_get_info(tz); |
1259 | if (result) | 1264 | if (result) |
1260 | goto end; | 1265 | goto end; |
@@ -1324,7 +1329,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1324 | } | 1329 | } |
1325 | 1330 | ||
1326 | acpi_thermal_remove_fs(device); | 1331 | acpi_thermal_remove_fs(device); |
1327 | 1332 | mutex_destroy(&tz->lock); | |
1328 | kfree(tz); | 1333 | kfree(tz); |
1329 | return 0; | 1334 | return 0; |
1330 | } | 1335 | } |