diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-09-23 17:50:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-09-23 17:50:15 -0400 |
commit | 0737c8d7aedfe590010e38c3e3bbdc87affa8c3d (patch) | |
tree | e3feeb7183c149591dfd89b695baef6bf5218ea9 /drivers | |
parent | 0bf7a7056c7b39502008feb484b95a5877cdf59d (diff) | |
parent | 5f0ecb907deb1e6f28071ee3bd568903b9da1be4 (diff) |
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
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/coretemp.c | 5 | ||||
-rw-r--r-- | drivers/hwmon/fam15h_power.c | 15 | ||||
-rw-r--r-- | drivers/hwmon/via-cputemp.c | 5 |
3 files changed, 23 insertions, 2 deletions
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 0fa356fe82cc..984a3f13923b 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -815,17 +815,20 @@ static int __init coretemp_init(void) | |||
815 | if (err) | 815 | if (err) |
816 | goto exit; | 816 | goto exit; |
817 | 817 | ||
818 | get_online_cpus(); | ||
818 | for_each_online_cpu(i) | 819 | for_each_online_cpu(i) |
819 | get_core_online(i); | 820 | get_core_online(i); |
820 | 821 | ||
821 | #ifndef CONFIG_HOTPLUG_CPU | 822 | #ifndef CONFIG_HOTPLUG_CPU |
822 | if (list_empty(&pdev_list)) { | 823 | if (list_empty(&pdev_list)) { |
824 | put_online_cpus(); | ||
823 | err = -ENODEV; | 825 | err = -ENODEV; |
824 | goto exit_driver_unreg; | 826 | goto exit_driver_unreg; |
825 | } | 827 | } |
826 | #endif | 828 | #endif |
827 | 829 | ||
828 | register_hotcpu_notifier(&coretemp_cpu_notifier); | 830 | register_hotcpu_notifier(&coretemp_cpu_notifier); |
831 | put_online_cpus(); | ||
829 | return 0; | 832 | return 0; |
830 | 833 | ||
831 | #ifndef CONFIG_HOTPLUG_CPU | 834 | #ifndef CONFIG_HOTPLUG_CPU |
@@ -840,6 +843,7 @@ static void __exit coretemp_exit(void) | |||
840 | { | 843 | { |
841 | struct pdev_entry *p, *n; | 844 | struct pdev_entry *p, *n; |
842 | 845 | ||
846 | get_online_cpus(); | ||
843 | unregister_hotcpu_notifier(&coretemp_cpu_notifier); | 847 | unregister_hotcpu_notifier(&coretemp_cpu_notifier); |
844 | mutex_lock(&pdev_list_mutex); | 848 | mutex_lock(&pdev_list_mutex); |
845 | list_for_each_entry_safe(p, n, &pdev_list, list) { | 849 | list_for_each_entry_safe(p, n, &pdev_list, list) { |
@@ -848,6 +852,7 @@ static void __exit coretemp_exit(void) | |||
848 | kfree(p); | 852 | kfree(p); |
849 | } | 853 | } |
850 | mutex_unlock(&pdev_list_mutex); | 854 | mutex_unlock(&pdev_list_mutex); |
855 | put_online_cpus(); | ||
851 | platform_driver_unregister(&coretemp_driver); | 856 | platform_driver_unregister(&coretemp_driver); |
852 | } | 857 | } |
853 | 858 | ||
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index 2764b78a784b..af69073b3fe8 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -129,12 +129,12 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) | |||
129 | * counter saturations resulting in bogus power readings. | 129 | * counter saturations resulting in bogus power readings. |
130 | * We correct this value ourselves to cope with older BIOSes. | 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 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | 133 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, |
134 | { 0 } | 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 | u32 val; | 139 | u32 val; |
140 | 140 | ||
@@ -158,6 +158,16 @@ static void __devinit tweak_runavg_range(struct pci_dev *pdev) | |||
158 | REG_TDP_RUNNING_AVERAGE, val); | 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 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, | 171 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, |
162 | struct fam15h_power_data *data) | 172 | struct fam15h_power_data *data) |
163 | { | 173 | { |
@@ -256,6 +266,7 @@ static struct pci_driver fam15h_power_driver = { | |||
256 | .id_table = fam15h_power_id_table, | 266 | .id_table = fam15h_power_id_table, |
257 | .probe = fam15h_power_probe, | 267 | .probe = fam15h_power_probe, |
258 | .remove = __devexit_p(fam15h_power_remove), | 268 | .remove = __devexit_p(fam15h_power_remove), |
269 | .resume = fam15h_power_resume, | ||
259 | }; | 270 | }; |
260 | 271 | ||
261 | module_pci_driver(fam15h_power_driver); | 272 | module_pci_driver(fam15h_power_driver); |
diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c index ee4ebc198a94..2e56c6ce9fb6 100644 --- a/drivers/hwmon/via-cputemp.c +++ b/drivers/hwmon/via-cputemp.c | |||
@@ -328,6 +328,7 @@ static int __init via_cputemp_init(void) | |||
328 | if (err) | 328 | if (err) |
329 | goto exit; | 329 | goto exit; |
330 | 330 | ||
331 | get_online_cpus(); | ||
331 | for_each_online_cpu(i) { | 332 | for_each_online_cpu(i) { |
332 | struct cpuinfo_x86 *c = &cpu_data(i); | 333 | struct cpuinfo_x86 *c = &cpu_data(i); |
333 | 334 | ||
@@ -347,12 +348,14 @@ static int __init via_cputemp_init(void) | |||
347 | 348 | ||
348 | #ifndef CONFIG_HOTPLUG_CPU | 349 | #ifndef CONFIG_HOTPLUG_CPU |
349 | if (list_empty(&pdev_list)) { | 350 | if (list_empty(&pdev_list)) { |
351 | put_online_cpus(); | ||
350 | err = -ENODEV; | 352 | err = -ENODEV; |
351 | goto exit_driver_unreg; | 353 | goto exit_driver_unreg; |
352 | } | 354 | } |
353 | #endif | 355 | #endif |
354 | 356 | ||
355 | register_hotcpu_notifier(&via_cputemp_cpu_notifier); | 357 | register_hotcpu_notifier(&via_cputemp_cpu_notifier); |
358 | put_online_cpus(); | ||
356 | return 0; | 359 | return 0; |
357 | 360 | ||
358 | #ifndef CONFIG_HOTPLUG_CPU | 361 | #ifndef CONFIG_HOTPLUG_CPU |
@@ -367,6 +370,7 @@ static void __exit via_cputemp_exit(void) | |||
367 | { | 370 | { |
368 | struct pdev_entry *p, *n; | 371 | struct pdev_entry *p, *n; |
369 | 372 | ||
373 | get_online_cpus(); | ||
370 | unregister_hotcpu_notifier(&via_cputemp_cpu_notifier); | 374 | unregister_hotcpu_notifier(&via_cputemp_cpu_notifier); |
371 | mutex_lock(&pdev_list_mutex); | 375 | mutex_lock(&pdev_list_mutex); |
372 | list_for_each_entry_safe(p, n, &pdev_list, list) { | 376 | list_for_each_entry_safe(p, n, &pdev_list, list) { |
@@ -375,6 +379,7 @@ static void __exit via_cputemp_exit(void) | |||
375 | kfree(p); | 379 | kfree(p); |
376 | } | 380 | } |
377 | mutex_unlock(&pdev_list_mutex); | 381 | mutex_unlock(&pdev_list_mutex); |
382 | put_online_cpus(); | ||
378 | platform_driver_unregister(&via_cputemp_driver); | 383 | platform_driver_unregister(&via_cputemp_driver); |
379 | } | 384 | } |
380 | 385 | ||