Received: by 2002:ab2:644:0:b0:1ec:cbc4:63fb with SMTP id 4csp1141110lqn; Mon, 26 Feb 2024 08:48:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVvfKqfgHeorSbmh+wLZgGIMStKVXK2a689xLSN6Ik7k7omsjli/P8h/2JgNTQslvkIIdzBNSnvcMQbQsHDJj9hLn2UVIlz+mvmEzH/+A== X-Google-Smtp-Source: AGHT+IFygqHXqdzpMqCnnOmpwUxWVVathlP6vIGdkKCEDvehiquPTQN5EsLxjyR3vb48H2cOX+Gz X-Received: by 2002:ac2:43cc:0:b0:512:f6a0:130f with SMTP id u12-20020ac243cc000000b00512f6a0130fmr2706034lfl.60.1708966096346; Mon, 26 Feb 2024 08:48:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708966096; cv=pass; d=google.com; s=arc-20160816; b=Y6yZPhhtKQJAi/d6xzi9qSGggbSSjzUQTu3AapCci4RrGGtF/FL9mlYqQqNwDDuP8Z mmrssyV21JpGVafX6J/qhH681Dq7YgXNCGSmRcS+psetdFxmnpiyiCzn0IuPPMkqGpd4 gU+j7x9qzdUAjzZZOgytDhlVNwDHq7t3PKYdM2qJbjF7ixeWL8J5Ad20mnWWtDRIFpk/ x+q70aFOTA0jXkUjeWVKblnoa9iRDdfEGUHm4Dl4VbeGrGFeYbUKX/MIvThoqCKMcZYm Wxmp6ge2jyc+/YPlZwikOOeuiy2C/+5NZ08k6tMwamsdFNuRVRmIQoU3EsJExzR3LuB1 nXCg== 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=BXooS0EKwT05SNUuy1K2mwSmHMd3dapX8GLVDoil+6I=; fh=s5Fc0MEg8Xcp85xwyejK4S4zs7msQB7g1OY0X3YpOJg=; b=XtR7BGZI/1LpJ9RTCecvSzM7OrrSwSX9TqCIBRpdNhi5VGTuLfNqscQTPAQ7ALQIY3 8GkIEIuMbIONHfNSrbdLzAoN2vvVueAkqHxSZZFC1VTgQhiMDrRDLRDxMXN1yGf6X6P7 vrEGh1AFxR+ov0NN9U4A9TufwKJOMMwfkzLnUD9cKgywgGlqqWXx34W00fCJ4gKZQbZi PVCMK5acHNK0kyqs/qlLdwb9OtOVCmsw9DZITtQF9yqY+uDZpw2EwVqmKtRKKUI2vSFH gyFoxW/STUF03tNyLdXb0N8b+KXwtTe+5We7nugy+y+iFpNLP2FLBd6elJLzW80FL11G u9xA==; 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-81931-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81931-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z9-20020a170906240900b00a42f79ba0d7si2026147eja.713.2024.02.26.08.48.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 08:48:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81931-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-81931-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81931-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 937491F2ABBC for ; Mon, 26 Feb 2024 16:47:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E89412C800; Mon, 26 Feb 2024 16:47:08 +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 CC9C912CD86; Mon, 26 Feb 2024 16:47:03 +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=1708966026; cv=none; b=nW3Y6hvaanTlkDTe1Ff7MVn1p+mti8DYyOD0205zM7j7VHhny6C5L2yGQU4ywKkPzrLRrdKlhYNg4yejhlMrbbF+e4Z3ni++a1KqQCB2r2gkp+qfNgEiddG4hMH8iPZSnuZAVu0B7/XetJTBbVODXEacssAfTKb2xwujXkBNkEM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708966026; c=relaxed/simple; bh=V8VjEBHHbro0LzuYQmikArpREkhS9oNaxPxTm/Z9jQk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aDMmvR35nmaBW7Q/TwgsBLPWTQInAIqh6ySSnk+DZJ/ZLI2NtK6Xf9NjS1iKyid9y2G6aie1SG1T+E48y5uIBcd1e/rOACTJpQXxCDKGzK+RTAyfkg9WioUJrzMzAtj6LDO9DrqEXdCTBiNzVdLRDpLMJAXNV0S8thvwGXJG6wg= 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 f2c25af9204c6c8c; Mon, 26 Feb 2024 17:46:56 +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 E8A1866A4D4; Mon, 26 Feb 2024 17:46:55 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI , Jonathan Cameron Cc: LKML , Mika Westerberg , "Rafael J. Wysocki" , "Russell King (Oracle)" Subject: [PATCH v2 2/5] ACPI: scan: Relocate acpi_bus_trim_one() Date: Mon, 26 Feb 2024 17:36:22 +0100 Message-ID: <2175138.irdbgypaU6@kreacher> In-Reply-To: <6021126.lOV4Wx5bFT@kreacher> References: <6021126.lOV4Wx5bFT@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrgedvgdeltdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvffeuiedtgfdvtddugeeujedtffetteegfeekffdvfedttddtuefhgeefvdejhfenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepjhhonhgrthhhrghnrdgtrghmvghrohhnsehhuhgrfigvihdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehmihhkrgdrfigvshhtvghrsggvrhhgsehlihhnuhigrdhinhhtvghl rdgtohhmpdhrtghpthhtoheprhgrfhgrvghlsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigsegrrhhmlhhinhhugidrohhrghdruhhk X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 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 --- v1 -> v2: Add R-by from Jonathan. --- 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.