Re: [PATCH] ACPI/Thermal: Add check of "_TZD" availability and evaluating result

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

 



On Saturday, August 24, 2013 05:01:28 PM tianyu.lan@xxxxxxxxx wrote:
> From: Lan Tianyu <tianyu.lan@xxxxxxxxx>
> 
> Some machines don't provide _TZD. So add check of "_TZD" availability
> before doing futher operations. This patch also adds the check of
> evaluating result.
> 
> Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx>
> ---
>  drivers/acpi/thermal.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
> index 09f9340..6809fbd 100644
> --- a/drivers/acpi/thermal.c
> +++ b/drivers/acpi/thermal.c
> @@ -492,11 +492,12 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
>  			break;
>  	}
>  
> -	if (flag & ACPI_TRIPS_DEVICES) {
> +	if ((flag & ACPI_TRIPS_DEVICES)
> +			&& acpi_has_method(tz->device->handle, "_TZD")) {

Please arrange the whitespace here like this:

	if ((flag & ACPI_TRIPS_DEVICES)
	    && acpi_has_method(tz->device->handle, "_TZD")) {


>  		memset(&devices, 0, sizeof(struct acpi_handle_list));
>  		status = acpi_evaluate_reference(tz->device->handle, "_TZD",
>  						NULL, &devices);
> -		if (memcmp(&tz->devices, &devices,
> +		if (ACPI_SUCCESS(status) && memcmp(&tz->devices, &devices,
>  				sizeof(struct acpi_handle_list))) {

I wonder why you can't use "tz->device == devices" here instead of the memcmp?

And also "tz->devices = devices" below for that matter.

>  			memcpy(&tz->devices, &devices,
>  				sizeof(struct acpi_handle_list));

Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
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