From patchwork Tue Aug 27 08:29:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 2850043 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F30E0BF546 for ; Tue, 27 Aug 2013 08:38:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB7AB204D1 for ; Tue, 27 Aug 2013 08:38:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B3044204DF for ; Tue, 27 Aug 2013 08:38:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753212Ab3H0IiY (ORCPT ); Tue, 27 Aug 2013 04:38:24 -0400 Received: from mga02.intel.com ([134.134.136.20]:10057 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752549Ab3H0IiX (ORCPT ); Tue, 27 Aug 2013 04:38:23 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 27 Aug 2013 01:38:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.89,966,1367996400"; d="scan'208";a="393974394" Received: from lantianyu-ws.sh.intel.com (HELO localhost) ([10.239.37.18]) by orsmga002.jf.intel.com with ESMTP; 27 Aug 2013 01:38:22 -0700 From: tianyu.lan@intel.com To: rjw@sisk.pl, lenb@kernel.org Cc: Lan Tianyu , linux-acpi@vger.kernel.org Subject: [PATCH V3] ACPI/Thermal: Add check of "_TZD" availability and evaluating result Date: Tue, 27 Aug 2013 16:29:31 +0800 Message-Id: <1377592171-27183-1-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lan Tianyu 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 --- Change sicne v1: Arrange the whitespace, using "tz->devices = devices" instead of memcpy() and sizeof(devices) instead of sizeof(struct ...) Change since v2: Adjust line break drivers/acpi/thermal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 09f9340..49371fb 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -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"); } }