From patchwork Mon Feb 26 16:36:22 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: 206771 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2198491dyb; Mon, 26 Feb 2024 08:48:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVKL/3L6tIL0zUyYMN1jyMEHfiT6Nld55sSBPJAn6L27l+FSg16hTLccXKAXI0MrxM3HUeVfihYDmTK5khLTOQvB7syQQ== X-Google-Smtp-Source: AGHT+IG5ni7bGvOt12sy37rn3X3feIY7qMxxUD1jSSDQryHZWNBwA8T8bE50O7fMDIkff0x25IRo X-Received: by 2002:a05:620a:2e2:b0:787:a5ba:d56e with SMTP id a2-20020a05620a02e200b00787a5bad56emr9040194qko.76.1708966092624; Mon, 26 Feb 2024 08:48:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708966092; cv=pass; d=google.com; s=arc-20160816; b=AY+ZfaDQfMAu7oj1GId035IQIaQ3eqUxC140MJC6u++TI3l8YEQs3v7LxuyCrcTrYW tGXQaTpyPcLE/f0MxWbUbcB0sgS1e50ODe+Ydax6foMJt/+avhkdklk+h6fSgJ9Eapr6 8rc1rinZoJYw0W5iNe8LkjSTHHbBsEmqi98HvvQVBUYh5aLXWbWdSaJJFuOmmGCIwOmw BmgGAIL1/y/kxcugZGqMvy06NqXPUtsiRnSOLSWc4T6DpJ0BrWwevhIlkH8WPNNA04ES iWSXAbR+IwWuw1tur7i215akxfawchDce+VemSSZuTY0WDsjyV5NidiUCaokGd2HtnRk Bt3g== 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81931-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s2-20020a05620a16a200b00785d97bdedbsi5293591qkj.186.2024.02.26.08.48.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 08:48:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81931-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-81931-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81931-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6B18D1C2B27E for ; Mon, 26 Feb 2024 16:48:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7820D12F36A; Mon, 26 Feb 2024 16:47:11 +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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791980829413342367 X-GMAIL-MSGID: 1791980829413342367 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.