Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp728552pxj; Wed, 16 Jun 2021 12:10:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9+dfab0PFH7EB7WC+/n9Dy3vosVW00KeWOHQ+DqjLXTilvCAOFopjFsSzix0eUgOSgdsF X-Received: by 2002:a17:906:5294:: with SMTP id c20mr1117566ejm.76.1623870601190; Wed, 16 Jun 2021 12:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623870601; cv=none; d=google.com; s=arc-20160816; b=RXRYT8YoznGPDR62ybdOG3q7GRNgguDcRwZS8UDBb3sJLekjz4UjFVnMSGw+L3KNjp 0a7qW+oG+ir2sCVgqMbNdCOwLXu4HT++Ewx5iupEQVOw8fR9sSizZ445zOYuUWM0cU8b bB4tNf5VE5Kgryi/FUQvARto01rvlGihIusBhFaq+pRz9bExzCaQGmWElrGKPdm9KMzs b4RgyZm1kox7zvvNJuFNB8SToWd+hwPJhL5FiSOTUOglHfNtbw+FOG438IBO52qawlYU ccULkixqyufUz7fWf7/7SY3zgQGz1OhSTiYAM25klDDeE3Ivc7zZiGZIS0WnQByEQtMU MN2w== 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=wkoNvnciQF9KD77h91ow+XZ0k7FRGHlFdLVJP67R4io=; b=vyA7tgKRwlVe4hIGiMtkt2eCA2EMf4fcgunRVvLpPjm2w7RmF1lTnUy1v7fOujmARo 22DAdEZW0pVXuKMAYFYpdn1vHHeVj8SW4EzeyA5ZYK0VbuKbOLdxKuRfLgRl4CeLrzYG WJsMnG/e80Xzort6Ftc/UBBUHJl5aUyDl5yuo6S/NUwhBkDASnxfaSGlT8DGj/db3N3l ZfyZa0nD68n3ldlliWeY6GMK4WIuP/Pc5VFzGQMEcbA8nHRPErCZBpAevIZ2DqogsiP9 J7nWLsI3rEtihzqfZDXLpTonrP7kyaXXKkXcv0/WtbV3N8B3yAMwiPqQmVxCqPiQwEvM 5zfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si3124846ejm.98.2021.06.16.12.09.36; Wed, 16 Jun 2021 12:10:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234000AbhFPO21 (ORCPT + 99 others); Wed, 16 Jun 2021 10:28:27 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:44892 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233866AbhFPO2Z (ORCPT ); Wed, 16 Jun 2021 10:28:25 -0400 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 2.1.0) id 9b81eaca0bc76860; Wed, 16 Jun 2021 16:26:18 +0200 Received: from kreacher.localnet (89-64-81-4.dynamic.chello.pl [89.64.81.4]) (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 9553E669926; Wed, 16 Jun 2021 16:26:17 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Hans de Goede Subject: [PATCH 4/5] ACPI: scan: Reorganize acpi_device_add() Date: Wed, 16 Jun 2021 16:24:30 +0200 Message-ID: <3392385.iIbC2pHGDl@kreacher> In-Reply-To: <3140195.44csPzL39Z@kreacher> References: <3140195.44csPzL39Z@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 89.64.81.4 X-CLIENT-HOSTNAME: 89-64-81-4.dynamic.chello.pl X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledrfedvledgjeejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvjeelgffhiedukedtleekkedvudfggefhgfegjefgueekjeelvefggfdvledutdenucfkphepkeelrdeigedrkedurdegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepkeelrdeigedrkedurdegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohephhguvghgohgvuggvsehrvgguhhgrthdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=3 Fuz1=3 Fuz2=3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki Move the invocation of acpi_attach_data() in acpi_device_add() into a separate function. No intentional functional impact. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/scan.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) Index: linux-pm/drivers/acpi/scan.c =================================================================== --- linux-pm.orig/drivers/acpi/scan.c +++ linux-pm/drivers/acpi/scan.c @@ -640,23 +640,32 @@ static int acpi_device_set_name(struct a return 0; } +static int acpi_tie_acpi_dev(struct acpi_device *adev) +{ + acpi_handle handle = adev->handle; + acpi_status status; + + if (!handle) + return 0; + + status = acpi_attach_data(handle, acpi_scan_drop_device, adev); + if (ACPI_FAILURE(status)) { + acpi_handle_err(handle, "Unable to attach device data\n"); + return -ENODEV; + } + + return 0; +} + int acpi_device_add(struct acpi_device *device, void (*release)(struct device *)) { struct acpi_device_bus_id *acpi_device_bus_id; int result; - if (device->handle) { - acpi_status status; - - status = acpi_attach_data(device->handle, acpi_scan_drop_device, - device); - if (ACPI_FAILURE(status)) { - acpi_handle_err(device->handle, - "Unable to attach device data\n"); - return -ENODEV; - } - } + result = acpi_tie_acpi_dev(device); + if (result) + return result; /* * Linkage