public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: "Zhang, Rui" <rui.zhang@intel.com>
Cc: Len Brown <lenb@kernel.org>, Hans de Goede <j.w.r.degoede@hhs.nl>,
	linux-acpi <linux-acpi@vger.kernel.org>
Subject: Re: [PATCH 2/6] thermal: add  new get_crit_temp callback
Date: Wed, 16 Apr 2008 22:40:51 +0200	[thread overview]
Message-ID: <20080416224051.49a156fb@hyperion.delvare> (raw)
In-Reply-To: <1207815190.27304.34.camel@acpi-hp-zz.sh.intel.com>

Hi Rui,

On Thu, 10 Apr 2008 16:13:10 +0800, Zhang, Rui wrote:
> 
> Add a new callback so that the generic thermal can get
> the critical trip point info of a thermal zone,
> which is needed for building the tempX_crit hwmon sysfs attribute.
> 
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> ---
>  drivers/acpi/thermal.c  |   13 +++++++++++++
>  include/linux/thermal.h |    1 +
>  2 files changed, 14 insertions(+)
> 
> Index: linux-2.6/drivers/acpi/thermal.c
> ===================================================================
> --- linux-2.6.orig/drivers/acpi/thermal.c
> +++ linux-2.6/drivers/acpi/thermal.c
> @@ -1012,6 +1012,18 @@ static int thermal_get_trip_temp(struct 
>  	return -EINVAL;
>  }
>  
> +static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
> +				unsigned long *temperature) {
> +	struct acpi_thermal *tz = thermal->devdata;
> +
> +	if (tz->trips.critical.flags.valid) {
> +		*temperature = KELVIN_TO_MILLICELSIUS(
> +				tz->trips.critical.temperature);
> +		return 0;
> +	} else
> +		return -EINVAL;
> +}
> +
>  typedef int (*cb)(struct thermal_zone_device *, int,
>  		  struct thermal_cooling_device *);
>  static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
> @@ -1103,6 +1115,7 @@ static struct thermal_zone_device_ops ac
>  	.set_mode = thermal_set_mode,
>  	.get_trip_type = thermal_get_trip_type,
>  	.get_trip_temp = thermal_get_trip_temp,
> +	.get_crit_temp = thermal_get_crit_temp,
>  };
>  
>  static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
> Index: linux-2.6/include/linux/thermal.h
> ===================================================================
> --- linux-2.6.orig/include/linux/thermal.h
> +++ linux-2.6/include/linux/thermal.h
> @@ -41,6 +41,7 @@ struct thermal_zone_device_ops {
>  	int (*set_mode) (struct thermal_zone_device *, const char *);
>  	int (*get_trip_type) (struct thermal_zone_device *, int, char *);
>  	int (*get_trip_temp) (struct thermal_zone_device *, int, char *);
> +	int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
>  };
>  
>  struct thermal_cooling_device_ops {
> 
> 

I like this a lot, it's much cleaner and more efficient than using
get_trip_temp + get_trip_type as the previous patchset was doing. Well
done!

Acked-by: Jean Delvare <khali@linux-fr.org>

-- 
Jean Delvare

  reply	other threads:[~2008-04-16 20:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-10  8:13 [PATCH 2/6] thermal: add new get_crit_temp callback Zhang, Rui
2008-04-16 20:40 ` Jean Delvare [this message]
2008-04-29  7:16   ` Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080416224051.49a156fb@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=j.w.r.degoede@hhs.nl \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox