Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp614157lqb; Wed, 17 Apr 2024 06:23:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUXkFYzUr64Hhlg7SJ5Wsr35454nmITzTjShK791AwrG0hKD9xE8MrUzVu6mFnY9Ipe02tAZZzfqlD3MuZVv/hOKtS2bQE/s3JQe6ly6g== X-Google-Smtp-Source: AGHT+IGJjEls1mJr0BZ5bJ5DbUUsa+idyOslceFm8kiaMXL1FEXEphc37H4aMorPnJjxT20tTcmi X-Received: by 2002:a05:6102:3fa3:b0:47a:472a:a5f1 with SMTP id o35-20020a0561023fa300b0047a472aa5f1mr20101623vsv.0.1713360205910; Wed, 17 Apr 2024 06:23:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713360205; cv=pass; d=google.com; s=arc-20160816; b=ENLxR+8pl1Lujn+IJO0ErOE/pf3yu1SBXFuDzvMjUErA+JjKbFI1l7o6MUoBHKRxuG uZH/JKA7YWhdDfMkZkD5fhs3cQtT8uawCvrn0WCOkSUwA02lQ2Em7JTKVEGSi80oLpN2 SIreRxPwAtzafl4IkbuN1AhkAiNBiFbcllSboQehA10obiRvCrVkaE/fNLv21fI2fKd4 FowtXuJ+SuZTgVIFqRkTQnM99UheRVR/rg8Jy3HNd2o6B7LDLAlnLSR6Ds+Gt7o/v7jA 5mAmfTgbqQCw+uavwQ0D0BlqdILeLmiy+GhViPd6OOJ1/dsy6tS2wepjxab4KJup1Zfb YkOA== 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=9R+YZBZz7U5Xct6hawy6CUtROU+mQubm3F/vWgDTmwI=; fh=wmH6eZgtoFCyes/zVTYi+VaxxdPmNW9hqdNd8ZTZ4XU=; b=lXDYnJCDs1JxIXt7f7Y+m8lhdxvEQ1puthcigGYBNDy2V9n5Mx+HI1pf+uh9EVXlil vNdcTWBbqAsRnF1kScly8DiWdzAmAUdNxSfeqN7u7NLRnqysTxoGrHYGtL7i/zeuCKqa pvfai47cDmB8T024LwHSkz25phBnNcoPZFg0VqypCB007J+4JTV4jGVmInTCFgW3+fNm osauHxbrYh12BBAu2izJrnmyfF8MRXjajctEKGUliudrEuBImfk0g9QzesEUao6Sm9p9 AZh7e1w/wSQBgRfDYg7ra0hIo++TydqRNrXdh2u+eu/2AgzEkoY/DRrqhM9twaJi5Tut gw3g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-148553-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148553-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d30-20020a056102149e00b0047b61a42d81si2360006vsv.84.2024.04.17.06.23.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 06:23:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148553-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-148553-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148553-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 9EFFD1C21049 for ; Wed, 17 Apr 2024 13:23:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8DD013C90A; Wed, 17 Apr 2024 13:22:49 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (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 B4C6513C689; Wed, 17 Apr 2024 13:22:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713360169; cv=none; b=Dw4JDbDJcb6cWr2dq/6lDWt13hESClf+Ar0KCxuSgewlDZhIDXjlJJPVCnydHz02aywj8BYwQPe3b3nWJvBMet3J/2R4o3jJ/7bHxjMITnuZXO8POlsB6lUV+o6jUlg8N5HRTXKC41CYlsMQz/fQ9+4wKUNSncvP8G6oMNjVz3k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713360169; c=relaxed/simple; bh=+y77+7QZby+LVdmrVnp+NoTqJPrXhj6o2AOLhNYOMfg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KGf5FqhAwddrzDPQJD5Av7z8lm1wKfOYBV/QeJ8EfjzFKGwkYgDwIDRAHiijierjjO9V0T9cOjR27Nmk7eYaSrMs7pCUKBDx+Wepw2xSy6ISeMHGXpMVLrWeTu7XOo7Kf9lp80dZExDrNLqFoLKtkvKkSBQRrBL8Amb2mR9/i+E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.31]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VKM0C6Nc2z6K7GV; Wed, 17 Apr 2024 21:17:47 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 8333E140C9C; Wed, 17 Apr 2024 21:22:45 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 17 Apr 2024 14:22:44 +0100 From: Jonathan Cameron To: Thomas Gleixner , Peter Zijlstra , , , , , , , , , Russell King , "Rafael J . Wysocki" , Miguel Luis , James Morse , Salil Mehta , Jean-Philippe Brucker , Catalin Marinas , Will Deacon CC: Ingo Molnar , Borislav Petkov , Dave Hansen , , , Subject: [PATCH v6 07/16] ACPI: scan: switch to flags for acpi_scan_check_and_detach(); Date: Wed, 17 Apr 2024 14:19:00 +0100 Message-ID: <20240417131909.7925-8-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240417131909.7925-1-Jonathan.Cameron@huawei.com> References: <20240417131909.7925-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: lhrpeml500001.china.huawei.com (7.191.163.213) To lhrpeml500005.china.huawei.com (7.191.163.240) Precursor patch adds the ability to pass a uintptr_t of flags into acpi_scan_check_and detach() so that additional flags can be added to indicate whether to defer portions of the eject flow. The new flag follows in the next patch. Signed-off-by: Jonathan Cameron --- v6: Based on internal feedback switch to less invasive change to using flags rather than a struct. v5: New patch resulting from rebase. - Internal review suggested we could also do this with flags so I'm looking for feedback on which option people find more readable. --- drivers/acpi/scan.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index d1464324de95..1ec9677e6c2d 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -244,13 +244,16 @@ static int acpi_scan_try_to_offline(struct acpi_device *device) return 0; } -static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check) +#define ACPI_SCAN_CHECK_FLAG_STATUS BIT(0) + +static int acpi_scan_check_and_detach(struct acpi_device *adev, void *p) { struct acpi_scan_handler *handler = adev->handler; + uintptr_t flags = (uintptr_t)p; - acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, check); + acpi_dev_for_each_child_reverse(adev, acpi_scan_check_and_detach, p); - if (check) { + if (flags & ACPI_SCAN_CHECK_FLAG_STATUS) { acpi_bus_get_status(adev); /* * Skip devices that are still there and take the enabled @@ -288,7 +291,9 @@ static int acpi_scan_check_and_detach(struct acpi_device *adev, void *check) static void acpi_scan_check_subtree(struct acpi_device *adev) { - acpi_scan_check_and_detach(adev, (void *)true); + uintptr_t flags = ACPI_SCAN_CHECK_FLAG_STATUS; + + acpi_scan_check_and_detach(adev, (void *)flags); } static int acpi_scan_hot_remove(struct acpi_device *device) @@ -2601,7 +2606,9 @@ EXPORT_SYMBOL(acpi_bus_scan); */ void acpi_bus_trim(struct acpi_device *adev) { - acpi_scan_check_and_detach(adev, NULL); + uintptr_t flags = 0; + + acpi_scan_check_and_detach(adev, (void *)flags); } EXPORT_SYMBOL_GPL(acpi_bus_trim); -- 2.39.2