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
This commit is contained in:
commit
0737c8d7ae
|
@ -815,17 +815,20 @@ static int __init coretemp_init(void)
|
|||
if (err)
|
||||
goto exit;
|
||||
|
||||
get_online_cpus();
|
||||
for_each_online_cpu(i)
|
||||
get_core_online(i);
|
||||
|
||||
#ifndef CONFIG_HOTPLUG_CPU
|
||||
if (list_empty(&pdev_list)) {
|
||||
put_online_cpus();
|
||||
err = -ENODEV;
|
||||
goto exit_driver_unreg;
|
||||
}
|
||||
#endif
|
||||
|
||||
register_hotcpu_notifier(&coretemp_cpu_notifier);
|
||||
put_online_cpus();
|
||||
return 0;
|
||||
|
||||
#ifndef CONFIG_HOTPLUG_CPU
|
||||
|
@ -840,6 +843,7 @@ static void __exit coretemp_exit(void)
|
|||
{
|
||||
struct pdev_entry *p, *n;
|
||||
|
||||
get_online_cpus();
|
||||
unregister_hotcpu_notifier(&coretemp_cpu_notifier);
|
||||
mutex_lock(&pdev_list_mutex);
|
||||
list_for_each_entry_safe(p, n, &pdev_list, list) {
|
||||
|
@ -848,6 +852,7 @@ static void __exit coretemp_exit(void)
|
|||
kfree(p);
|
||||
}
|
||||
mutex_unlock(&pdev_list_mutex);
|
||||
put_online_cpus();
|
||||
platform_driver_unregister(&coretemp_driver);
|
||||
}
|
||||
|
||||
|
|
|
@ -129,12 +129,12 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)
|
|||
* counter saturations resulting in bogus power readings.
|
||||
* We correct this value ourselves to cope with older BIOSes.
|
||||
*/
|
||||
static DEFINE_PCI_DEVICE_TABLE(affected_device) = {
|
||||
static const struct pci_device_id affected_device[] = {
|
||||
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static void __devinit tweak_runavg_range(struct pci_dev *pdev)
|
||||
static void tweak_runavg_range(struct pci_dev *pdev)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
|
@ -158,6 +158,16 @@ static void __devinit tweak_runavg_range(struct pci_dev *pdev)
|
|||
REG_TDP_RUNNING_AVERAGE, val);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int fam15h_power_resume(struct pci_dev *pdev)
|
||||
{
|
||||
tweak_runavg_range(pdev);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define fam15h_power_resume NULL
|
||||
#endif
|
||||
|
||||
static void __devinit fam15h_power_init_data(struct pci_dev *f4,
|
||||
struct fam15h_power_data *data)
|
||||
{
|
||||
|
@ -256,6 +266,7 @@ static struct pci_driver fam15h_power_driver = {
|
|||
.id_table = fam15h_power_id_table,
|
||||
.probe = fam15h_power_probe,
|
||||
.remove = __devexit_p(fam15h_power_remove),
|
||||
.resume = fam15h_power_resume,
|
||||
};
|
||||
|
||||
module_pci_driver(fam15h_power_driver);
|
||||
|
|
|
@ -328,6 +328,7 @@ static int __init via_cputemp_init(void)
|
|||
if (err)
|
||||
goto exit;
|
||||
|
||||
get_online_cpus();
|
||||
for_each_online_cpu(i) {
|
||||
struct cpuinfo_x86 *c = &cpu_data(i);
|
||||
|
||||
|
@ -347,12 +348,14 @@ static int __init via_cputemp_init(void)
|
|||
|
||||
#ifndef CONFIG_HOTPLUG_CPU
|
||||
if (list_empty(&pdev_list)) {
|
||||
put_online_cpus();
|
||||
err = -ENODEV;
|
||||
goto exit_driver_unreg;
|
||||
}
|
||||
#endif
|
||||
|
||||
register_hotcpu_notifier(&via_cputemp_cpu_notifier);
|
||||
put_online_cpus();
|
||||
return 0;
|
||||
|
||||
#ifndef CONFIG_HOTPLUG_CPU
|
||||
|
@ -367,6 +370,7 @@ static void __exit via_cputemp_exit(void)
|
|||
{
|
||||
struct pdev_entry *p, *n;
|
||||
|
||||
get_online_cpus();
|
||||
unregister_hotcpu_notifier(&via_cputemp_cpu_notifier);
|
||||
mutex_lock(&pdev_list_mutex);
|
||||
list_for_each_entry_safe(p, n, &pdev_list, list) {
|
||||
|
@ -375,6 +379,7 @@ static void __exit via_cputemp_exit(void)
|
|||
kfree(p);
|
||||
}
|
||||
mutex_unlock(&pdev_list_mutex);
|
||||
put_online_cpus();
|
||||
platform_driver_unregister(&via_cputemp_driver);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue