From patchwork Tue Jun 25 11:41:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 2776131 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 071779F245 for ; Tue, 25 Jun 2013 11:42:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8228D20166 for ; Tue, 25 Jun 2013 11:42:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 20FA22010B for ; Tue, 25 Jun 2013 11:42:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750830Ab3FYLmB (ORCPT ); Tue, 25 Jun 2013 07:42:01 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:38198 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750794Ab3FYLmA (ORCPT ); Tue, 25 Jun 2013 07:42:00 -0400 Received: by mail-pd0-f169.google.com with SMTP id y10so907834pdj.14 for ; Tue, 25 Jun 2013 04:42:00 -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=/SNPHw8Rv0XXxMP0NZnP7f/FRrE4KZ/VUNtL9gKvyAU=; b=iU0icpPuOc1gM9Zdd/9/AaOCV6PTabZ4LSZ4HmuCtR2PPFtvsbZbg9EUqSvGW5lGMQ R7EpiFVOyDt1suntFFSEgVLEhDJZ06S2PbMfhRYifKshEsXAMgnQ7JQ9SCUPRV6jXcP5 MuOMi4XEuxMzvhLRw55R5IGpKjqmNGWQi1KxJX+LDpoVA21fL92qX6/pT8uEhyB2YzGW ENS7avFnibY3/06S6Zt4G48Vvh8P/SOdUkiZo+vjnf0p5GomG8VRqcRRK1xmBpsfeD02 kC9CGyoSl6+zWon/hThOdYkqo8kPKv2ADS8R2SEDI7G2fK8UFFLXa2Yns/W6n8wsbqht d6xw== X-Received: by 10.66.119.196 with SMTP id kw4mr31199246pab.164.1372160520156; Tue, 25 Jun 2013 04:42:00 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id wi6sm22828523pbc.22.2013.06.25.04.41.54 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 25 Jun 2013 04:41:58 -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 Subject: [PATCH RESEND V7 20/30] thermal: exynos: use device resource management infrastructure Date: Tue, 25 Jun 2013 17:11:42 +0530 Message-Id: <1372160502-14555-1-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1372071051-3167-21-git-send-email-amit.daniel@samsung.com> References: <1372071051-3167-21-git-send-email-amit.daniel@samsung.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch uses the device pointer stored in the configuration structure and converts to dev_* prints and devm API's. Acked-by: Kukjin Kim Acked-by: Jonghwa Lee Acked-by: Eduardo Valentin Signed-off-by: Amit Daniel Kachhap --- drivers/thermal/samsung/exynos_thermal_common.c | 36 ++++++++++++++-------- 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 ecf95da..211262a 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, { 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; } @@ -69,8 +70,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; } @@ -162,7 +164,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; @@ -207,7 +210,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; @@ -227,7 +231,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; @@ -246,7 +251,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; @@ -351,7 +357,8 @@ int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) 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; @@ -366,7 +373,8 @@ int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf) th_zone->cool_dev[th_zone->cool_dev_size] = cpufreq_cooling_register(&mask_val); if (IS_ERR(th_zone->cool_dev[th_zone->cool_dev_size])) { - 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; } @@ -380,14 +388,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; @@ -417,6 +427,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"); }