diff mbox

[PATCHv2,05/14] Thermal: Obtain platform data for thermal zone

Message ID 1346041706-29642-6-git-send-email-durgadoss.r@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

durgadoss.r@intel.com Aug. 27, 2012, 4:28 a.m. UTC
This patch retrieves the platform level data for
a zone during its registration. It is not an error
to not have any platform data.

Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
---
 drivers/thermal/thermal_sys.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Zhang Rui Aug. 27, 2012, 8:29 a.m. UTC | #1
> -----Original Message-----
> From: R, Durgadoss
> Sent: Monday, August 27, 2012 7:28 AM
> To: lenb@kernel.org; Zhang, Rui
> Cc: linux-acpi@vger.kernel.org; eduardo.valentin@ti.com; R, Durgadoss
> Subject: [PATCHv2 05/14] Thermal: Obtain platform data for thermal zone
> Importance: High
> 
> This patch retrieves the platform level data for a zone during its
> registration. It is not an error to not have any platform data.
> 
> Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
> ---
>  drivers/thermal/thermal_sys.c |   21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/thermal/thermal_sys.c
> b/drivers/thermal/thermal_sys.c index 92a187c..6adda39 100644
> --- a/drivers/thermal/thermal_sys.c
> +++ b/drivers/thermal/thermal_sys.c
> @@ -1339,6 +1339,22 @@ static void remove_trip_attrs(struct
> thermal_zone_device *tz)
>  	kfree(tz->trip_hyst_attrs);
>  }
> 
> +static int retrieve_zone_params(struct thermal_zone_device *tz) {
> +	int ret;
> +
> +	/* Check whether the platform data pointer is defined */
> +	if (!get_platform_thermal_params)
> +		return 0;
> +
> +	/* It is not an error to not have any platform data */
> +	ret = get_platform_thermal_params(tz);
> +	if (ret)
> +		tz->tzp = NULL;
> +
> +	return 0;
> +}
> +
>  /**
>   * thermal_zone_device_register - register a new thermal zone device
>   * @type:	the thermal zone device type
> @@ -1443,6 +1459,11 @@ struct thermal_zone_device
> *thermal_zone_device_register(const char *type,
>  	if (result)
>  		goto unregister;
> 
> +	/* Retrieve platform level parameters for this zone */
> +	result = retrieve_zone_params(tz);
> +	if (result)
> +		goto unregister;
> +

As I said, if we need it, we should ask user to provide it during registration. What do you think?

Thanks,
rui

>  	mutex_lock(&thermal_list_lock);
>  	list_add_tail(&tz->node, &thermal_tz_list);
>  	if (ops->bind)
> --
> 1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
durgadoss.r@intel.com Aug. 27, 2012, 8:59 a.m. UTC | #2
Hi Rui,

> >  /**
> >   * thermal_zone_device_register - register a new thermal zone device
> >   * @type:	the thermal zone device type
> > @@ -1443,6 +1459,11 @@ struct thermal_zone_device
> > *thermal_zone_device_register(const char *type,
> >  	if (result)
> >  		goto unregister;
> >
> > +	/* Retrieve platform level parameters for this zone */
> > +	result = retrieve_zone_params(tz);
> > +	if (result)
> > +		goto unregister;
> > +
> 
> As I said, if we need it, we should ask user to provide it during registration.
> What do you think?

That's Fine, we can provide it through tzd_register function call.

Thanks,
Durga
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
index 92a187c..6adda39 100644
--- a/drivers/thermal/thermal_sys.c
+++ b/drivers/thermal/thermal_sys.c
@@ -1339,6 +1339,22 @@  static void remove_trip_attrs(struct thermal_zone_device *tz)
 	kfree(tz->trip_hyst_attrs);
 }
 
+static int retrieve_zone_params(struct thermal_zone_device *tz)
+{
+	int ret;
+
+	/* Check whether the platform data pointer is defined */
+	if (!get_platform_thermal_params)
+		return 0;
+
+	/* It is not an error to not have any platform data */
+	ret = get_platform_thermal_params(tz);
+	if (ret)
+		tz->tzp = NULL;
+
+	return 0;
+}
+
 /**
  * thermal_zone_device_register - register a new thermal zone device
  * @type:	the thermal zone device type
@@ -1443,6 +1459,11 @@  struct thermal_zone_device *thermal_zone_device_register(const char *type,
 	if (result)
 		goto unregister;
 
+	/* Retrieve platform level parameters for this zone */
+	result = retrieve_zone_params(tz);
+	if (result)
+		goto unregister;
+
 	mutex_lock(&thermal_list_lock);
 	list_add_tail(&tz->node, &thermal_tz_list);
 	if (ops->bind)