Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging

Pull hwmon subsystem fixes from Jean Delvare.

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
hwmon: (fam15h_power) Tweak runavg_range on resume
hwmon: (coretemp) Use get_online_cpus to avoid races involving CPU hotplug
hwmon: (via-cputemp) Use get_online_cpus to avoid races involving CPU hotplug

Changed files
+23 -2
drivers
+5
drivers/hwmon/coretemp.c
··· 815 if (err) 816 goto exit; 817 818 for_each_online_cpu(i) 819 get_core_online(i); 820 821 #ifndef CONFIG_HOTPLUG_CPU 822 if (list_empty(&pdev_list)) { 823 err = -ENODEV; 824 goto exit_driver_unreg; 825 } 826 #endif 827 828 register_hotcpu_notifier(&coretemp_cpu_notifier); 829 return 0; 830 831 #ifndef CONFIG_HOTPLUG_CPU ··· 843 { 844 struct pdev_entry *p, *n; 845 846 unregister_hotcpu_notifier(&coretemp_cpu_notifier); 847 mutex_lock(&pdev_list_mutex); 848 list_for_each_entry_safe(p, n, &pdev_list, list) { ··· 852 kfree(p); 853 } 854 mutex_unlock(&pdev_list_mutex); 855 platform_driver_unregister(&coretemp_driver); 856 } 857
··· 815 if (err) 816 goto exit; 817 818 + get_online_cpus(); 819 for_each_online_cpu(i) 820 get_core_online(i); 821 822 #ifndef CONFIG_HOTPLUG_CPU 823 if (list_empty(&pdev_list)) { 824 + put_online_cpus(); 825 err = -ENODEV; 826 goto exit_driver_unreg; 827 } 828 #endif 829 830 register_hotcpu_notifier(&coretemp_cpu_notifier); 831 + put_online_cpus(); 832 return 0; 833 834 #ifndef CONFIG_HOTPLUG_CPU ··· 840 { 841 struct pdev_entry *p, *n; 842 843 + get_online_cpus(); 844 unregister_hotcpu_notifier(&coretemp_cpu_notifier); 845 mutex_lock(&pdev_list_mutex); 846 list_for_each_entry_safe(p, n, &pdev_list, list) { ··· 848 kfree(p); 849 } 850 mutex_unlock(&pdev_list_mutex); 851 + put_online_cpus(); 852 platform_driver_unregister(&coretemp_driver); 853 } 854
+13 -2
drivers/hwmon/fam15h_power.c
··· 129 * counter saturations resulting in bogus power readings. 130 * We correct this value ourselves to cope with older BIOSes. 131 */ 132 - static DEFINE_PCI_DEVICE_TABLE(affected_device) = { 133 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, 134 { 0 } 135 }; 136 137 - static void __devinit tweak_runavg_range(struct pci_dev *pdev) 138 { 139 u32 val; 140 ··· 157 PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), 158 REG_TDP_RUNNING_AVERAGE, val); 159 } 160 161 static void __devinit fam15h_power_init_data(struct pci_dev *f4, 162 struct fam15h_power_data *data) ··· 266 .id_table = fam15h_power_id_table, 267 .probe = fam15h_power_probe, 268 .remove = __devexit_p(fam15h_power_remove), 269 }; 270 271 module_pci_driver(fam15h_power_driver);
··· 129 * counter saturations resulting in bogus power readings. 130 * We correct this value ourselves to cope with older BIOSes. 131 */ 132 + static const struct pci_device_id affected_device[] = { 133 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, 134 { 0 } 135 }; 136 137 + static void tweak_runavg_range(struct pci_dev *pdev) 138 { 139 u32 val; 140 ··· 157 PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), 158 REG_TDP_RUNNING_AVERAGE, val); 159 } 160 + 161 + #ifdef CONFIG_PM 162 + static int fam15h_power_resume(struct pci_dev *pdev) 163 + { 164 + tweak_runavg_range(pdev); 165 + return 0; 166 + } 167 + #else 168 + #define fam15h_power_resume NULL 169 + #endif 170 171 static void __devinit fam15h_power_init_data(struct pci_dev *f4, 172 struct fam15h_power_data *data) ··· 256 .id_table = fam15h_power_id_table, 257 .probe = fam15h_power_probe, 258 .remove = __devexit_p(fam15h_power_remove), 259 + .resume = fam15h_power_resume, 260 }; 261 262 module_pci_driver(fam15h_power_driver);
+5
drivers/hwmon/via-cputemp.c
··· 328 if (err) 329 goto exit; 330 331 for_each_online_cpu(i) { 332 struct cpuinfo_x86 *c = &cpu_data(i); 333 ··· 348 349 #ifndef CONFIG_HOTPLUG_CPU 350 if (list_empty(&pdev_list)) { 351 err = -ENODEV; 352 goto exit_driver_unreg; 353 } 354 #endif 355 356 register_hotcpu_notifier(&via_cputemp_cpu_notifier); 357 return 0; 358 359 #ifndef CONFIG_HOTPLUG_CPU ··· 370 { 371 struct pdev_entry *p, *n; 372 373 unregister_hotcpu_notifier(&via_cputemp_cpu_notifier); 374 mutex_lock(&pdev_list_mutex); 375 list_for_each_entry_safe(p, n, &pdev_list, list) { ··· 379 kfree(p); 380 } 381 mutex_unlock(&pdev_list_mutex); 382 platform_driver_unregister(&via_cputemp_driver); 383 } 384
··· 328 if (err) 329 goto exit; 330 331 + get_online_cpus(); 332 for_each_online_cpu(i) { 333 struct cpuinfo_x86 *c = &cpu_data(i); 334 ··· 347 348 #ifndef CONFIG_HOTPLUG_CPU 349 if (list_empty(&pdev_list)) { 350 + put_online_cpus(); 351 err = -ENODEV; 352 goto exit_driver_unreg; 353 } 354 #endif 355 356 register_hotcpu_notifier(&via_cputemp_cpu_notifier); 357 + put_online_cpus(); 358 return 0; 359 360 #ifndef CONFIG_HOTPLUG_CPU ··· 367 { 368 struct pdev_entry *p, *n; 369 370 + get_online_cpus(); 371 unregister_hotcpu_notifier(&via_cputemp_cpu_notifier); 372 mutex_lock(&pdev_list_mutex); 373 list_for_each_entry_safe(p, n, &pdev_list, list) { ··· 375 kfree(p); 376 } 377 mutex_unlock(&pdev_list_mutex); 378 + put_online_cpus(); 379 platform_driver_unregister(&via_cputemp_driver); 380 } 381