From patchwork Fri Apr 12 14:37:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 13627876 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CD36FC4345F for ; Fri, 12 Apr 2024 14:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=c6l+6pDKTx0Z8BJiTS0PDa1LstQ5g5DbFvVinwYtMFg=; b=ZGSJ9+Cntz/NHZ nhCUG25ppVdankDw3oSZcKtd4vCNqaydXuskzotCImzUhNOvUBL3wEmlUmfUzMfPQk0rXr2L3Lj+Q FIUpPW/3vTdWvU0aCOfsuinyLAVXDN67l7rtxQnsHIKwqz2Gz+1Ybd7Pr2OwicQL2FcgcjsMiz1Fq pSYzeoemoad1pHTCDMWCPwMrJkQ6ksPPwarGvbeJQqq/PZfZ+wFFKw+jB/TaWCrtz2xUxH7ipjKVp 2ZpSAVIOUUEpXG9z32U8g9dgxUCJdtwVxLr14IG/HF9Es0F9j/a9G7pBwk20qB85rScX81M6OJcrB +guylia0aEcmPsnNE0Tw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvI4r-000000001ur-46j5; Fri, 12 Apr 2024 14:40:29 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvI4o-000000001tP-4BBp for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2024 14:40:28 +0000 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> MIME-Version: 1.0 X-Originating-IP: [10.122.247.231] X-ClientProxiedBy: lhrpeml500006.china.huawei.com (7.191.161.198) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240412_074027_392339_85E17D6D X-CRM114-Status: GOOD ( 14.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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);