Re: [PATCH 1/3] hwmon: (coretemp) update hotplug condition check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



于 7/19/2010 12:13 PM, Guenter Roeck 写道:
On Sun, Jul 18, 2010 at 10:50:32PM -0400, Chen Gong wrote:
this patch fixes two errors about 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.

Thinking about this ... I understand the logic, and I think it makes sense.
However, this only applies if CONFIG_HOTPLUG_CPU is defined.
Otherwise, the driver should still be unloaded if there are no sensors.

Guenter

Sounds good. If so, I can retain the logic when list_empty is true, and
adding a "#ifdef CONFIG_HOTPLUG_CPU" to compass platform_driver_unregister.


Signed-off-by: Chen Gong<gong.chen@xxxxxxxxxxxxxxx>
---
  drivers/hwmon/coretemp.c |    9 +++------
  1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 05344af..9232c4e 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;
  	}
@@ -547,10 +550,6 @@ static int __init coretemp_init(void)
  				" has no thermal sensor.\n", c->x86_model);
  		}
  	}
-	if (list_empty(&pdev_list)) {
-		err = -ENODEV;
-		goto exit_driver_unreg;
-	}

  #ifdef CONFIG_HOTPLUG_CPU
  	register_hotcpu_notifier(&coretemp_cpu_notifier);
@@ -565,8 +564,6 @@ exit_devices_unreg:
  		kfree(p);
  	}
  	mutex_unlock(&pdev_list_mutex);
-exit_driver_unreg:
-	platform_driver_unregister(&coretemp_driver);
  exit:
  	return err;
  }
--
1.7.2.rc3



_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux