Received: by 2002:a05:6359:322:b0:b3:69d0:12d8 with SMTP id ef34csp387863rwb; Wed, 10 Aug 2022 09:48:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR5ogSw5o6D1EVyTlq/Q0d9Wswvv8H42KCUI5BoXKGasm0BhmWl4ykadGmByE3K4r06ZEi8e X-Received: by 2002:a17:907:2c74:b0:730:e9bc:b211 with SMTP id ib20-20020a1709072c7400b00730e9bcb211mr18900642ejc.63.1660150100719; Wed, 10 Aug 2022 09:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660150100; cv=none; d=google.com; s=arc-20160816; b=yGPAR0HV7H/Aj/PFYSQ6ZxAi057o9JnY+vX3XKgHVymStJGugN3hDw1lzuCRB16Qa1 5amcD3e9cKXR19n50erCH2tLwCjOqrTNXLAzCyZBe/EPAT+xp+ASC+1QNjNruRCCZwpy GPynspX0ULOzz+1lY1oZs212N1AZpZPjNj8/SuAyDZ9iXCmuJySeagcApkkEwRqa0n1V fBiY82+kXdklvbKBpLbL9Ak7poMEDl8FmdepbQW6AAVG33aG8MdrOVFroMpMclk7u9yH SHzaeHZ+jjhRTIBse0nL25l3Rfow7Sfb3kopvxMdqMnDuVou5ob4TK2w0bzAdEXuyah1 IDeQ== 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=IEix7JHZAgaELN0oCT3MNcChioYQ1sM6KNlhpuprqDI=; b=if8JVGYC8Jf0sCtWQmWvICVmzHffXTEdY4vbGrO5Q9JqPxbgTbYa8NJds1R6xIgqRU lioOVJ07QGLdJk1zxjKL7g+hVvmF4bxzmKhr5jLLiLuosqxj7zj2J7p/hDi4BcIflEI9 6L+syUph//oSV7DhvMZJNXuLoe3HJmKkPFAgS2+BBoboROFIQtlOVhJsbvBE6RJif7hO 9F4JGJqhlmvmWsL/1/6dELkdZCbLlOiEQqvczkj9B0/OljBl0/LIZXUwlFVsF6sR2Hsm k9N6MHw4Ude70U3qYJZJBUzH/JU4pVKT9VdCeCABKx+wmxoAIsc9RGiRFdgi7W0DQMuL 6LYA== 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 v7-20020a056402174700b0043d7872f6easi10863264edx.118.2022.08.10.09.47.49; Wed, 10 Aug 2022 09:48: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 S232655AbiHJQYX (ORCPT + 99 others); Wed, 10 Aug 2022 12:24:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232637AbiHJQX7 (ORCPT ); Wed, 10 Aug 2022 12:23:59 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1EE8792E7; Wed, 10 Aug 2022 09:23:56 -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 2d7ae212334240e6; Wed, 10 Aug 2022 18:23:55 +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 BD40B66CF1C; Wed, 10 Aug 2022 18:23:54 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Andy Shevchenko , Linux PM Subject: [PATCH v1 4/5] ACPI: scan: Eliminate __acpi_device_add() Date: Wed, 10 Aug 2022 18:17:23 +0200 Message-ID: <13078324.uLZWGnKmhe@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 Instead of having acpi_device_add() defined as a wrapper around __acpi_device_add(), export acpi_tie_acpi_dev() so it can be called directly by acpi_add_power_resource(), fold acpi_device_add() into the latter and rename __acpi_device_add() to acpi_device_add(). No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/internal.h | 1 + drivers/acpi/power.c | 6 +++++- drivers/acpi/scan.c | 17 +++-------------- 3 files changed, 9 insertions(+), 15 deletions(-) Index: linux-pm/drivers/acpi/internal.h =================================================================== --- linux-pm.orig/drivers/acpi/internal.h +++ linux-pm/drivers/acpi/internal.h @@ -104,6 +104,7 @@ struct acpi_device_bus_id { void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, int type, void (*release)(struct device *)); +int acpi_tie_acpi_dev(struct acpi_device *adev); int acpi_device_add(struct acpi_device *device); int acpi_device_setup_files(struct acpi_device *dev); void acpi_device_remove_files(struct acpi_device *dev); Index: linux-pm/drivers/acpi/scan.c =================================================================== --- linux-pm.orig/drivers/acpi/scan.c +++ linux-pm/drivers/acpi/scan.c @@ -643,7 +643,7 @@ static int acpi_device_set_name(struct a return 0; } -static int acpi_tie_acpi_dev(struct acpi_device *adev) +int acpi_tie_acpi_dev(struct acpi_device *adev) { acpi_handle handle = adev->handle; acpi_status status; @@ -673,7 +673,7 @@ static void acpi_store_pld_crc(struct ac ACPI_FREE(pld); } -static int __acpi_device_add(struct acpi_device *device) +int acpi_device_add(struct acpi_device *device) { struct acpi_device_bus_id *acpi_device_bus_id; int result; @@ -755,17 +755,6 @@ err_unlock: return result; } -int acpi_device_add(struct acpi_device *adev) -{ - int ret; - - ret = acpi_tie_acpi_dev(adev); - if (ret) - return ret; - - return __acpi_device_add(adev); -} - /* -------------------------------------------------------------------------- Device Enumeration -------------------------------------------------------------------------- */ @@ -1866,7 +1855,7 @@ static int acpi_add_single_object(struct mutex_unlock(&acpi_dep_list_lock); if (!result) - result = __acpi_device_add(device); + result = acpi_device_add(device); if (result) { acpi_device_release(&device->dev); Index: linux-pm/drivers/acpi/power.c =================================================================== --- linux-pm.orig/drivers/acpi/power.c +++ linux-pm/drivers/acpi/power.c @@ -952,6 +952,7 @@ struct acpi_device *acpi_add_power_resou strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); strcpy(acpi_device_class(device), ACPI_POWER_CLASS); device->power.state = ACPI_STATE_UNKNOWN; + device->flags.match_driver = true; /* Evaluate the object to get the system level and resource order. */ status = acpi_evaluate_object(handle, NULL, NULL, &buffer); @@ -968,7 +969,10 @@ struct acpi_device *acpi_add_power_resou pr_info("%s [%s]\n", acpi_device_name(device), acpi_device_bid(device)); - device->flags.match_driver = true; + result = acpi_tie_acpi_dev(device); + if (result) + goto err; + result = acpi_device_add(device); if (result) goto err;