ACPI/Thermal: Add check of "_TZD" availability and evaluating result
Subsystems (2)
PATCH v2 1/1 ACPI/Thermal: Add check of "_TZD" availability and evaluating result
From: Lan Tianyu <[email protected]>
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.
---
Change sicne v1:
Arrange the whitespace, using "tz->devices = devices"
instead of memcpy() and sizeof(devices) instead of sizeof(struct ...)
drivers/acpi/thermal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/acpi/thermal.c +6 -6
@@ -492,14 +492,14 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)break ; } -if (flag &ACPI_TRIPS_DEVICES ) { -memset (&devices,0 ,sizeof (struct acpi_handle_list )); +if ((flag &ACPI_TRIPS_DEVICES ) + &&acpi_has_method (tz->device->handle,"_TZD" )) { +memset (&devices,0 ,sizeof (devices)); status =acpi_evaluate_reference (tz->device->handle,"_TZD" ,NULL , &devices); -if (memcmp (&tz->devices, &devices, -sizeof (struct acpi_handle_list ))) { -memcpy (&tz->devices, &devices, -sizeof (struct acpi_handle_list )); +if (ACPI_SUCCESS (status) &&memcmp (&tz->devices, &devices, +sizeof (devices))) { + tz->devices = devices;ACPI_THERMAL_TRIPS_EXCEPTION (flag,"device" ); } }
Signature · 1 line
1.8.4.rc0.1.g8f6a3e5.dirty
Quoted 26 lines · On Monday, August 26, 2013 10:14:30 AM [email protected] wrote:
From: Lan Tianyu <[email protected]>
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 <[email protected]>---
Change sicne v1:Arrange the whitespace, using "tz->devices = devices"instead of
memcpy()and sizeof(devices) instead of sizeof(struct ...)drivers/acpi/thermal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/acpi/thermal.c +1
-2@@ -492,14 +492,14 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)break ; } -if (flag &ACPI_TRIPS_DEVICES ) { -memset (&devices,0 ,sizeof (struct acpi_handle_list )); + if ((flag & ACPI_TRIPS_DEVICES)
drivers/acpi/thermal.c static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) · line 501
Quoted 10 lines
drivers/acpi/thermal.c +4
-4+ && acpi_has_method(tz->device->handle, "_TZD")) { +memset (&devices,0 ,sizeof (devices)); status =acpi_evaluate_reference (tz->device->handle,"_TZD" ,NULL , &devices); -if (memcmp (&tz->devices, &devices, -sizeof (struct acpi_handle_list ))) { -memcpy (&tz->devices, &devices, -sizeof (struct acpi_handle_list )); +if (ACPI_SUCCESS (status) &&memcmp (&tz->devices, &devices, +sizeof (devices))) {
No line break here, please. Do this:
if (ACPI_SUCCESS(status)
&& memcmp(&tz->devices, &devices, sizeof(devices))) {drivers/acpi/thermal.c static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag) · line 505
Quoted 4 lines
drivers/acpi/thermal.c +1
-0+ tz->devices = devices;ACPI_THERMAL_TRIPS_EXCEPTION (flag,"device" ); } }
Thanks,
Rafael