Skip to content

Commit

Permalink
x86/hwmon: register alternate sibling upon CPU removal
Browse files Browse the repository at this point in the history
Just like pkgtemp registers another core of the same package when one
gets removed, coretemp should register another hyperthread (if
available) in that situation.

As pointed out in the patch fixing the respective code in pkgtemp, the
list protectng mutex must be dropped before calling
coretemp_device_add(), and due to the restructured loop (including an
explicit return) the "safe" variant of the list iterator isn't needed
anymore.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
  • Loading branch information
Jan Beulich authored and Guenter Roeck committed Sep 24, 2010
1 parent f6aeccd commit e40cc4b
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions drivers/hwmon/coretemp.c
Expand Up @@ -491,14 +491,22 @@ static int __cpuinit coretemp_device_add(unsigned int cpu)

static void coretemp_device_remove(unsigned int cpu)
{
struct pdev_entry *p, *n;
struct pdev_entry *p;
unsigned int i;

mutex_lock(&pdev_list_mutex);
list_for_each_entry_safe(p, n, &pdev_list, list) {
if (p->cpu == cpu) {
platform_device_unregister(p->pdev);
list_del(&p->list);
kfree(p);
}
list_for_each_entry(p, &pdev_list, list) {
if (p->cpu != cpu)
continue;

platform_device_unregister(p->pdev);
list_del(&p->list);
mutex_unlock(&pdev_list_mutex);
kfree(p);
for_each_cpu(i, cpu_sibling_mask(cpu))
if (i != cpu && !coretemp_device_add(i))
break;
return;
}
mutex_unlock(&pdev_list_mutex);
}
Expand Down

0 comments on commit e40cc4b

Please sign in to comment.