RE: [PATCH 02/16] Thermal: Add Hysteresis attributes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rui,

> -----Original Message-----
> From: Zhang, Rui
> Sent: Thursday, July 19, 2012 12:01 PM
> To: linux-acpi@xxxxxxxxxxxxxxx; linux-pm@xxxxxxxxxxxxxxx
> 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@xxxxxxxxx>
> 
> 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@xxxxxxxxx>
> Signed-off-by: Zhang Rui <rui.zhang@xxxxxxxxx>
> ---
>  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);
>  }
> 

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


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux