From 0dca94baeab4a1a514841b0a4c8e3a51dfb4d5ae Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Mon, 9 Aug 2010 17:21:09 -0700 Subject: hwmon: coretemp: update hotplug condition check Fix two errors in hotplug. One is for hotplug notifier. The other is unnecessary driver unregister. Because even none of online cpus supports coretemp, we can't assume new onlined cpu doesn't support it either. If related driver is unregistered there we have no chance to use coretemp from then on. Signed-off-by: Chen Gong Cc: Rudolf Marek Cc: Huaxu Wan Cc: Jean Delvare Cc: Guenter Roeck Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/hwmon/coretemp.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/hwmon/coretemp.c') diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 05344af5073..c05dc91ff41 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -502,10 +502,13 @@ static int __cpuinit coretemp_cpu_callback(struct notifier_block *nfb, switch (action) { case CPU_ONLINE: + case CPU_ONLINE_FROZEN: case CPU_DOWN_FAILED: + case CPU_DOWN_FAILED_FROZEN: coretemp_device_add(cpu); break; case CPU_DOWN_PREPARE: + case CPU_DOWN_PREPARE_FROZEN: coretemp_device_remove(cpu); break; } @@ -566,7 +569,9 @@ exit_devices_unreg: } mutex_unlock(&pdev_list_mutex); exit_driver_unreg: +#ifndef CONFIG_HOTPLUG_CPU platform_driver_unregister(&coretemp_driver); +#endif exit: return err; } -- cgit v1.2.3-70-g09d2 From 851b29cb3b196cb66452ec964ab5f66c9c9cd1ed Mon Sep 17 00:00:00 2001 From: Chen Gong Date: Mon, 9 Aug 2010 17:21:10 -0700 Subject: hwmon: coretemp: enable coretemp device add operation failure If one coretemp device can't be added, it should allow subsequent adding operation because every new-added device will create a new sysfs group, not an additional sensor sys entry. Signed-off-by: Chen Gong Cc: Rudolf Marek Cc: Huaxu Wan Cc: Jean Delvare Cc: Guenter Roeck Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/hwmon/coretemp.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'drivers/hwmon/coretemp.c') diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index c05dc91ff41..49d74d091fb 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -540,12 +540,9 @@ static int __init coretemp_init(void) * sensors. We check this bit only, all the early CPUs * without thermal sensors will be filtered out. */ - if (c->cpuid_level >= 6 && (cpuid_eax(0x06) & 0x01)) { - err = coretemp_device_add(i); - if (err) - goto exit_devices_unreg; - - } else { + if (c->cpuid_level >= 6 && (cpuid_eax(0x06) & 0x01)) + coretemp_device_add(i); + else { printk(KERN_INFO DRVNAME ": CPU (model=0x%x)" " has no thermal sensor.\n", c->x86_model); } @@ -560,14 +557,6 @@ static int __init coretemp_init(void) #endif return 0; -exit_devices_unreg: - mutex_lock(&pdev_list_mutex); - list_for_each_entry_safe(p, n, &pdev_list, list) { - platform_device_unregister(p->pdev); - list_del(&p->list); - kfree(p); - } - mutex_unlock(&pdev_list_mutex); exit_driver_unreg: #ifndef CONFIG_HOTPLUG_CPU platform_driver_unregister(&coretemp_driver); -- cgit v1.2.3-70-g09d2 From 6b8e8282611ea35845dcff0cb321a7d735fc3155 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Mon, 9 Aug 2010 17:21:11 -0700 Subject: drivers/hwmon/coretemp.c: remove unneeded #ifdef CONFIG_HOTPLUG_CPU register_hotcpu_notifier() is designed to make these ifdefs unnecessary. Cc: Chen Gong Cc: Rudolf Marek Cc: Huaxu Wan Cc: Jean Delvare Cc: Guenter Roeck Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/hwmon/coretemp.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/hwmon/coretemp.c') diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 49d74d091fb..a92e28a3576 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -480,7 +480,6 @@ exit: return err; } -#ifdef CONFIG_HOTPLUG_CPU static void coretemp_device_remove(unsigned int cpu) { struct pdev_entry *p, *n; @@ -518,7 +517,6 @@ static int __cpuinit coretemp_cpu_callback(struct notifier_block *nfb, static struct notifier_block coretemp_cpu_notifier __refdata = { .notifier_call = coretemp_cpu_callback, }; -#endif /* !CONFIG_HOTPLUG_CPU */ static int __init coretemp_init(void) { @@ -552,9 +550,7 @@ static int __init coretemp_init(void) goto exit_driver_unreg; } -#ifdef CONFIG_HOTPLUG_CPU register_hotcpu_notifier(&coretemp_cpu_notifier); -#endif return 0; exit_driver_unreg: -- cgit v1.2.3-70-g09d2