linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: "R, Durgadoss" <durgadoss.r@intel.com>
Cc: "Zhang, Rui" <rui.zhang@intel.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Matthew Garrett <mjg@redhat.com>, Len Brown <lenb@kernel.org>,
	Eduardo Valentin <eduardo.valentin@intel.com>,
	Amit Kachhap <amit.kachhap@linaro.org>, Wei Ni <wni@nvidia.com>
Subject: Re: [PATCH 02/16] Thermal: Add Hysteresis attributes
Date: Thu, 19 Jul 2012 22:00:12 +0200	[thread overview]
Message-ID: <201207192200.12806.rjw@sisk.pl> (raw)
In-Reply-To: <4D68720C2E767A4AA6A8796D42C8EB59166724@BGSMSX101.gar.corp.intel.com>

On Thursday, July 19, 2012, R, Durgadoss wrote:
> Hi Rui,
> 
> > -----Original Message-----
> > From: Zhang, Rui
> > Sent: Thursday, July 19, 2012 12:01 PM
> > To: linux-acpi@vger.kernel.org; linux-pm@vger.kernel.org
> > Cc: Rafael J. Wysocki; Matthew Garrett; Len Brown; R, Durgadoss; Eduardo
> > Valentin; Amit Kachhap; Wei Ni; Zhang, Rui
> > Subject: [PATCH 02/16] Thermal: Add Hysteresis attributes
> > 
> > From: Durgadoss R <dugardoss.r@intel.com>
> > 
> > The Linux Thermal Framework does not support hysteresis
> > attributes. Most thermal sensors, today, have a
> > hysteresis value associated with trip points.
> > 
> > This patch adds hysteresis attributes on a per-trip-point
> > basis, to the Thermal Framework. These attributes are
> > optionally writable.
> > 
> > Signed-off-by: Durgadoss R <durgadoss.r@intel.com>
> > Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> > ---
> >  Documentation/thermal/sysfs-api.txt |    6 +++
> >  drivers/thermal/thermal_sys.c       |   89
> > ++++++++++++++++++++++++++++++++---
> >  include/linux/thermal.h             |    5 ++
> >  3 files changed, 94 insertions(+), 6 deletions(-)
> > 
> > diff --git a/Documentation/thermal/sysfs-api.txt
> > b/Documentation/thermal/sysfs-api.txt
> > index 0c7c423..3c8c2f8 100644
> > --- a/Documentation/thermal/sysfs-api.txt
> > +++ b/Documentation/thermal/sysfs-api.txt
> > @@ -121,6 +121,7 @@ if hwmon is compiled in or built as a module.
> >      |---mode:			Working mode of the thermal zone
> >      |---trip_point_[0-*]_temp:	Trip point temperature
> >      |---trip_point_[0-*]_type:	Trip point type
> > +    |---trip_point_[0-*]_hyst:	Hysteresis value for this trip point
> > 
> >  Thermal cooling device sys I/F, created once it's registered:
> >  /sys/class/thermal/cooling_device[0-*]:
> > @@ -190,6 +191,11 @@ trip_point_[0-*]_type
> >  	thermal zone.
> >  	RO, Optional
> > 
> [cut.]
> 
> > +		/* create Optional trip hyst attribute */
> > +		if (!tz->ops->get_trip_hyst)
> > +			continue;
> > +		snprintf(tz->trip_hyst_attrs[indx].name,
> > THERMAL_NAME_LENGTH,
> > +			 "trip_point_%d_hyst", indx);
> > +
> > +		sysfs_attr_init(&tz->trip_hyst_attrs[indx].attr.attr);
> > +		tz->trip_hyst_attrs[indx].attr.attr.name =
> > +					tz->trip_hyst_attrs[indx].name;
> > +		tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO;
> > +		tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show;
> > +		if (tz->ops->set_trip_hyst) {
> > +			tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR;
> > +			tz->trip_hyst_attrs[indx].attr.store =
> > +					trip_point_hyst_store;
> > +		}
> > +
> > +		device_create_file(&tz->device,
> > +				   &tz->trip_hyst_attrs[indx].attr);
> >  	}
> >  	return 0;
> >  }
> > @@ -1151,9 +1225,13 @@ static void remove_trip_attrs(struct
> > thermal_zone_device *tz)
> >  				   &tz->trip_type_attrs[indx].attr);
> >  		device_remove_file(&tz->device,
> >  				   &tz->trip_temp_attrs[indx].attr);
> > +		if (tz->ops->get_trip_hyst)
> > +			device_remove_file(&tz->device,
> > +				  &tz->trip_hyst_attrs[indx].attr);
> >  	}
> >  	kfree(tz->trip_type_attrs);
> >  	kfree(tz->trip_temp_attrs);
> 
> I believe we should have a check here for 'if (tz->ops->get_trip_hyst)' and then
> only free this, if required.
> 
> > +	kfree(tz->trip_hyst_attrs);
> >  }

No, we don't have to, kfree() checks for NULL pointers.

