From mboxrd@z Thu Jan 1 00:00:00 1970 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 D8356CD37B0 for ; Mon, 18 Sep 2023 05:37:41 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v8Ec4FPXKKE5PzTwZdVu9ew5KJyFZ7T+dediFupvg00=; b=TBtRBjz2RkcVPc 4mXG4nKdx4sJHI25aBq5U9/hYqzGZGY7VN95nK8Zuis45P5xJf5gmCvkc0flPzC2eTrgducCv8Dy/ h3PU6h9MT8dBHCSogQAAi/Z3wjtqiXK8XlO80D1ufALffirEF5oMfgqbZvQTBGDFACHc5lNQstN+C cG4dnBnuufNh8ZFv7ckCu+daC6HARDf2cP/4ccTd2w+j4wwmtno+DRUatZx7sbi2CB1AFH7m4dHqH 9fj4HVEn34EsazRan9liuyU9+qIM8e6GDMLHo2eJ3U0m4w65jQePAUHmJFGlN/qUML+K9lAb/n7K3 BpiGDjE7imw9jM9yyNMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qi6wb-00ETYz-1Z; Mon, 18 Sep 2023 05:37:13 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qi6wY-00ETXM-04 for linux-arm-kernel@lists.infradead.org; Mon, 18 Sep 2023 05:37:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695015429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y6uwQw2TQzRDCyynk3SluHNCszt0yuiUGbPEkJxyENg=; b=TMBU6+sm38UKj+JgTXH6c/PrAhLyz/OVZGCEj29PdQhfmzFu2CXyK+LriPJ1kLYhJ2T6np 2wtTYo6b2uL//D8qlaTNuxomRDIqRLP/d3dHSecCVl84wJpWenQDouDyRMXZa1F8Zfq4MB ix0smdi4SKO4t3xK8V1Tl+rUCeuhqAg= Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-496-i36X4eZQPva1wLUCUZ4-ag-1; Mon, 18 Sep 2023 01:37:07 -0400 X-MC-Unique: i36X4eZQPva1wLUCUZ4-ag-1 Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-1c4265b81ddso33934285ad.3 for ; Sun, 17 Sep 2023 22:37:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695015426; x=1695620226; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y6uwQw2TQzRDCyynk3SluHNCszt0yuiUGbPEkJxyENg=; b=vfMe5uHe5rMJxt0b0dhK6BTCbV4njWm2KAWpFyCPZI8HdqH51l8OMKVG4SDaWn5WaY s/RS9jwzmwj0Yy8GsGm5l0W2RpYK1mnusgJBaKwY6ejDE4kCRncRi1OCS2dK9bwYO5Vz gkdKnehvTzPRiyjLq4h4XafP7APEofHBEXN7xEggw3HylW2sseaE2GLRz3hmLgTNFZ8W iwJABKUmABKis/OYduvi65pMzlXWiIWZwEYD40Kj5EH99PRJrbKPtCWlBOPG6P37YdJf bUMjH/hzmsK36QuAAVHSaQT4RAFiCdcIcN3gashM0W5328H7E/dO0NrDkg1i5V8gFsvw EPWg== X-Gm-Message-State: AOJu0Yy6VbajA04/BPggHppY8vkTinx46Xucdmq5DTJMYH5JQ6PBaq9z TkEO1LoyeaRSffe3nZMbdc8ePwTP7bgkMlKfbhY4KxxMf4TlX4ysAAR4OFxKv4RdFjBCpNHK7vW JwH5AQLDrTm8SidTCr/Q/Hm/jPG5C5537VaHNskB+pp0= X-Received: by 2002:a17:902:ab12:b0:1c3:df77:3159 with SMTP id ik18-20020a170902ab1200b001c3df773159mr7962016plb.50.1695015426137; Sun, 17 Sep 2023 22:37:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4LA6vy59tdBGF7Ljgoach/YoGNT9CDJsVEh22V2F8alWKcyjdRZQRbNbCFRoo5eBTb6guIw== X-Received: by 2002:a17:902:ab12:b0:1c3:df77:3159 with SMTP id ik18-20020a170902ab1200b001c3df773159mr7962003plb.50.1695015425836; Sun, 17 Sep 2023 22:37:05 -0700 (PDT) Received: from ?IPV6:2001:8003:e5b0:9f00:dbbc:1945:6e65:ec5? ([2001:8003:e5b0:9f00:dbbc:1945:6e65:ec5]) by smtp.gmail.com with ESMTPSA id n5-20020a170902e54500b001b9d95945afsm7488399plf.155.2023.09.17.22.37.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 Sep 2023 22:37:05 -0700 (PDT) Message-ID: Date: Mon, 18 Sep 2023 15:36:58 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [RFC PATCH v2 19/35] ACPI: Move acpi_bus_trim_one() before acpi_scan_hot_remove() To: James Morse , 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 Cc: x86@kernel.org, Salil Mehta , Russell King , Jean-Philippe Brucker , jianyong.wu@arm.com, justin.he@arm.com References: <20230913163823.7880-1-james.morse@arm.com> <20230913163823.7880-20-james.morse@arm.com> From: Gavin Shan In-Reply-To: <20230913163823.7880-20-james.morse@arm.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230917_223710_128490_0F50ADF4 X-CRM114-Status: GOOD ( 24.30 ) 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: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 9/14/23 02:38, James Morse wrote: > 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 > --- > drivers/acpi/scan.c | 76 ++++++++++++++++++++++----------------------- > 1 file changed, 38 insertions(+), 38 deletions(-) > Reviewed-by: Gavin Shan > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c > index f898591ce05f..a675333618ae 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; > @@ -2506,44 +2544,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; Thanks, Gavin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel