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
Unified · Split
| @@ -815,17 +815,20 @@ static int __init coretemp_init(void) · 814 unmodified lines | ||
| 815 | 815 | if (err) |
| 816 | 816 | goto exit; |
| 817 | 817 | |
| 818 | + get_online_cpus(); | |
| 818 | 819 | for_each_online_cpu(i) |
| 819 | 820 | get_core_online(i); |
| 820 | 821 | |
| 821 | 822 | #ifndef CONFIG_HOTPLUG_CPU |
| 822 | 823 | if (list_empty(&pdev_list)) { |
| 824 | + put_online_cpus(); | |
| 823 | 825 | err = -ENODEV; |
| 824 | 826 | goto exit_driver_unreg; |
| 825 | 827 | } |
| 826 | 828 | #endif |
| 827 | 829 | |
| 828 | 830 | register_hotcpu_notifier(&coretemp_cpu_notifier); |
| 831 | + put_online_cpus(); | |
| 829 | 832 | return 0; |
| 830 | 833 | |
| 831 | 834 | #ifndef CONFIG_HOTPLUG_CPU |
| @@ -840,6 +843,7 @@ static void __exit coretemp_exit(void) · 8 unmodified lines | ||
| 840 | 843 | { |
| 841 | 844 | struct pdev_entry *p, *n; |
| 842 | 845 | |
| 846 | + get_online_cpus(); | |
| 843 | 847 | unregister_hotcpu_notifier(&coretemp_cpu_notifier); |
| 844 | 848 | mutex_lock(&pdev_list_mutex); |
| 845 | 849 | list_for_each_entry_safe(p, n, &pdev_list, list) { |
| @@ -848,6 +852,7 @@ static void __exit coretemp_exit(void) · 2 unmodified lines | ||
| 848 | 852 | kfree(p); |
| 849 | 853 | } |
| 850 | 854 | mutex_unlock(&pdev_list_mutex); |
| 855 | + put_online_cpus(); | |
| 851 | 856 | platform_driver_unregister(&coretemp_driver); |
| 852 | 857 | } |
| 853 | 858 | |
| @@ -129,12 +129,12 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) · 128 unmodified lines | ||
| 129 | 129 | * counter saturations resulting in bogus power readings. |
| 130 | 130 | * We correct this value ourselves to cope with older BIOSes. |
| 131 | 131 | */ |
| 132 | −static DEFINE_PCI_DEVICE_TABLE(affected_device) = { | |
| 132 | +static const struct pci_device_id affected_device[] = { | |
| 133 | 133 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, |
| 134 | 134 | { 0 } |
| 135 | 135 | }; |
| 136 | 136 | |
| 137 | −static void __devinit tweak_runavg_range(struct pci_dev *pdev) | |
| 137 | +static void tweak_runavg_range(struct pci_dev *pdev) | |
| 138 | 138 | { |
| 139 | 139 | u32 val; |
| 140 | 140 | |
| @@ -158,6 +158,16 @@ static void __devinit tweak_runavg_range(struct pci_dev *pdev) · 17 unmodified lines | ||
| 158 | 158 | REG_TDP_RUNNING_AVERAGE, val); |
| 159 | 159 | } |
| 160 | 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 | + | |
| 161 | 171 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, |
| 162 | 172 | struct fam15h_power_data *data) |
| 163 | 173 | { |
| @@ -256,6 +266,7 @@ static struct pci_driver fam15h_power_driver = { · 92 unmodified lines | ||
| 256 | 266 | .id_table = fam15h_power_id_table, |
| 257 | 267 | .probe = fam15h_power_probe, |
| 258 | 268 | .remove = __devexit_p(fam15h_power_remove), |
| 269 | + .resume = fam15h_power_resume, | |
| 259 | 270 | }; |
| 260 | 271 | |
| 261 | 272 | module_pci_driver(fam15h_power_driver); |
| @@ -328,6 +328,7 @@ static int __init via_cputemp_init(void) · 327 unmodified lines | ||
| 328 | 328 | if (err) |
| 329 | 329 | goto exit; |
| 330 | 330 | |
| 331 | + get_online_cpus(); | |
| 331 | 332 | for_each_online_cpu(i) { |
| 332 | 333 | struct cpuinfo_x86 *c = &cpu_data(i); |
| 333 | 334 | |
| @@ -347,12 +348,14 @@ static int __init via_cputemp_init(void) · 13 unmodified lines | ||
| 347 | 348 | |
| 348 | 349 | #ifndef CONFIG_HOTPLUG_CPU |
| 349 | 350 | if (list_empty(&pdev_list)) { |
| 351 | + put_online_cpus(); | |
| 350 | 352 | err = -ENODEV; |
| 351 | 353 | goto exit_driver_unreg; |
| 352 | 354 | } |
| 353 | 355 | #endif |
| 354 | 356 | |
| 355 | 357 | register_hotcpu_notifier(&via_cputemp_cpu_notifier); |
| 358 | + put_online_cpus(); | |
| 356 | 359 | return 0; |
| 357 | 360 | |
| 358 | 361 | #ifndef CONFIG_HOTPLUG_CPU |
| @@ -367,6 +370,7 @@ static void __exit via_cputemp_exit(void) · 8 unmodified lines | ||
| 367 | 370 | { |
| 368 | 371 | struct pdev_entry *p, *n; |
| 369 | 372 | |
| 373 | + get_online_cpus(); | |
| 370 | 374 | unregister_hotcpu_notifier(&via_cputemp_cpu_notifier); |
| 371 | 375 | mutex_lock(&pdev_list_mutex); |
| 372 | 376 | list_for_each_entry_safe(p, n, &pdev_list, list) { |
| @@ -375,6 +379,7 @@ static void __exit via_cputemp_exit(void) · 2 unmodified lines | ||
| 375 | 379 | kfree(p); |
| 376 | 380 | } |
| 377 | 381 | mutex_unlock(&pdev_list_mutex); |
| 382 | + put_online_cpus(); | |
| 378 | 383 | platform_driver_unregister(&via_cputemp_driver); |
| 379 | 384 | } |
| 380 | 385 | |