Thanks,
Rafael

  reply	other threads:[~2012-07-19 19:54 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-19  6:31 [PATCH 00/16] Thermal: generic thermal layer enhancement Zhang Rui
2012-07-19  6:31 ` [PATCH 01/16] Thermal: Make Thermal trip points writeable Zhang Rui
2012-07-19 10:35   ` R, Durgadoss
2012-07-19 19:38   ` Rafael J. Wysocki
2012-07-23  8:11     ` Zhang Rui
2012-07-19 20:27   ` Rafael J. Wysocki
2012-07-23  8:22     ` Zhang Rui
2012-07-23 10:25       ` Rafael J. Wysocki
2012-07-19  6:31 ` [PATCH 02/16] Thermal: Add Hysteresis attributes Zhang Rui
2012-07-19 10:40   ` R, Durgadoss
2012-07-19 20:00     ` Rafael J. Wysocki [this message]
2012-07-19  6:31 ` [PATCH 03/16] Thermal: Documentation update Zhang Rui
2012-07-19 10:51   ` R, Durgadoss
2012-07-23  8:36     ` Zhang Rui
2012-07-19  6:31 ` [PATCH 04/16] Thermal: Introduce multiple cooling states support Zhang Rui
2012-07-19  6:31 ` [PATCH 05/16] Thermal: Introduce cooling states range support Zhang Rui
2012-07-19  6:31 ` [PATCH 06/16] Thermal: set upper and lower limits Zhang Rui
2012-07-19 20:55   ` Rafael J. Wysocki
2012-07-23  8:45     ` Zhang Rui
2012-07-23 19:15       ` Rafael J. Wysocki
2012-07-19  6:31 ` [PATCH 07/16] Thermal: Introduce .get_trend() callback Zhang Rui
2012-07-19 21:13   ` Rafael J. Wysocki
2012-07-24  1:42     ` Zhang Rui
2012-07-24  9:22       ` Rafael J. Wysocki
2012-07-19 22:09   ` Jacob Pan
2012-07-20  9:53     ` Rafael J. Wysocki
2012-07-20 16:12       ` Jacob Pan
2012-07-19  6:31 ` [PATCH 08/16] Thermal: Remove tc1/tc2 in generic thermal layer Zhang Rui
2012-07-19  6:31 ` [PATCH 09/16] Thermal: Introduce thermal_zone_trip_update() Zhang Rui
2012-07-19 21:19   ` Rafael J. Wysocki
2012-07-24  1:47     ` Zhang Rui
2012-07-24  9:27       ` Rafael J. Wysocki
2012-07-25  1:38         ` Zhang Rui
2012-07-25 11:07           ` Rafael J. Wysocki
2012-07-26  0:49             ` Zhang Rui
     [not found]   ` <CAK44p21hNYGH4YkH5E+XK-pM2upingQbvm77WkJbttCRp6ZamQ@mail.gmail.com>
2012-07-24  7:11     ` Zhang Rui
2012-07-24  8:06       ` Amit Kachhap
2012-07-26  5:08         ` Zhang Rui
2012-07-26  6:01           ` R, Durgadoss
2012-07-24  7:57   ` Amit Kachhap
2012-07-19  6:31 ` [PATCH 10/16] Thermal: rename structure thermal_cooling_device_instance to thermal_instance Zhang Rui
2012-07-19  6:31 ` [PATCH 11/16] Thermal: Rename thermal_zone_device.cooling_devices to thermal_zone_device.instances Zhang Rui
2012-07-19 21:22   ` Rafael J. Wysocki
2012-07-24  1:48     ` Zhang Rui
2012-07-19  6:31 ` [PATCH 12/16] Thermal: Rename thermal_instance.node to thermal_instance.tz_node Zhang Rui
2012-07-19  6:31 ` [PATCH 13/16] Thermal: List thermal_instance in thermal_cooling_device Zhang Rui
2012-07-19 21:25   ` Rafael J. Wysocki
2012-07-24  1:48     ` Zhang Rui
2012-07-19  6:31 ` [PATCH 14/16] Thermal: Introduce simple arbitrator for setting device cooling state Zhang Rui
2012-07-19 21:39   ` Rafael J. Wysocki
2012-07-24  1:49     ` Zhang Rui
2012-07-19  6:31 ` [PATCH 15/16] Thermal: Unify the code for both active and passive cooling Zhang Rui
2012-07-19  6:31 ` [PATCH 16/16] Thermal: use plist instead of list Zhang Rui
2012-07-19 21:45   ` Rafael J. Wysocki
2012-07-24  2:13     ` Zhang Rui
2012-07-19  6:37 ` [PATCH 00/16] Thermal: generic thermal layer enhancement Zhang Rui

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=201207192200.12806.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=amit.kachhap@linaro.org \
    --cc=durgadoss.r@intel.com \
    --cc=eduardo.valentin@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=rui.zhang@intel.com \
    --cc=wni@nvidia.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;
as well as URLs for NNTP newsgroup(s).