From patchwork Wed Oct 13 16:10:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 12556305 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E150C433F5 for ; Wed, 13 Oct 2021 16:16:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76ABD61163 for ; Wed, 13 Oct 2021 16:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237018AbhJMQSp (ORCPT ); Wed, 13 Oct 2021 12:18:45 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:63068 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236142AbhJMQSk (ORCPT ); Wed, 13 Oct 2021 12:18:40 -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 3.0.0) id 7be1e79e199bd7e8; Wed, 13 Oct 2021 18:16:35 +0200 Received: from kreacher.localnet (unknown [213.134.161.244]) (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 AD8B166A871; Wed, 13 Oct 2021 18:16:34 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Hans de Goede , Mark Gross , Maximilian Luz , platform-driver-x86@vger.kernel.org Subject: [PATCH v2 4/7] surface: surface3-wmi: Use ACPI_COMPANION() directly Date: Wed, 13 Oct 2021 18:10:55 +0200 Message-ID: <12896717.uLZWGnKmhe@kreacher> In-Reply-To: <3414042.iIbC2pHGDl@kreacher> References: <4369779.LvFx2qVVIh@kreacher> <3414042.iIbC2pHGDl@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.161.244 X-CLIENT-HOSTNAME: 213.134.161.244 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddrvddutddgleeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpedvjeelgffhiedukedtleekkedvudfggefhgfegjefgueekjeelvefggfdvledutdenucfkphepvddufedrudefgedrudeiuddrvdeggeenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrdduiedurddvgeegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhrtghpthhtoheplhhinhhugidqrggtphhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohephhguvghgohgvuggvsehrvgguhhgrthdrtghomhdprhgtphhtthhopehmghhrohhssheslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehluhiimhgrgihimhhilhhirghn sehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhlrghtfhhorhhmqdgurhhivhgvrhdqgiekieesvhhgvghrrdhkvghrnhgvlhdrohhrgh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org From: Rafael J. Wysocki The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION() macro and the ACPI handle produced by the former comes from the ACPI device object produced by the latter, so it is way more straightforward to evaluate the latter directly instead of passing the handle produced by the former to acpi_bus_get_device(). Modify s3_wmi_check_platform_device() accordingly (no intentional functional impact). Signed-off-by: Rafael J. Wysocki Reviewed-by: Maximilian Luz --- v1 -> v2: * Resend with a different From and S-o-b address and with R-by from Maximilian. No other changes. --- drivers/platform/surface/surface3-wmi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) Index: linux-pm/drivers/platform/surface/surface3-wmi.c =================================================================== --- linux-pm.orig/drivers/platform/surface/surface3-wmi.c +++ linux-pm/drivers/platform/surface/surface3-wmi.c @@ -139,13 +139,12 @@ static acpi_status s3_wmi_attach_spi_dev static int s3_wmi_check_platform_device(struct device *dev, void *data) { - struct acpi_device *adev, *ts_adev = NULL; - acpi_handle handle; + struct acpi_device *adev = ACPI_COMPANION(dev); + struct acpi_device *ts_adev = NULL; acpi_status status; /* ignore non ACPI devices */ - handle = ACPI_HANDLE(dev); - if (!handle || acpi_bus_get_device(handle, &adev)) + if (!adev) return 0; /* check for LID ACPI switch */ @@ -159,7 +158,7 @@ static int s3_wmi_check_platform_device( strlen(SPI_CTL_OBJ_NAME))) return 0; - status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, + status = acpi_walk_namespace(ACPI_TYPE_DEVICE, adev->handle, 1, s3_wmi_attach_spi_device, NULL, &ts_adev, NULL); if (ACPI_FAILURE(status))