Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1963360rda; Tue, 24 Oct 2023 08:21:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGMw9Ul7DOhqwgss16gfk6fShV250Ml8jYzpsy4dG//2SiTNaYCKeLmQp93hbVR/73Uiwps X-Received: by 2002:a17:902:da83:b0:1ca:2743:bf7c with SMTP id j3-20020a170902da8300b001ca2743bf7cmr11402954plx.42.1698160910831; Tue, 24 Oct 2023 08:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698160910; cv=none; d=google.com; s=arc-20160816; b=PE6+1100wmq0u2ZTmzF5QSGWJ79+G9+BLI8pf26r0v477puoofsjiAqZlMJftLmeqX xh9k7O7TsDSryGgNpzL4X9vbF4HOarN+CbpfSEw6BjAFjNS9yvmu/KQCYjNhJPgX661k IsVRVrE7BLy3Cj3lzA8S/v8m4LbVgdDxLndTXfiLuR9xp9+7xLq64u/Xrg/nER8WHCqA 4HQ9SBhQiLL5gkgi97atUf0cpzsn3vyT5dxr/W+A3+0GOzY30RxVhicA67kAfMR14pGr HopwoMvHvd0pmh958rJ5l5wvtUfO1e5j2MbXom8jC49Uqjve58O2vM/IVwImE++eyLg2 t3yA== 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=4b5HegDKciHN9mls7Lc2XkvXRncQJquMBML+u/Mzhus=; fh=SkTV5xOrq7hxTIOggvbIOXu+48dqXijvMNKji0VGfy8=; b=b9v5y3pBPGFMkolkafM/8Ix/8T7467RUmZE6B2/hE1VdEcH296/6xAr3WKdzG5UADK AM6KLQuYXlh1924Xx5bMERwn7N2oufeLTRBjFnKxla0eu2pmYp+RbFh6mSao6p15PIsH f2I8JJqSnLy6/HAdpYsKK/UeJLSsfXHFf5hs7MM00L+ONhG9ABMyahYL9t9b3V5At7JY o6AP8neBjXyjsW7XAcGMkQ0Ve8ESq9H1BKoBgc5SEfXtDq6f6s4MQGW+ElpQzpi8Z1eP IqvILBZkRPFxuqyucCAwguCTttizBCpb0fvosmvhW9edyFXb1Xl5h6jEWGe2VEfDo2tz UXzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=uc2nzMrU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b11-20020a170902ed0b00b001c370dc4445si8582418pld.210.2023.10.24.08.21.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 08:21:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=uc2nzMrU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 0145A802B047; Tue, 24 Oct 2023 08:21:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234812AbjJXPVd (ORCPT + 99 others); Tue, 24 Oct 2023 11:21:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343625AbjJXPUd (ORCPT ); Tue, 24 Oct 2023 11:20:33 -0400 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 CC08D1FCE; Tue, 24 Oct 2023 08:18:19 -0700 (PDT) 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=4b5HegDKciHN9mls7Lc2XkvXRncQJquMBML+u/Mzhus=; b=uc2nzMrUE3t/feqmNPw6wzUhwD zNyvrYknjodQxhuBS9Y/uZVr2Fhh1qDmAQ3jFj85Tbg1Cpvv0zPd62W4gvQkUb5mYiKLs0H6yjrC5 PlsAMVktgdo6rE0Ziby+VQG0SIOKigLfdK/FcAFabzkFXd07BmFDxdCSRI9dTnZYYgzgm5VHObd8t lNJx81+9Naw4KOZvpgyTYTYhpeGZ1x7Se8E/np25G4B2DG2N3PCcZKrqV7OV1XNQXJ6tHscUNEzDO 9yV3ztYshVstk1Xc8sho4zuDFgcCVNRjzr2L1QP/LfXrFIr84zinCAaf3DISEiLFVEhhS8LRYlppY PZEWtDgQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:57442 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 1qvJAZ-0004T9-19; Tue, 24 Oct 2023 16:18:11 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qvJAa-00AqRA-Pt; Tue, 24 Oct 2023 16:18:12 +0100 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, 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 , "Rafael J. Wysocki" , Len Brown Subject: [PATCH 24/39] 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: Tue, 24 Oct 2023 16:18:12 +0100 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 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]); Tue, 24 Oct 2023 08:21:39 -0700 (PDT) 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 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 06e9bb4a633f..4343888c76d5 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; @@ -2507,44 +2545,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