From patchwork Mon Jun 5 08:42:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 9765867 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2926D60364 for ; Mon, 5 Jun 2017 08:42:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 182AF27E5A for ; Mon, 5 Jun 2017 08:42:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D0D427F86; Mon, 5 Jun 2017 08:42:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A195027F8F for ; Mon, 5 Jun 2017 08:42:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751625AbdFEImS (ORCPT ); Mon, 5 Jun 2017 04:42:18 -0400 Received: from mga11.intel.com ([192.55.52.93]:27817 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751495AbdFEImR (ORCPT ); Mon, 5 Jun 2017 04:42:17 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2017 01:42:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,300,1493708400"; d="scan'208";a="1178364570" Received: from lvzheng-moblsp3.sh.intel.com ([10.239.159.181]) by fmsmga002.fm.intel.com with ESMTP; 05 Jun 2017 01:42:08 -0700 From: Lv Zheng To: "Rafael J . Wysocki" , "Rafael J . Wysocki" , Len Brown Cc: Lv Zheng , Lv Zheng , linux-acpi@vger.kernel.org, Bob Moore Subject: [PATCH 49/53] ACPICA: Unix application OSL: Correctly handle control-c (EINTR) Date: Mon, 5 Jun 2017 16:42:07 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bob Moore ACPICA commit dfbb87c3a96cfd007375f34a96e6f4a8ee477f97 Handle EINTR from a sem_wait operation. Ignore a control-c. Link: https://github.com/acpica/acpica/commit/dfbb87c3 Signed-off-by: Bob Moore Signed-off-by: Lv Zheng --- tools/power/acpi/os_specific/service_layers/osunixxf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/power/acpi/os_specific/service_layers/osunixxf.c b/tools/power/acpi/os_specific/service_layers/osunixxf.c index c04e8fe..025c1b0 100644 --- a/tools/power/acpi/os_specific/service_layers/osunixxf.c +++ b/tools/power/acpi/os_specific/service_layers/osunixxf.c @@ -750,9 +750,9 @@ acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 msec_timeout) { acpi_status status = AE_OK; sem_t *sem = (sem_t *) handle; + int ret_val; #ifndef ACPI_USE_ALTERNATE_TIMEOUT struct timespec time; - int ret_val; #endif if (!sem) { @@ -778,7 +778,10 @@ acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 msec_timeout) case ACPI_WAIT_FOREVER: - if (sem_wait(sem)) { + while (((ret_val = sem_wait(sem)) == -1) && (errno == EINTR)) { + continue; /* Restart if interrupted */ + } + if (ret_val != 0) { status = (AE_TIME); } break; @@ -831,7 +834,8 @@ acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 msec_timeout) while (((ret_val = sem_timedwait(sem, &time)) == -1) && (errno == EINTR)) { - continue; + continue; /* Restart if interrupted */ + } if (ret_val != 0) {