thermal: nct72: Sync thermal zones in late init
Alex Frid [Tue, 20 Jan 2015 01:34:34 +0000 (17:34 -0800)]
Updated NCT72 thermal zones in late_initcall_sync to make sure that all
cooling devices registered by that time are in sync with the respective
zone.

Bug 1600027

Change-Id: Ib7cb9875ff89d6cc8cc9c4077a6c90b963153030
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/673847
Reviewed-by: Bo Yan <byan@nvidia.com>

drivers/misc/nct1008.c

index cadc4af..35e45fd 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Driver for NCT1008, temperature monitoring device from ON Semiconductors
  *
- * Copyright (c) 2010-2014, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2010-2015, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -2004,6 +2004,21 @@ static struct i2c_driver nct1008_driver = {
        .shutdown       = nct1008_shutdown,
 };
 
+static int __init nct1008_sync_thz(struct device *dev, void *unused)
+{
+       struct nct1008_data *data = dev_get_drvdata(dev);
+       thermal_zone_device_update(data->sensors[LOC].thz);
+       thermal_zone_device_update(data->sensors[EXT].thz);
+       return 0;
+}
+
+static int __init nct1008_sync(void)
+{
+       return driver_for_each_device(
+               &nct1008_driver.driver, NULL, NULL, nct1008_sync_thz);
+}
+late_initcall_sync(nct1008_sync);
+
 static int __init nct1008_init(void)
 {
        return i2c_add_driver(&nct1008_driver);