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
815815 if (err)
816816 goto exit;
817817
818+ get_online_cpus();
818819 for_each_online_cpu(i)
819820 get_core_online(i);
820821
821822 #ifndef CONFIG_HOTPLUG_CPU
822823 if (list_empty(&pdev_list)) {
824+ put_online_cpus();
823825 err = -ENODEV;
824826 goto exit_driver_unreg;
825827 }
826828 #endif
827829
828830 register_hotcpu_notifier(&coretemp_cpu_notifier);
831+ put_online_cpus();
829832 return 0;
830833
831834 #ifndef CONFIG_HOTPLUG_CPU
@@ -840,6 +843,7 @@ static void __exit coretemp_exit(void) · 8 unmodified lines
840843 {
841844 struct pdev_entry *p, *n;
842845
846+ get_online_cpus();
843847 unregister_hotcpu_notifier(&coretemp_cpu_notifier);
844848 mutex_lock(&pdev_list_mutex);
845849 list_for_each_entry_safe(p, n, &pdev_list, list) {
@@ -848,6 +852,7 @@ static void __exit coretemp_exit(void) · 2 unmodified lines
848852 kfree(p);
849853 }
850854 mutex_unlock(&pdev_list_mutex);
855+ put_online_cpus();
851856 platform_driver_unregister(&coretemp_driver);
852857 }
853858
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
129129 * counter saturations resulting in bogus power readings.
130130 * We correct this value ourselves to cope with older BIOSes.
131131 */
132−static DEFINE_PCI_DEVICE_TABLE(affected_device) = {
132+static const struct pci_device_id affected_device[] = {
133133 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
134134 { 0 }
135135 };
136136
137−static void __devinit tweak_runavg_range(struct pci_dev *pdev)
137+static void tweak_runavg_range(struct pci_dev *pdev)
138138 {
139139 u32 val;
140140
@@ -158,6 +158,16 @@ static void __devinit tweak_runavg_range(struct pci_dev *pdev) · 17 unmodified lines
158158 REG_TDP_RUNNING_AVERAGE, val);
159159 }
160160
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+
161171 static void __devinit fam15h_power_init_data(struct pci_dev *f4,
162172 struct fam15h_power_data *data)
163173 {
@@ -256,6 +266,7 @@ static struct pci_driver fam15h_power_driver = { · 92 unmodified lines
256266 .id_table = fam15h_power_id_table,
257267 .probe = fam15h_power_probe,
258268 .remove = __devexit_p(fam15h_power_remove),
269+ .resume = fam15h_power_resume,
259270 };
260271
261272 module_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
328328 if (err)
329329 goto exit;
330330
331+ get_online_cpus();
331332 for_each_online_cpu(i) {
332333 struct cpuinfo_x86 *c = &cpu_data(i);
333334
@@ -347,12 +348,14 @@ static int __init via_cputemp_init(void) · 13 unmodified lines
347348
348349 #ifndef CONFIG_HOTPLUG_CPU
349350 if (list_empty(&pdev_list)) {
351+ put_online_cpus();
350352 err = -ENODEV;
351353 goto exit_driver_unreg;
352354 }
353355 #endif
354356
355357 register_hotcpu_notifier(&via_cputemp_cpu_notifier);
358+ put_online_cpus();
356359 return 0;
357360
358361 #ifndef CONFIG_HOTPLUG_CPU
@@ -367,6 +370,7 @@ static void __exit via_cputemp_exit(void) · 8 unmodified lines
367370 {
368371 struct pdev_entry *p, *n;
369372
373+ get_online_cpus();
370374 unregister_hotcpu_notifier(&via_cputemp_cpu_notifier);
371375 mutex_lock(&pdev_list_mutex);
372376 list_for_each_entry_safe(p, n, &pdev_list, list) {
@@ -375,6 +379,7 @@ static void __exit via_cputemp_exit(void) · 2 unmodified lines
375379 kfree(p);
376380 }
377381 mutex_unlock(&pdev_list_mutex);
382+ put_online_cpus();
378383 platform_driver_unregister(&via_cputemp_driver);
379384 }
380385