Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp191631lql; Fri, 12 Apr 2024 07:40:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVinwpF+t3YEuLlBQbb4RHwh3/mrZfO+1OTwZ1aeW8cZ30JH0WxAhogVqE4GmQjQnDxkBKRJeZzxl2tAbE/Gm5R4woD3ekxyJ/ygxmmoA== X-Google-Smtp-Source: AGHT+IFwutzYvimdRlxZoXvwWVU+stszH3q33i3PWva37n/x2webXoL5M4XmVgl3K2JQvx3lm8+7 X-Received: by 2002:a17:902:6503:b0:1e3:d8ae:df34 with SMTP id b3-20020a170902650300b001e3d8aedf34mr2964414plk.11.1712932835470; Fri, 12 Apr 2024 07:40:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712932835; cv=pass; d=google.com; s=arc-20160816; b=xvDLJX7KGejKg86Rgb1HKjJBiMSfdSMGlls8GCdl+qPR80H3gkSh5tOhSiVowSAA1J MAdfi4+1qQyuSzSh9vnNJQs57D7Dyzcn5cND7PEaG/ui7aJG6EO7H3GUlsZT5OeFKwwr x4pNCjNyMZvuwKjg24ulnpi4Hv3LAN8B+NCUyiGJai8UFoBWHcwRNMKjKrH54zHiCEsw NGzzAbEMnsT4XiPW7gJS7VvifqRpKpCtd6VkutN/MQ9qWR44klqCM9V+5/G/jNGlKKGz R7/ZUIuluQtwMpIiswsUHCVmGEQab39jhoYRLa402ddMmp7b8ApUYe2c70yLZC522YQf ImVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=P81iULilB5Ryzo2PsLtKHaPeu+BzS1JqdUWd5hLceq8=; fh=8XQHdFtte3XOHSEIytMgmfctfSZlTmw2q6RqB5HTTCI=; b=dp3Tn5nYh+gQ4Ze1v3SwZH/bnrQPXx9exw1K7BkE95zgOoTa1HL59zJJMz6xXtxmXU nw3bjnGlAoW3pyKMpH/CMG1Guw/jCzdHmaQfzNAyrJmvQJCCaFUBVloYjHBjMAvLTw+R bIlxItbdZyTNx2HEX4aplbWrtsrdE5+sRPhq+ARGkdE7vnKA0RHdDo6AdrgRvWeG48o3 xOChjwYgc5ecW9JS4OPILLLhwvcaGsrMUAQEiF6DF1CE80/hGpHgoOtEo8d4/Ay+hkLN YVtBTB7+bIMTJEntE0+0ssBWgWfa46Q+kWNakfrJQU9b65p40aB2SQriC1IpljonXxTc gQ/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-142856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142856-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u11-20020a170902e5cb00b001e259d00f15si3439733plf.20.2024.04.12.07.40.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 07:40:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-142856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142856-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A191F282A6E for ; Fri, 12 Apr 2024 14:40:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F5791422B8; Fri, 12 Apr 2024 14:40:26 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AAAD13CF8A; Fri, 12 Apr 2024 14:40:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712932825; cv=none; b=tAWE4TlTWUDFkP1aW3QAJ6Q0si4jHMD5DFrW10wnwobbFXb3YZqYKdWNrvFhvaGddr8R9bC2x6hcWZWvkZfbr9LIhSNE+/SZiVu+EvUGsBqSmakoLfn5fCNATFJRBfGuUl3qJMMxdOcVMcfqJTAXrZA4Kf3eMs3cFsYF4ym6pJY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712932825; c=relaxed/simple; bh=z2WhAVTrf637bDu11h6vBJFFF/4AH5cUHWm5PG3cdck=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uzbIqahyA0UUxZVEMJNXv0JmyshuSeupKvlhj1bk6jBxXOmlJ1kNOoLyh2XMOjRS1HfHYDTdVQl6kZkxmNuHc7XgETmaNgj5RfEod6M/uFPC0ZtfTFwknyh0Y3rWmMDMSxgclu+f0VlAeHz4L3E7gdxPfyIOAocOAM4AlT8P//c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VGK1l59lbz6J9bP; Fri, 12 Apr 2024 22:38:35 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 70E54140B55; Fri, 12 Apr 2024 22:40:21 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 12 Apr 2024 15:40:20 +0100 From: Jonathan Cameron To: , , , , , , , , Russell King , "Rafael J . Wysocki" , Miguel Luis , James Morse , Salil Mehta , Jean-Philippe Brucker , Catalin Marinas , Will Deacon CC: , , Subject: [PATCH v5 06/18] ACPI: scan: Add parameter to allow defering some actions in acpi_scan_check_and_detach. Date: Fri, 12 Apr 2024 15:37:07 +0100 Message-ID: <20240412143719.11398-7-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240412143719.11398-1-Jonathan.Cameron@huawei.com> References: <20240412143719.11398-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: lhrpeml500006.china.huawei.com (7.191.161.198) To lhrpeml500005.china.huawei.com (7.191.163.240) Precursor patch adds the ability to pass a flag (not yet used) into acpi_scan_check_and detach(). Done in a separate patch with no functional changes to reduce complexity of the actual deferal which follows. Signed-off-by: Jonathan Cameron --- v5: New patch resulting from rebase. - Internal review suggested we could also do this with flags so I'm looking for feedback on which option people find more readable. --- drivers/acpi/scan.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 7c157bf92695..79b1f4d2b6bd 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -244,13 +244,19 @@ static int acpi_scan_try_to_offline(struct acpi_device *device) return 0; } -static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check) +struct acpi_scan_c_and_d_param { + bool check_status; + bool eject; +}; + +static int acpi_scan_check_and_detach(struct acpi_device *adev, void *p) { struct acpi_scan_handler *handler = adev->handler; + struct acpi_scan_c_and_d_param *param = p; - acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, check); + acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, p); - if (check) { + if (param->check_status) { acpi_bus_get_status(adev); /* * Skip devices that are still there and take the enabled @@ -288,7 +294,11 @@ static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check) static void acpi_scan_check_subtree(struct acpi_device *adev) { - acpi_scan_check_and_detach(adev, (void *)true); + struct acpi_scan_c_and_d_param p = { + .check_status = true, /* Not update until after ej0 */ + .eject = false, + }; + acpi_scan_check_and_detach(adev, &p); } static int acpi_scan_hot_remove(struct acpi_device *device) @@ -2600,7 +2610,12 @@ EXPORT_SYMBOL(acpi_bus_scan); */ void acpi_bus_trim(struct acpi_device *adev) { - acpi_scan_check_and_detach(adev, NULL); + struct acpi_scan_c_and_d_param p = { + .check_status = false, + .eject = false, + }; + + acpi_scan_check_and_detach(adev, &p); } EXPORT_SYMBOL_GPL(acpi_bus_trim); -- 2.39.2