From patchwork Wed Mar 22 01:01:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Yi Lee X-Patchwork-Id: 9637879 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 60EE9602CC for ; Wed, 22 Mar 2017 01:02:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52263228C9 for ; Wed, 22 Mar 2017 01:02:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4589827CAF; Wed, 22 Mar 2017 01:02:01 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 31529228C9 for ; Wed, 22 Mar 2017 01:01:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751035AbdCVBB4 (ORCPT ); Tue, 21 Mar 2017 21:01:56 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36414 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750885AbdCVBBy (ORCPT ); Tue, 21 Mar 2017 21:01:54 -0400 Received: by mail-pg0-f65.google.com with SMTP id 81so19713759pgh.3; Tue, 21 Mar 2017 18:01:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=xaQXZS7Ow8ugdfg+qqH3+kF+nXjOp5zwY6k40kMI+RI=; b=m/zXR/5I/6kj/zPU+p/aT/3ZejjYKxar56SyqITWoHO87HbeQU7ydRBy20Hiq7xnpy m1b7+7bUls/gBybDJbEVtzDV4Xj/6neLpZ8L+tJ2tce8DSTaiDVN9MgEy8v7cndhWilx Plr2eBMzAqFeRYpK2QmVlxGi3cgq+uK6713SG1cFRpie2Arr60trUwFYbsJmZcBJ04d+ +abglqO25Zt6OJo275HPElx2wiC2PofsmVfg6HDoY/fCO1cKq2S4lO54XQgA9STJYS49 gUqwSbK+iH9hfe+c1h3zZ0OHoFl8SEqabnsWQ63WIKiuHq+IsH3uMIp4xssjjm+yuzW2 fNPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=xaQXZS7Ow8ugdfg+qqH3+kF+nXjOp5zwY6k40kMI+RI=; b=oV05ikE2CNOYiaYImnGnEyU3+z1VRLwTstHYEHPNRmeARXG8vjkmPw614c+2jXI222 KFpKopMG/id5xb4O897VdWAEKDBvV2fqDT9VUdDTeXaBmfSbU6BxsP8Eh85G/1wd+rPa 4FvelcbmED1X9VR69FTRwFRbjZW83vaXS4fJlztoXjyGCU+J7tgt2FQx5OcWkYxZZFy6 qYtM2nd4+rKN/wnFocFUE3LZlU9VVA80f4fuCF60RZ1V7VDfZxBY40nU5H2hifLlPJBJ wsluVwX1zO1za3SPYX3J3XvHFr1lpHYzxcCeGRq7JYLkQmspvW8rThpQbNUpCwSGRkeJ ZfyQ== X-Gm-Message-State: AFeK/H1S5KKC8mk1hRyDUbVvqSaosV2tWYH3RF9bU4RuXamKP794OymUIAdKPNDZMJpcGg== X-Received: by 10.98.35.9 with SMTP id j9mr44293476pfj.114.1490144513248; Tue, 21 Mar 2017 18:01:53 -0700 (PDT) Received: from linux-uc2j.site ([124.11.22.254]) by smtp.gmail.com with ESMTPSA id f205sm41776735pfa.35.2017.03.21.18.01.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Mar 2017 18:01:52 -0700 (PDT) From: "Lee, Chun-Yi" X-Google-Original-From: "Lee, Chun-Yi" To: "Rafael J . Wysocki" Cc: Len Brown , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Lee, Chun-Yi" , Michal Hocko , Jiri Kosina Subject: [PATCH] acpi: check the online state of all children in container Date: Wed, 22 Mar 2017 09:01:48 +0800 Message-Id: <20170322010148.32675-1-jlee@suse.com> X-Mailer: git-send-email 2.10.2 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 Just checking the state of container is not enough to confirm that the whole container is offlined. Kernel should checks all children's offline state as the logic in acpi_container_offline(). Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Michal Hocko Cc: Jiri Kosina Signed-off-by: "Lee, Chun-Yi" --- drivers/acpi/scan.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 1926918..f08ca31 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -260,13 +260,15 @@ static int acpi_scan_try_to_offline(struct acpi_device *device) static int acpi_scan_hot_remove(struct acpi_device *device) { acpi_handle handle = device->handle; + struct acpi_device *child; unsigned long long sta; acpi_status status; if (device->handler && device->handler->hotplug.demand_offline && !acpi_force_hot_remove) { - if (!acpi_scan_is_offline(device, true)) - return -EBUSY; + list_for_each_entry(child, &device->children, node) + if (!acpi_scan_is_offline(child, false)) + return -EBUSY; } else { int error = acpi_scan_try_to_offline(device); if (error)