From patchwork Tue Oct 12 17:44:42 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: 12553385 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 451B2C4167B for ; Tue, 12 Oct 2021 17:51:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A8E561108 for ; Tue, 12 Oct 2021 17:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233194AbhJLRxZ (ORCPT ); Tue, 12 Oct 2021 13:53:25 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:42148 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232404AbhJLRxS (ORCPT ); Tue, 12 Oct 2021 13:53:18 -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 1dd9a816cb4bdd57; Tue, 12 Oct 2021 19:51:15 +0200 Received: from kreacher.localnet (unknown [213.134.187.88]) (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 ABF2D66A81B; Tue, 12 Oct 2021 19:51:14 +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 v1 4/7] surface: surface3-wmi: Use ACPI_COMPANION() directly Date: Tue, 12 Oct 2021 19:44:42 +0200 Message-ID: <3414042.iIbC2pHGDl@kreacher> In-Reply-To: <4369779.LvFx2qVVIh@kreacher> References: <4369779.LvFx2qVVIh@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.187.88 X-CLIENT-HOSTNAME: 213.134.187.88 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtkedguddugecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdejlefghfeiudektdelkeekvddugfeghffggeejgfeukeejleevgffgvdeluddtnecukfhppedvudefrddufeegrddukeejrdekkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrddukeejrdekkedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehhuggvghhovgguvgesrhgvughhrghtrdgtohhmpdhrtghpthhtohepmhhgrhhoshhssehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhuiihmrgigihhmihhlihgrnhes ghhmrghilhdrtghomhdprhgtphhtthhopehplhgrthhfohhrmhdqughrihhvvghrqdigkeeisehvghgvrhdrkhgvrhhnvghlrdhorhhg 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 --- 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)) From patchwork Tue Oct 12 17:46:47 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: 12553383 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 16691C433EF for ; Tue, 12 Oct 2021 17:51:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6CB560E54 for ; Tue, 12 Oct 2021 17:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233106AbhJLRxY (ORCPT ); Tue, 12 Oct 2021 13:53:24 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:63658 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbhJLRxR (ORCPT ); Tue, 12 Oct 2021 13:53:17 -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 0f511b32cbeb5915; Tue, 12 Oct 2021 19:51:13 +0200 Received: from kreacher.localnet (unknown [213.134.187.88]) (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 1450C66A819; Tue, 12 Oct 2021 19:51:13 +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 v1 5/7] surface: surface3_power: Use ACPI_COMPANION() directly Date: Tue, 12 Oct 2021 19:46:47 +0200 Message-ID: <3089655.5fSG56mABF@kreacher> In-Reply-To: <4369779.LvFx2qVVIh@kreacher> References: <4369779.LvFx2qVVIh@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.187.88 X-CLIENT-HOSTNAME: 213.134.187.88 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtkedgudduhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdejlefghfeiudektdelkeekvddugfeghffggeejgfeukeejleevgffgvdeluddtnecukfhppedvudefrddufeegrddukeejrdekkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrddukeejrdekkedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehhuggvghhovgguvgesrhgvughhrghtrdgtohhmpdhrtghpthhtohepmhhgrhhoshhssehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhuiihmrgigihhmihhlihgrnhes ghhmrghilhdrtghomhdprhgtphhtthhopehplhgrthhfohhrmhdqughrihhvvghrqdigkeeisehvghgvrhdrkhgvrhhnvghlrdhorhhg 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 mshw0011_notify() accordingly (no intentional functional impact). Signed-off-by: Rafael J. Wysocki --- drivers/platform/surface/surface3_power.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) Index: linux-pm/drivers/platform/surface/surface3_power.c =================================================================== --- linux-pm.orig/drivers/platform/surface/surface3_power.c +++ linux-pm/drivers/platform/surface/surface3_power.c @@ -160,15 +160,14 @@ mshw0011_notify(struct mshw0011_data *cd { union acpi_object *obj; struct acpi_device *adev; - acpi_handle handle; unsigned int i; - handle = ACPI_HANDLE(&cdata->adp1->dev); - if (!handle || acpi_bus_get_device(handle, &adev)) + adev = ACPI_COMPANION(&cdata->adp1->dev); + if (!adev) return -ENODEV; - obj = acpi_evaluate_dsm_typed(handle, &mshw0011_guid, arg1, arg2, NULL, - ACPI_TYPE_BUFFER); + obj = acpi_evaluate_dsm_typed(adev->handle, &mshw0011_guid, arg1, arg2, + NULL, ACPI_TYPE_BUFFER); if (!obj) { dev_err(&cdata->adp1->dev, "device _DSM execution failed\n"); return -ENODEV; From patchwork Tue Oct 12 17:48:23 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: 12553381 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 8AA1BC433F5 for ; Tue, 12 Oct 2021 17:51:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 728DB60E54 for ; Tue, 12 Oct 2021 17:51:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232848AbhJLRxS (ORCPT ); Tue, 12 Oct 2021 13:53:18 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:44448 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232851AbhJLRxP (ORCPT ); Tue, 12 Oct 2021 13:53:15 -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 717a687e2ae63d70; Tue, 12 Oct 2021 19:51:12 +0200 Received: from kreacher.localnet (unknown [213.134.187.88]) (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 7263066A819; Tue, 12 Oct 2021 19:51:11 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: LKML , Ike Panhc , Hans de Goede , platform-driver-x86@vger.kernel.org Subject: [PATCH v1 6/7] platform: x86: ideapad-laptop: Use ACPI_COMPANION() directly Date: Tue, 12 Oct 2021 19:48:23 +0200 Message-ID: <1727796.VLH7GnMWUR@kreacher> In-Reply-To: <4369779.LvFx2qVVIh@kreacher> References: <4369779.LvFx2qVVIh@kreacher> MIME-Version: 1.0 X-CLIENT-IP: 213.134.187.88 X-CLIENT-HOSTNAME: 213.134.187.88 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtkedgudduhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkfgjfhgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdejlefghfeiudektdelkeekvddugfeghffggeejgfeukeejleevgffgvdeluddtnecukfhppedvudefrddufeegrddukeejrdekkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvudefrddufeegrddukeejrdekkedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehikhgvrdhprghnsegtrghnohhnihgtrghlrdgtohhmpdhrtghpthhtohephhguvghgohgvuggvsehrvgguhhgrthdrtghomhdprhgtphhtthhopehplhgrthhfohhrmhdqughrihhvvghr qdigkeeisehvghgvrhdrkhgvrhhnvghlrdhorhhg X-DCC--Metrics: v370.home.net.pl 1024; Body=5 Fuz1=5 Fuz2=5 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 ideapad_acpi_add() accordingly (no intentional functional impact). Signed-off-by: Rafael J. Wysocki --- drivers/platform/x86/ideapad-laptop.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) Index: linux-pm/drivers/platform/x86/ideapad-laptop.c =================================================================== --- linux-pm.orig/drivers/platform/x86/ideapad-laptop.c +++ linux-pm/drivers/platform/x86/ideapad-laptop.c @@ -1534,17 +1534,13 @@ static void ideapad_check_features(struc static int ideapad_acpi_add(struct platform_device *pdev) { + struct acpi_device *adev = ACPI_COMPANION(&pdev->dev); struct ideapad_private *priv; - struct acpi_device *adev; acpi_status status; unsigned long cfg; int err, i; - err = acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev); - if (err) - return -ENODEV; - - if (eval_int(adev->handle, "_CFG", &cfg)) + if (!adev || eval_int(adev->handle, "_CFG", &cfg)) return -ENODEV; priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);