From patchwork Wed Feb 26 02:46:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aubrey Li X-Patchwork-Id: 3720531 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C8F4B9F2F7 for ; Wed, 26 Feb 2014 02:46:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E97AD201F7 for ; Wed, 26 Feb 2014 02:46:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E3F1201F0 for ; Wed, 26 Feb 2014 02:46:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751202AbaBZCqk (ORCPT ); Tue, 25 Feb 2014 21:46:40 -0500 Received: from mga11.intel.com ([192.55.52.93]:5619 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751114AbaBZCqj (ORCPT ); Tue, 25 Feb 2014 21:46:39 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 25 Feb 2014 18:46:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,544,1389772800"; d="scan'208";a="481843424" Received: from cli6-desk.ccr.corp.intel.com (HELO [10.239.37.134]) ([10.239.37.134]) by fmsmga001.fm.intel.com with ESMTP; 25 Feb 2014 18:46:37 -0800 Message-ID: <530D558D.6090607@linux.intel.com> Date: Wed, 26 Feb 2014 10:46:37 +0800 From: "Li, Aubrey" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Len.Brown@intel.com, rjw@rjwysocki.net, "alan@linux.intel.com" , "Raj, Ashok" Subject: [PATCH] ACPI/Sleep: pm_power_off need more sanity check to be installed Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 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 Sleep control and status registers need santity check before ACPI install acpi_power_off to pm_power_off hook. The checking code in acpi_enter_sleep_state() is too late, we should not allow a not-working pm_power_off function hooked. Signed-off-by: Aubrey Li --- drivers/acpi/sleep.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index b718806..0284d22 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -809,8 +809,11 @@ int __init acpi_sleep_init(void) status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); if (ACPI_SUCCESS(status)) { sleep_states[ACPI_STATE_S5] = 1; - pm_power_off_prepare = acpi_power_off_prepare; - pm_power_off = acpi_power_off; + if (acpi_gbl_FADT.sleep_control.address && + acpi_gbl_FADT.sleep_status.address) { + pm_power_off_prepare = acpi_power_off_prepare; + pm_power_off = acpi_power_off; + } } supported[0] = 0;