diff options
Diffstat (limited to 'drivers/thermal/x86_pkg_temp_thermal.c')
-rw-r--r-- | drivers/thermal/x86_pkg_temp_thermal.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/thermal/x86_pkg_temp_thermal.c b/drivers/thermal/x86_pkg_temp_thermal.c index f36950e4134f..7722cb9d5a80 100644 --- a/drivers/thermal/x86_pkg_temp_thermal.c +++ b/drivers/thermal/x86_pkg_temp_thermal.c | |||
@@ -316,18 +316,19 @@ static void pkg_temp_thermal_threshold_work_fn(struct work_struct *work) | |||
316 | int phy_id = topology_physical_package_id(cpu); | 316 | int phy_id = topology_physical_package_id(cpu); |
317 | struct phy_dev_entry *phdev = pkg_temp_thermal_get_phy_entry(cpu); | 317 | struct phy_dev_entry *phdev = pkg_temp_thermal_get_phy_entry(cpu); |
318 | bool notify = false; | 318 | bool notify = false; |
319 | unsigned long flags; | ||
319 | 320 | ||
320 | if (!phdev) | 321 | if (!phdev) |
321 | return; | 322 | return; |
322 | 323 | ||
323 | spin_lock(&pkg_work_lock); | 324 | spin_lock_irqsave(&pkg_work_lock, flags); |
324 | ++pkg_work_cnt; | 325 | ++pkg_work_cnt; |
325 | if (unlikely(phy_id > max_phy_id)) { | 326 | if (unlikely(phy_id > max_phy_id)) { |
326 | spin_unlock(&pkg_work_lock); | 327 | spin_unlock_irqrestore(&pkg_work_lock, flags); |
327 | return; | 328 | return; |
328 | } | 329 | } |
329 | pkg_work_scheduled[phy_id] = 0; | 330 | pkg_work_scheduled[phy_id] = 0; |
330 | spin_unlock(&pkg_work_lock); | 331 | spin_unlock_irqrestore(&pkg_work_lock, flags); |
331 | 332 | ||
332 | enable_pkg_thres_interrupt(); | 333 | enable_pkg_thres_interrupt(); |
333 | rdmsrl(MSR_IA32_PACKAGE_THERM_STATUS, msr_val); | 334 | rdmsrl(MSR_IA32_PACKAGE_THERM_STATUS, msr_val); |
@@ -397,6 +398,7 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) | |||
397 | int thres_count; | 398 | int thres_count; |
398 | u32 eax, ebx, ecx, edx; | 399 | u32 eax, ebx, ecx, edx; |
399 | u8 *temp; | 400 | u8 *temp; |
401 | unsigned long flags; | ||
400 | 402 | ||
401 | cpuid(6, &eax, &ebx, &ecx, &edx); | 403 | cpuid(6, &eax, &ebx, &ecx, &edx); |
402 | thres_count = ebx & 0x07; | 404 | thres_count = ebx & 0x07; |
@@ -420,19 +422,19 @@ static int pkg_temp_thermal_device_add(unsigned int cpu) | |||
420 | goto err_ret_unlock; | 422 | goto err_ret_unlock; |
421 | } | 423 | } |
422 | 424 | ||
423 | spin_lock(&pkg_work_lock); | 425 | spin_lock_irqsave(&pkg_work_lock, flags); |
424 | if (topology_physical_package_id(cpu) > max_phy_id) | 426 | if (topology_physical_package_id(cpu) > max_phy_id) |
425 | max_phy_id = topology_physical_package_id(cpu); | 427 | max_phy_id = topology_physical_package_id(cpu); |
426 | temp = krealloc(pkg_work_scheduled, | 428 | temp = krealloc(pkg_work_scheduled, |
427 | (max_phy_id+1) * sizeof(u8), GFP_ATOMIC); | 429 | (max_phy_id+1) * sizeof(u8), GFP_ATOMIC); |
428 | if (!temp) { | 430 | if (!temp) { |
429 | spin_unlock(&pkg_work_lock); | 431 | spin_unlock_irqrestore(&pkg_work_lock, flags); |
430 | err = -ENOMEM; | 432 | err = -ENOMEM; |
431 | goto err_ret_free; | 433 | goto err_ret_free; |
432 | } | 434 | } |
433 | pkg_work_scheduled = temp; | 435 | pkg_work_scheduled = temp; |
434 | pkg_work_scheduled[topology_physical_package_id(cpu)] = 0; | 436 | pkg_work_scheduled[topology_physical_package_id(cpu)] = 0; |
435 | spin_unlock(&pkg_work_lock); | 437 | spin_unlock_irqrestore(&pkg_work_lock, flags); |
436 | 438 | ||
437 | phy_dev_entry->phys_proc_id = topology_physical_package_id(cpu); | 439 | phy_dev_entry->phys_proc_id = topology_physical_package_id(cpu); |
438 | phy_dev_entry->first_cpu = cpu; | 440 | phy_dev_entry->first_cpu = cpu; |