Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp779465pxb; Sun, 10 Oct 2021 10:52:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbD/uJgbD2YdvSOG5C7ugmR8Mm5V1i2KR0ktD2Tj/95GHxvfoklYihkxXyyECyIc+0yMM0 X-Received: by 2002:a17:906:d1d1:: with SMTP id bs17mr19362465ejb.198.1633888376730; Sun, 10 Oct 2021 10:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633888376; cv=none; d=google.com; s=arc-20160816; b=WDL0LGdJ1sAWJdXnL+p1HxZe3XpBdbHYsD5eb0FHXIq+aWoF3z1G8joUMp2cy47cxG gw9fMZMgB4Eq9XTIlkYQGxmUjNQX71BAdEKgffT1VGlltrlMFu+Kq4Jy2Nj00c6EB4QI YAdA8k0NI7PIfJCJxhRO/TOyPILr5IuOLFhOcsvTp9KxqHKrEtHRCP4F9A6Lv4JUr0qy owNhEz/ExMZeIUtJPgec7cl9Hldk+qPzMr8w3hOQHEPJviEgun4HWg0UtB/MUrg5fCc6 PMgTHjrcS5WIN0plbY4t0C+ddoadiKkUNiWJ3OeRjLHL30rgttWTzIbL/N1cY1t28fPX zQOg== 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 :message-id:date:subject:cc:to:from; bh=5VB/NThT+GHf9rqdq9rwp9nfNE45XgZ2MwALgX+EWJY=; b=ckLFaQbJOKpY/SCvr0nXZO5oXK9DJfFhG4KNzQ0s0Q/2Ltrid3BCHx4eeW0jqgUVMg YismsojIEmSaQNQBFNlinI9GbBlEp8hK1gWQFfZdebtJGUUYpCupk2e+0R5iseBYy5GR NatFzZZbuOrVvVNJ2Ck5sZD1NHuIdX+Z1j8hfgSBHQU7GpMqAqufpDakQLOHaE0MJtTL DyUJwH53nLQ//sAeQwDS2u6yvmMFrBrPlZ96BeKgyy/GHjvfgf0/Al1MqMg28U2LU3rS nOc3vJFMAc6FJjhESh4w6F9+aOM65dmNBhqIBlww5mJOtg0o2iAKQIeQ9foTEhK+SYHX u2gA== 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 z70si7086522ede.388.2021.10.10.10.52.33; Sun, 10 Oct 2021 10:52:56 -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 S231290AbhJJRZE (ORCPT + 99 others); Sun, 10 Oct 2021 13:25:04 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:62004 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbhJJRZD (ORCPT ); Sun, 10 Oct 2021 13:25:03 -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 548923abeb68aa07; Sun, 10 Oct 2021 19:23:03 +0200 Received: from kreacher.localnet (89-77-51-84.dynamic.chello.pl [89.77.51.84]) (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 965A566A6B4; Sun, 10 Oct 2021 19:23:02 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux ACPI Cc: Andy Shevchenko , LKML , Mika Westerberg Subject: [PATCH v2] ACPI: LPSS: Use ACPI_COMPANION() directly Date: Sun, 10 Oct 2021 19:23:01 +0200 Message-ID: <11853240.O9o76ZdvQC@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 89.77.51.84 X-CLIENT-HOSTNAME: 89-77-51-84.dynamic.chello.pl X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtgedgudduvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhephfegtdffjeehkeegleejveevtdeugfffieeijeduuddtkefgjedvheeujeejtedvnecukfhppeekledrjeejrdehuddrkeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepkeelrdejjedrhedurdekgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegrnhgurhhihidrshhhvghvtghhvghnkhhosehlihhnuhigrdhinhhtvghlrdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhhikhgrrdifvghsthgvrhgsvghrgheslhhinhhugidrihhnthgvlhdrtghomh X-DCC--Metrics: v370.home.net.pl 1024; Body=4 Fuz1=4 Fuz2=4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki The ACPI_HANDLE() macro returns the ACPI handle of the ACPI device object returned by the ACPI_COMPANION() macro, so it is more straightforward to call the latter directly instead of passing the handle produced by the former to acpi_bus_get_device(). Modify the code accordingly (no intentional functional impact). Signed-off-by: Rafael J. Wysocki --- -> v2: * Set ret = 0 on successful return from lpss_reg_read(). --- drivers/acpi/acpi_lpss.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) Index: linux-pm/drivers/acpi/acpi_lpss.c =================================================================== --- linux-pm.orig/drivers/acpi/acpi_lpss.c +++ linux-pm/drivers/acpi/acpi_lpss.c @@ -712,14 +712,13 @@ static void __lpss_reg_write(u32 val, st static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val) { - struct acpi_device *adev; + struct acpi_device *adev = ACPI_COMPANION(dev); struct lpss_private_data *pdata; unsigned long flags; int ret; - ret = acpi_bus_get_device(ACPI_HANDLE(dev), &adev); - if (WARN_ON(ret)) - return ret; + if (WARN_ON(!adev)) + return -ENODEV; spin_lock_irqsave(&dev->power.lock, flags); if (pm_runtime_suspended(dev)) { @@ -732,6 +731,7 @@ static int lpss_reg_read(struct device * goto out; } *val = __lpss_reg_read(pdata, reg); + ret = 0; out: spin_unlock_irqrestore(&dev->power.lock, flags); @@ -1266,7 +1266,8 @@ static int acpi_lpss_platform_notify(str if (!id || !id->driver_data) return 0; - if (acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev)) + adev = ACPI_COMPANION(&pdev->dev); + if (!adev) return 0; pdata = acpi_driver_data(adev);