Received: by 2002:a05:6359:322:b0:b3:69d0:12d8 with SMTP id ef34csp384081rwb; Wed, 10 Aug 2022 09:44:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR5GEvZd/Mjtfgt9N0ef1LshgTTOwIBg8Bqs202ge3KXtukHdWPPKiwQMpwXwA/4/wqOHOgS X-Received: by 2002:a17:90b:17ce:b0:1f4:d068:5722 with SMTP id me14-20020a17090b17ce00b001f4d0685722mr4552510pjb.28.1660149860928; Wed, 10 Aug 2022 09:44:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660149860; cv=none; d=google.com; s=arc-20160816; b=v7sdXQZ+83D8I4X51oR7JgJYirtDpzu8XGaiVWe4NDnX4oBHqWJk8VqSUc/aqFX8eq 7IUlGM/fl26dUYrq78YsWn8oK5ShzFu28vVcfGMMEVjQ6uRYNa1zq94qeG6WGyqvQZLJ yotCPZzfa4AVWCPIYhwtW2uUTRGtJrTWj8hlsi5kb6zf7iwig8K6KHdT+/MsjLWGiDwm 0zkxCwFep7UeVmLnXym0bXgnuv1RW9pU/XHdkDU8T6XgYDpznLzyojyPPYTcucexCZcF jgYfrbziJEo0NNYS0WgU9eL9SXAZuw5pxFxqbIzWQ7Jyuag7/wA8sgSisPr1sAiaFYsC 6mSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XapcdDqqSmdjtsGi4k/8PhWh6W3YwpwZmogLiXaMCyg=; b=tSTDPyuWgC9WXIz6WcyrsOl5VM0C7SeNChtGjiwUQjx6JhEL/+LCKRi4EqOj8Rr/IK r6A/pQxo/SYky7IrJj3aMJwaH4XVd1FEk1WnBHYUDYmwZ2mlXRW9qAFJMsfogHOHsDiw sMK1+n9cKMa4qJZVNBh15aPvfZP9m4JiA7JACmHpXu6WDF19/yM/MJbCEQ5pv5YGyY9y 792KIVvEKCPH0aYdTXxNjvUQWvlF98cJqa3UccIr1/VKviRLZBEBPAIswhUJG6ZVqI0I geHJDR6G+MvL5ifG51tQy9PBu5oYGMlWiC8++WUEA2KNdRVHgvBlUzly3Ap72O920gvO TxUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a170902dad200b0016ef7232e66si11454260plx.372.2022.08.10.09.44.07; Wed, 10 Aug 2022 09:44:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232824AbiHJQYd (ORCPT + 99 others); Wed, 10 Aug 2022 12:24:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232686AbiHJQYB (ORCPT ); Wed, 10 Aug 2022 12:24:01 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA94D81B1A; Wed, 10 Aug 2022 09:23:59 -0700 (PDT) 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.0.0) id 2ced05b3971ab5bb; Wed, 10 Aug 2022 18:23:58 +0200 Received: from kreacher.localnet (unknown [213.134.187.55]) (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 v370.home.net.pl (Postfix) with ESMTPSA id 7C19566CF1C; Wed, 10 Aug 2022 18:23:57 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Andy Shevchenko , Linux PM Subject: [PATCH v1 2/5] ACPI: scan: Rename acpi_bus_get_parent() and rearrange it Date: Wed, 10 Aug 2022 18:15:24 +0200 Message-ID: <2252770.ElGaqSPkdT@kreacher> In-Reply-To: <12036348.O9o76ZdvQC@kreacher> References: <12036348.O9o76ZdvQC@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 213.134.187.55 X-CLIENT-HOSTNAME: 213.134.187.55 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrvdegvddgleejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdffueeitdfgvddtudegueejtdffteetgeefkeffvdeftddttdeuhfegfedvjefhnecukfhppedvudefrddufeegrddukeejrdehheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrddukeejrdehhedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepgedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegrnhgurhhihidrshhhvghvtghhvghnkhhosehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhn vghlrdhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=4 Fuz1=4 Fuz2=4 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki The acpi_bus_get_parent() name doesn't really reflect the purpose of the function so change it to a more accurate acpi_find_parent_acpi_dev(). While at it, rearrange the code inside that function the make it easier to read. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/scan.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) Index: linux-pm/drivers/acpi/scan.c =================================================================== --- linux-pm.orig/drivers/acpi/scan.c +++ linux-pm/drivers/acpi/scan.c @@ -816,10 +816,9 @@ static const char * const acpi_honor_dep NULL }; -static struct acpi_device *acpi_bus_get_parent(acpi_handle handle) +static struct acpi_device *acpi_find_parent_acpi_dev(acpi_handle handle) { - struct acpi_device *device; - acpi_status status; + struct acpi_device *adev; /* * Fixed hardware devices do not appear in the namespace and do not @@ -830,13 +829,18 @@ static struct acpi_device *acpi_bus_get_ return acpi_root; do { - status = acpi_get_parent(handle, &handle); - if (ACPI_FAILURE(status)) - return status == AE_NULL_ENTRY ? NULL : acpi_root; + acpi_status status; - device = acpi_fetch_acpi_dev(handle); - } while (!device); - return device; + status = acpi_get_parent(handle, &handle); + if (ACPI_FAILURE(status)) { + if (status != AE_NULL_ENTRY) + return acpi_root; + + return NULL; + } + adev = acpi_fetch_acpi_dev(handle); + } while (!adev); + return adev; } acpi_status @@ -1777,7 +1781,7 @@ void acpi_init_device_object(struct acpi INIT_LIST_HEAD(&device->pnp.ids); device->device_type = type; device->handle = handle; - device->parent = acpi_bus_get_parent(handle); + device->parent = acpi_find_parent_acpi_dev(handle); fwnode_init(&device->fwnode, &acpi_device_fwnode_ops); acpi_set_device_status(device, ACPI_STA_DEFAULT); acpi_device_get_busid(device);