From patchwork Tue Jun 11 12:53:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 2703631 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 9161E40079 for ; Tue, 11 Jun 2013 12:59:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755557Ab3FKM6q (ORCPT ); Tue, 11 Jun 2013 08:58:46 -0400 Received: from mail-pd0-f177.google.com ([209.85.192.177]:39460 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755508Ab3FKMz2 (ORCPT ); Tue, 11 Jun 2013 08:55:28 -0400 Received: by mail-pd0-f177.google.com with SMTP id p10so3084862pdj.22 for ; Tue, 11 Jun 2013 05:55:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=vMhq1PK8ZYcEBiwIEhTzjN6gLIjctQJfKVxgZ7ilZxc=; b=Au+Eiz8RzmVgwgyBn/e7C3q6q2u+PJ64EM1TW80s/YdLr9ai7AFHju/OkKlf0eV8gc qLKS99K3dwMRT3zgrVmxfABKvp64kM0GeKO45Q3UVpPmFDPYTr+sA6f34rDVbZY1H1s1 TjWh1/ANVj8imxvpsDn6xqI+04wdXkewOsmZ2m9nWM8hd9JfRfhUOz10c22lUd7wC+Ir RCpovNT90A8kn9sqwjgGll4QQ1Ef3Y2SDw21OeOHQV0RiX8d9byw/ydOD1Zcj/Aw4lmk VWVOpz2aDDmACzdksnUkWaHL+yxTxaoXrzDm+saPNiW40ZSLDtSQsv2MHSJBgQ6H5Ged xdqw== X-Received: by 10.68.75.49 with SMTP id z17mr10658053pbv.169.1370955327882; Tue, 11 Jun 2013 05:55:27 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id wi6sm14599807pbc.22.2013.06.11.05.55.23 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 11 Jun 2013 05:55:26 -0700 (PDT) From: Amit Daniel Kachhap To: linux-pm@vger.kernel.org, Zhang Rui , Eduardo Valentin Cc: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, Kukjin Kim , jonghwa3.lee@samsung.com Subject: [PATCH V5 20/30] thermal: exynos: use device resource management infrastructure Date: Tue, 11 Jun 2013 18:23:30 +0530 Message-Id: <1370955220-2949-21-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1370955220-2949-1-git-send-email-amit.daniel@samsung.com> References: <1370955220-2949-1-git-send-email-amit.daniel@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org This patch uses the device pointer stored in the configuration structure and converts to dev_* prints and devm API's. Acked-by: Kukjin Kim Signed-off-by: Amit Daniel Kachhap --- drivers/thermal/samsung/exynos_thermal_common.c | 39 ++++++++++++++-------- 1 files changed, 25 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/samsung/exynos_thermal_common.c b/drivers/thermal/samsung/exynos_thermal_common.c index 2873ca3..59b47e3 100644 --- a/drivers/thermal/samsung/exynos_thermal_common.c +++ b/drivers/thermal/samsung/exynos_thermal_common.c @@ -52,7 +52,8 @@ static int exynos_set_mode(struct thermal_zone_device *thermal, { struct exynos_thermal_zone *th_zone = thermal->devdata; if (!th_zone) { - pr_notice("thermal zone not registered\n"); + dev_err(th_zone->sensor_conf->dev, + "thermal zone not registered\n"); return 0; } @@ -68,8 +69,9 @@ static int exynos_set_mode(struct thermal_zone_device *thermal, th_zone->mode = mode; thermal_zone_device_update(thermal); - pr_info("thermal polling set for duration=%d msec\n", - thermal->polling_delay); + dev_dbg(th_zone->sensor_conf->dev, + "thermal polling set for duration=%d msec\n", + thermal->polling_delay); return 0; } @@ -159,7 +161,8 @@ static int exynos_bind(struct thermal_zone_device *thermal, case WARN_ZONE: if (thermal_zone_bind_cooling_device(thermal, i, cdev, level, 0)) { - pr_err("error binding cdev inst %d\n", i); + dev_err(data->dev, + "error unbinding cdev inst=%d\n", i); ret = -EINVAL; } th_zone->bind = true; @@ -204,7 +207,8 @@ static int exynos_unbind(struct thermal_zone_device *thermal, case WARN_ZONE: if (thermal_zone_unbind_cooling_device(thermal, i, cdev)) { - pr_err("error unbinding cdev inst=%d\n", i); + dev_err(data->dev, + "error unbinding cdev inst=%d\n", i); ret = -EINVAL; } th_zone->bind = false; @@ -224,7 +228,8 @@ static int exynos_get_temp(struct thermal_zone_device *thermal, void *data; if (!th_zone->sensor_conf) { - pr_info("Temperature sensor not initialised\n"); + dev_err(th_zone->sensor_conf->dev, + "Temperature sensor not initialised\n"); return -EINVAL; } data = th_zone->sensor_conf->driver_data; @@ -243,7 +248,8 @@ static int exynos_set_emul_temp(struct thermal_zone_device *thermal, struct exynos_thermal_zone *th_zone = thermal->devdata; if (!th_zone->sensor_conf) { - pr_info("Temperature sensor not initialised\n"); + dev_err(th_zone->sensor_conf->dev, + "Temperature sensor not initialised\n"); return -EINVAL; } data = th_zone->sensor_conf->driver_data; @@ -337,11 +343,13 @@ int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) struct exynos_thermal_zone *th_zone; if (!sensor_conf || !sensor_conf->read_temperature) { - pr_err("Temperature sensor not initialised\n"); + dev_err(sensor_conf->dev, + "Temperature sensor not initialised\n"); return -EINVAL; } - th_zone = kzalloc(sizeof(struct exynos_thermal_zone), GFP_KERNEL); + th_zone = devm_kzalloc(sensor_conf->dev, + sizeof(struct exynos_thermal_zone), GFP_KERNEL); if (!th_zone) return -ENOMEM; @@ -350,7 +358,8 @@ int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) cpumask_set_cpu(0, &mask_val); th_zone->cool_dev[0] = cpufreq_cooling_register(&mask_val); if (IS_ERR(th_zone->cool_dev[0])) { - pr_err("Failed to register cpufreq cooling device\n"); + dev_err(sensor_conf->dev, + "Failed to register cpufreq cooling device\n"); ret = -EINVAL; goto err_unregister; } @@ -364,14 +373,16 @@ int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) IDLE_INTERVAL); if (IS_ERR(th_zone->therm_dev)) { - pr_err("Failed to register thermal zone device\n"); + dev_err(sensor_conf->dev, + "Failed to register thermal zone device\n"); ret = PTR_ERR(th_zone->therm_dev); goto err_unregister; } th_zone->mode = THERMAL_DEVICE_ENABLED; sensor_conf->pzone_data = th_zone; - pr_info("Exynos: Kernel Thermal management registered\n"); + dev_info(sensor_conf->dev, + "Exynos: Thermal zone(%s) registered\n", sensor_conf->name); return 0; @@ -397,6 +408,6 @@ void exynos_unregister_thermal(struct thermal_sensor_conf *sensor_conf) cpufreq_cooling_unregister(th_zone->cool_dev[i]); } - kfree(th_zone); - pr_info("Exynos: Kernel Thermal management unregistered\n"); + dev_info(sensor_conf->dev, + "Exynos: Kernel Thermal management unregistered\n"); }