Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5289423rdb; Wed, 13 Dec 2023 04:50:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFv8+fCzGXMFPMOzPZVgpNh+f1K/3yuAgGGI1Ju7rkSQvJrzpZ190rvTUM+/BNpn4UeOsSR X-Received: by 2002:a05:6a00:6007:b0:6ce:f6a5:6edb with SMTP id fo7-20020a056a00600700b006cef6a56edbmr6380819pfb.21.1702471813334; Wed, 13 Dec 2023 04:50:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702471813; cv=none; d=google.com; s=arc-20160816; b=k2mqdK4FaiPmT+Kw6eNd4r3ftlpeYhb2sh+bRUaEmrNObrdloFTzLNWqht6IJSJn+N OwY/c3ykritL2eM94X3r8mnon3DdCiJpVWs4njiJIYfqdl3uf91bJ6GiWbFvpIpNatmV sW7LLWVWCmAYE1qTK+8YWZfAe9gZDOpNEe+66GiGaEUnIlVpwaf0UK8ELnqdJAh29/U6 nLVEH53Sn3Ge2Vvj/tMl3WsyFNryOVE6Bv34G+Q1wlgH7VcZUferIHFHEuiVrpEvWZCf rQlHMjzgtLPnN+O4LKalEzLD/mrvwgVR+HbINPf3uOfJOMlhHCJJLe1NGo94KZfFP5HJ niQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature; bh=FKb6Tx3YWEOt6/qzVEvWhIjmqk2GL+umifX9jwivsXw=; fh=YWIBRcP8cdLYR894sEToaan3lN1VSUITe+B678IO0WY=; b=WPImxYyjBEqdYL90cWvgXbaoewzAkbmITBFw2oBvFRmIbvxeuj4JHvuIpmY49djQ5U WDJk4VNrX6+GtmdFFfjD0k0/tZ97O64dZe+TZq9NH6brSpi1RqumXLWy+owGHbr4Fzkr Lk9kqdTNd1pjsu22J5hMWqYrJokQhM5hsNb8fSzqNsPWg/8mmGYA5fa0Rd24vI+PvwaK tJXvgATF7bubET2KIKdek/ymoD+M4mGg5/SuYzcoAydp7F0avC9QCBCCzax3ZBTMkBzC K1j+tLzYsMbIT68B8/DByu0Q+GNpab0qxi4ZwKQby59QMj1FJbRiWYqtSEBJ5dQzFcxe h+Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=iPvbSxdO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z16-20020a63c050000000b005a9b0fe6afbsi9349163pgi.144.2023.12.13.04.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 04:50:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=iPvbSxdO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 23DB780C1121; Wed, 13 Dec 2023 04:50:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378954AbjLMMtx (ORCPT + 99 others); Wed, 13 Dec 2023 07:49:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378938AbjLMMtq (ORCPT ); Wed, 13 Dec 2023 07:49:46 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 752D6A4; Wed, 13 Dec 2023 04:49:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=FKb6Tx3YWEOt6/qzVEvWhIjmqk2GL+umifX9jwivsXw=; b=iPvbSxdOfLSl0br81MW2NrQMOg 4nPsPkQ6ioYh+vwRKIq9OpJY4QNbTdAEf6GB7UFRf+0gTRk5MUgucEOiziY+kSkHDBeecdmVC8B0L c6iQFU3lqZGH+FhOPFH5DIaUTmxXQHAr+0C3VAy4iaYAOkdkF3rqAzn+IC0fTLIgt6WA0V/3sq4ab IYsKHfp8ZW0yK2+ANMrXtips/qJLG7k66jsh+v5euH+fL4b+DIbk9dCwEb4CwhL4VF0uIc6EOdVbg LPmQFlHnNCj8LzfaBO/834r6i5eLm1HnJTfNpwNo+FvjLtsHdn03Q7KZZmRTnOyrzs9wvIsgJcGfd 3rh7MbNg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:58180 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rDOgG-0008Dp-10; Wed, 13 Dec 2023 12:49:40 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rDOgI-00Dvk8-8X; Wed, 13 Dec 2023 12:49:42 +0000 In-Reply-To: References: From: Russell King (Oracle) To: linux-pm@vger.kernel.org, loongarch@lists.linux.dev, linux-acpi@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, kvmarm@lists.linux.dev, x86@kernel.org, acpica-devel@lists.linuxfoundation.org, linux-csky@vger.kernel.org, linux-doc@vger.kernel.org, linux-ia64@vger.kernel.org, linux-parisc@vger.kernel.org Cc: Salil Mehta , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com, James Morse Subject: [PATCH RFC v3 06/21] ACPI: Move acpi_bus_trim_one() before acpi_scan_hot_remove() MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Wed, 13 Dec 2023 12:49:42 +0000 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 04:50:12 -0800 (PST) From: James Morse A subsequent patch will change acpi_scan_hot_remove() to call acpi_bus_trim_one() instead of acpi_bus_trim(), meaning it can no longer rely on the prototype in the header file. Move these functions further up the file. No change in behaviour. Signed-off-by: James Morse Reviewed-by: Jonathan Cameron Reviewed-by: Gavin Shan Tested-by: Miguel Luis Tested-by: Vishnu Pajjuri Tested-by: Jianyong Wu Signed-off-by: Russell King (Oracle) --- drivers/acpi/scan.c | 76 ++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 728649a2a251..ec42fe9d0611 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -244,6 +244,44 @@ static int acpi_scan_try_to_offline(struct acpi_device *device) return 0; } +static int acpi_bus_trim_one(struct acpi_device *adev, void *not_used) +{ + struct acpi_scan_handler *handler = adev->handler; + + acpi_dev_for_each_child_reverse(adev, acpi_bus_trim_one, NULL); + + adev->flags.match_driver = false; + if (handler) { + if (handler->detach) + handler->detach(adev); + + adev->handler = NULL; + } else { + device_release_driver(&adev->dev); + } + /* + * Most likely, the device is going away, so put it into D3cold before + * that. + */ + acpi_device_set_power(adev, ACPI_STATE_D3_COLD); + adev->flags.initialized = false; + acpi_device_clear_enumerated(adev); + + return 0; +} + +/** + * acpi_bus_trim - Detach scan handlers and drivers from ACPI device objects. + * @adev: Root of the ACPI namespace scope to walk. + * + * Must be called under acpi_scan_lock. + */ +void acpi_bus_trim(struct acpi_device *adev) +{ + acpi_bus_trim_one(adev, NULL); +} +EXPORT_SYMBOL_GPL(acpi_bus_trim); + static int acpi_scan_hot_remove(struct acpi_device *device) { acpi_handle handle = device->handle; @@ -2513,44 +2551,6 @@ int acpi_bus_scan(acpi_handle handle) } EXPORT_SYMBOL(acpi_bus_scan); -static int acpi_bus_trim_one(struct acpi_device *adev, void *not_used) -{ - struct acpi_scan_handler *handler = adev->handler; - - acpi_dev_for_each_child_reverse(adev, acpi_bus_trim_one, NULL); - - adev->flags.match_driver = false; - if (handler) { - if (handler->detach) - handler->detach(adev); - - adev->handler = NULL; - } else { - device_release_driver(&adev->dev); - } - /* - * Most likely, the device is going away, so put it into D3cold before - * that. - */ - acpi_device_set_power(adev, ACPI_STATE_D3_COLD); - adev->flags.initialized = false; - acpi_device_clear_enumerated(adev); - - return 0; -} - -/** - * acpi_bus_trim - Detach scan handlers and drivers from ACPI device objects. - * @adev: Root of the ACPI namespace scope to walk. - * - * Must be called under acpi_scan_lock. - */ -void acpi_bus_trim(struct acpi_device *adev) -{ - acpi_bus_trim_one(adev, NULL); -} -EXPORT_SYMBOL_GPL(acpi_bus_trim); - int acpi_bus_register_early_device(int type) { struct acpi_device *device = NULL; -- 2.30.2