aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal
diff options
context:
space:
mode:
authorAmit Daniel Kachhap <amit.daniel@samsung.com>2013-06-25 07:41:42 -0400
committerEduardo Valentin <eduardo.valentin@ti.com>2013-08-13 09:52:02 -0400
commitc55930e33eba7003fea9890cf755b28e201dd037 (patch)
tree62bdee47c1650c9ccf27f7bc9d73e807dd2109cf /drivers/thermal
parentf4dae7532c33380aa23ddcf83d0260bfdee48549 (diff)
thermal: exynos: use device resource management infrastructure
This patch uses the device pointer stored in the configuration structure and converts to dev_* prints and devm API's. Acked-by: Kukjin Kim <kgene.kim@samsung.com> Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Acked-by: Eduardo Valentin <eduardo.valentin@ti.com> Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com> Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/samsung/exynos_thermal_common.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c
index af0ae77eb019..4d8e4445ea10 100644
--- a/drivers/thermal/samsung/exynos_thermal_common.c
+++ b/drivers/thermal/samsung/exynos_thermal_common.c
@@ -53,7 +53,8 @@ static int exynos_set_mode(struct thermal_zone_device *thermal,
53{ 53{
54 struct exynos_thermal_zone *th_zone = thermal->devdata; 54 struct exynos_thermal_zone *th_zone = thermal->devdata;
55 if (!th_zone) { 55 if (!th_zone) {
56 pr_notice("thermal zone not registered\n"); 56 dev_err(th_zone->sensor_conf->dev,
57 "thermal zone not registered\n");
57 return 0; 58 return 0;
58 } 59 }
59 60
@@ -69,8 +70,9 @@ static int exynos_set_mode(struct thermal_zone_device *thermal,
69 70
70 th_zone->mode = mode; 71 th_zone->mode = mode;
71 thermal_zone_device_update(thermal); 72 thermal_zone_device_update(thermal);
72 pr_info("thermal polling set for duration=%d msec\n", 73 dev_dbg(th_zone->sensor_conf->dev,
73 thermal->polling_delay); 74 "thermal polling set for duration=%d msec\n",
75 thermal->polling_delay);
74 return 0; 76 return 0;
75} 77}
76 78
@@ -162,7 +164,8 @@ static int exynos_bind(struct thermal_zone_device *thermal,
162 case WARN_ZONE: 164 case WARN_ZONE:
163 if (thermal_zone_bind_cooling_device(thermal, i, cdev, 165 if (thermal_zone_bind_cooling_device(thermal, i, cdev,
164 level, 0)) { 166 level, 0)) {
165 pr_err("error binding cdev inst %d\n", i); 167 dev_err(data->dev,
168 "error unbinding cdev inst=%d\n", i);
166 ret = -EINVAL; 169 ret = -EINVAL;
167 } 170 }
168 th_zone->bind = true; 171 th_zone->bind = true;
@@ -207,7 +210,8 @@ static int exynos_unbind(struct thermal_zone_device *thermal,
207 case WARN_ZONE: 210 case WARN_ZONE:
208 if (thermal_zone_unbind_cooling_device(thermal, i, 211 if (thermal_zone_unbind_cooling_device(thermal, i,
209 cdev)) { 212 cdev)) {
210 pr_err("error unbinding cdev inst=%d\n", i); 213 dev_err(data->dev,
214 "error unbinding cdev inst=%d\n", i);
211 ret = -EINVAL; 215 ret = -EINVAL;
212 } 216 }
213 th_zone->bind = false; 217 th_zone->bind = false;
@@ -227,7 +231,8 @@ static int exynos_get_temp(struct thermal_zone_device *thermal,
227 void *data; 231 void *data;
228 232
229 if (!th_zone->sensor_conf) { 233 if (!th_zone->sensor_conf) {
230 pr_info("Temperature sensor not initialised\n"); 234 dev_err(th_zone->sensor_conf->dev,
235 "Temperature sensor not initialised\n");
231 return -EINVAL; 236 return -EINVAL;
232 } 237 }
233 data = th_zone->sensor_conf->driver_data; 238 data = th_zone->sensor_conf->driver_data;
@@ -246,7 +251,8 @@ static int exynos_set_emul_temp(struct thermal_zone_device *thermal,
246 struct exynos_thermal_zone *th_zone = thermal->devdata; 251 struct exynos_thermal_zone *th_zone = thermal->devdata;
247 252
248 if (!th_zone->sensor_conf) { 253 if (!th_zone->sensor_conf) {
249 pr_info("Temperature sensor not initialised\n"); 254 dev_err(th_zone->sensor_conf->dev,
255 "Temperature sensor not initialised\n");
250 return -EINVAL; 256 return -EINVAL;
251 } 257 }
252 data = th_zone->sensor_conf->driver_data; 258 data = th_zone->sensor_conf->driver_data;
@@ -351,7 +357,8 @@ int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf)
351 return -EINVAL; 357 return -EINVAL;
352 } 358 }
353 359
354 th_zone = kzalloc(sizeof(struct exynos_thermal_zone), GFP_KERNEL); 360 th_zone = devm_kzalloc(sensor_conf->dev,
361 sizeof(struct exynos_thermal_zone), GFP_KERNEL);
355 if (!th_zone) 362 if (!th_zone)
356 return -ENOMEM; 363 return -ENOMEM;
357 364
@@ -366,7 +373,8 @@ int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf)
366 th_zone->cool_dev[th_zone->cool_dev_size] = 373 th_zone->cool_dev[th_zone->cool_dev_size] =
367 cpufreq_cooling_register(&mask_val); 374 cpufreq_cooling_register(&mask_val);
368 if (IS_ERR(th_zone->cool_dev[th_zone->cool_dev_size])) { 375 if (IS_ERR(th_zone->cool_dev[th_zone->cool_dev_size])) {
369 pr_err("Failed to register cpufreq cooling device\n"); 376 dev_err(sensor_conf->dev,
377 "Failed to register cpufreq cooling device\n");
370 ret = -EINVAL; 378 ret = -EINVAL;
371 goto err_unregister; 379 goto err_unregister;
372 } 380 }
@@ -380,14 +388,16 @@ int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf)
380 IDLE_INTERVAL); 388 IDLE_INTERVAL);
381 389
382 if (IS_ERR(th_zone->therm_dev)) { 390 if (IS_ERR(th_zone->therm_dev)) {
383 pr_err("Failed to register thermal zone device\n"); 391 dev_err(sensor_conf->dev,
392 "Failed to register thermal zone device\n");
384 ret = PTR_ERR(th_zone->therm_dev); 393 ret = PTR_ERR(th_zone->therm_dev);
385 goto err_unregister; 394 goto err_unregister;
386 } 395 }
387 th_zone->mode = THERMAL_DEVICE_ENABLED; 396 th_zone->mode = THERMAL_DEVICE_ENABLED;
388 sensor_conf->pzone_data = th_zone; 397 sensor_conf->pzone_data = th_zone;
389 398
390 pr_info("Exynos: Kernel Thermal management registered\n"); 399 dev_info(sensor_conf->dev,
400 "Exynos: Thermal zone(%s) registered\n", sensor_conf->name);
391 401
392 return 0; 402 return 0;
393 403
@@ -417,6 +427,6 @@ void exynos_unregister_thermal(struct thermal_sensor_conf *sensor_conf)
417 cpufreq_cooling_unregister(th_zone->cool_dev[i]); 427 cpufreq_cooling_unregister(th_zone->cool_dev[i]);
418 } 428 }
419 429
420 kfree(th_zone); 430 dev_info(sensor_conf->dev,
421 pr_info("Exynos: Kernel Thermal management unregistered\n"); 431 "Exynos: Kernel Thermal management unregistered\n");
422} 432}