Re: [PATCH V6 20/30] thermal: exynos: use device resource managementinfrastructure
From: Eduardo Valentin
Date: Wed Jun 19 2013 - 19:42:41 EST
On 17-06-2013 02:46, Amit Daniel Kachhap wrote:
> 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@xxxxxxxxxxx>
> Acked-by: Jonghwa Lee <jonghwa3.lee@xxxxxxxxxxx>
> Signed-off-by: Amit Daniel Kachhap <amit.daniel@xxxxxxxxxxx>
Acked-by: Eduardo Valentin <eduardo.valentin@xxxxxx>
> ---
> 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");
> }
>
--
You have got to be excited about what you are doing. (L. Lamport)
Eduardo Valentin
Attachment:
signature.asc
Description: OpenPGP digital signature