History

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

Linus Torvalds committed 14 years ago

Commit 0737c8d2 parents 0bf7a70 5f0ecb93 files · +23 −2Browse files

Unified · Split

3 files
  1. drivers/hwmon/coretemp.c +5 −0
  2. drivers/hwmon/fam15h_power.c +13 −2
  3. drivers/hwmon/via-cputemp.c +5 −0
drivers/hwmon/coretemp.c+5−0
@@ -815,17 +815,20 @@ static int __init coretemp_init(void) · 814 unmodified lines
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_CPU822#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#endif828#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_CPU834#ifndef CONFIG_HOTPLUG_CPU
@@ -840,6 +843,7 @@ static void __exit coretemp_exit(void) · 8 unmodified lines
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) · 2 unmodified lines
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
drivers/hwmon/fam15h_power.c+13−2
@@ -129,12 +129,12 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) · 128 unmodified lines
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 */
132static DEFINE_PCI_DEVICE_TABLE(affected_device) = {132static 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
137static void __devinit tweak_runavg_range(struct pci_dev *pdev)137static 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) · 17 unmodified lines
158 REG_TDP_RUNNING_AVERAGE, val);158 REG_TDP_RUNNING_AVERAGE, val);
159}159}
160 160
161#ifdef CONFIG_PM
162static 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
161static void __devinit fam15h_power_init_data(struct pci_dev *f4,171static 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 = { · 92 unmodified lines
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
261module_pci_driver(fam15h_power_driver);272module_pci_driver(fam15h_power_driver);
drivers/hwmon/via-cputemp.c+5−0
@@ -328,6 +328,7 @@ static int __init via_cputemp_init(void) · 327 unmodified lines
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) · 13 unmodified lines
347 348
348#ifndef CONFIG_HOTPLUG_CPU349#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#endif355#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_CPU361#ifndef CONFIG_HOTPLUG_CPU
@@ -367,6 +370,7 @@ static void __exit via_cputemp_exit(void) · 8 unmodified lines
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) · 2 unmodified lines
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