From patchwork Wed Feb 21 20:01:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 204416 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1268658dyc; Wed, 21 Feb 2024 12:05:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVhMoEhxfmnX54q/7wk1rebhcb7r4oOkuWi84UHwTAeyyUYhhG1OaZoqz1DuE8cj29kZS6oLXzEibPv5eM2OGktjNkEJg== X-Google-Smtp-Source: AGHT+IEfDfRw+AwTAdNw0Yj96oKB2uieRbK0BvcMzIclI4aNqnl/RllQz9xVuaY3LftSnOWNTpVu X-Received: by 2002:a17:90b:4016:b0:29a:1ed5:18a2 with SMTP id ie22-20020a17090b401600b0029a1ed518a2mr1809438pjb.47.1708545943677; Wed, 21 Feb 2024 12:05:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708545943; cv=pass; d=google.com; s=arc-20160816; b=AUy+dbPXmXKrwlpNOFRaQi4HDheej6DXxHoVcCuxdz6EAy3KP+QpaYxumLXPdOuqrb HWHMfk/dDNgLr4sUBoq4BFF1nfw5Ecbe8RqKtlOKyncyq2/Lh91qrGhhdVnkYXh8BtVY r+FVVI+Ys5jopJeN88RKNNcp64I4e2gYb9169lO6MoZ2uaQUpElJ++erxVvb9lSuutlf yV76kpsRLcPoZEELj2PPgdQ8BYF1TAxXWe0ZXv6VgTMSb5wdk6FkZemIv2M9vewd+t6E /jaDEqwtzf71CUqUX40sXfhq1WPZa8geUwKLdSho+1j4LVutMvhkdxcdmnjE7Mj4HPgN M+0A== 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=eFF/IM5C+uM/fCtCikk2ixeNqdbLBPzLcmKrNLbKDRc=; fh=s5Fc0MEg8Xcp85xwyejK4S4zs7msQB7g1OY0X3YpOJg=; b=J9BpoqyLgs4Corm4q5VVBbQ+EM/a3JQfwR/gyab67E+l1Zkmgm0D1jnjwyuSyZvWmW 9Bw/PISUOew6eFYNOcFQ1lhL4XcJv4eefQYQCKRqY5C3BHSiyBFv3Q/4H7ghDWQXNkPo U9CTfTDN7+dYPSJusrjqbqnpsnc9wXSFaZUsmO4EBt+L4UC304j2WrYvlGC8aeEFebzm R4VbtE7dLqNAE11SZhGXsv0OkCywwSK+MQVP2xVin7eSlbFjPau90VPCWTGZyOvAQFzO jJ4TN+2BRWBS+hIh1Ga8ENcamNbKM1ctTDoRi2ZccH21UqjpXr7BK4a/4X7JH5nL9qc0 h1eg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-75445-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75445-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p5-20020a17090a868500b002935f38dcf1si2066208pjn.181.2024.02.21.12.05.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:05:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75445-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-75445-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75445-ouuuleilei=gmail.com@vger.kernel.org" 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 36151283875 for ; Wed, 21 Feb 2024 20:05:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D28871272D7; Wed, 21 Feb 2024 20:04:49 +0000 (UTC) Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (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 E47DE86151; Wed, 21 Feb 2024 20:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708545888; cv=none; b=om4YFqH/hsPNeMM0o02w+DPUdSGnbzenTKXXB5lgDfH6xbeYeHItXdo3uyd0wqRyItsRw1g51GW0TwWvBFd6w8JTuZG+FcP85iOBdVkkbYxu6PuQxhr4WVJlR4SucuBnaEjST6w02sJhryR//TCkCT44ibvbc+u6bCAEwybrPEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708545888; c=relaxed/simple; bh=ZsHdlJrJVlvGSfzCG6LWBqpX9udtvXpPnuXEOa0+fSY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dTk0zeuKKalDGrFxydzLXsGXe9+pQBRZxVLZPqNLF3Fy0EULIRFeJW7jXHDIQvnnzhHknxSmV4L2Tty2HMWnF2+cKxZpKpzCt6G/7x9HWUlhFr4uXTv02SSISTEIMV2VIraDxQ1eZasDF84C5uUL3IFkLakCxDN5Ye1ewPqy15Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.4.0) id 67b712691066ea71; Wed, 21 Feb 2024 21:04:38 +0100 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 89EF366A243; Wed, 21 Feb 2024 21:04:37 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI , Jonathan Cameron Cc: LKML , Mika Westerberg , "Rafael J. Wysocki" , "Russell King (Oracle)" Subject: [PATCH v1 2/4] ACPI: scan: Relocate acpi_bus_trim_one() Date: Wed, 21 Feb 2024 21:01:48 +0100 Message-ID: <2189881.irdbgypaU6@kreacher> In-Reply-To: <4562925.LvFx2qVVIh@kreacher> References: <4562925.LvFx2qVVIh@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrfedvgddufedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepiedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehjohhnrghthhgrnhdrtggrmhgvrhhonheshhhurgifvghirdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhhikhgrrdifvghsthgvrhgsvghrgheslhhinhhugidrihhnthgv lhdrtghomhdprhgtphhtthhopehrrghfrggvlheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugiesrghrmhhlihhnuhigrdhorhhgrdhukh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791540271832350480 X-GMAIL-MSGID: 1791540271832350480 From: Rafael J. Wysocki Relocate acpi_bus_trim_one() (without modifications) so as to avoid the need to add a forward declaration of it in a subsequent patch. No functional changes. Signed-off-by: Rafael J. Wysocki Reviewed-by: Jonathan Cameron --- drivers/acpi/scan.c | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) Index: linux-pm/drivers/acpi/scan.c =================================================================== --- linux-pm.orig/drivers/acpi/scan.c +++ linux-pm/drivers/acpi/scan.c @@ -244,6 +244,32 @@ static int acpi_scan_try_to_offline(stru 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; +} + static int acpi_scan_hot_remove(struct acpi_device *device) { acpi_handle handle = device->handle; @@ -2547,32 +2573,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.