Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp666051pxj; Thu, 10 Jun 2021 09:44:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJZ9VWLNaIqKlVYHMU6fiXihjjFWghzFVKzJOVdNWJZVKZLCIfA1FOpf3V/KakkOc1mUea X-Received: by 2002:aa7:c7cd:: with SMTP id o13mr348864eds.269.1623343493888; Thu, 10 Jun 2021 09:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623343493; cv=none; d=google.com; s=arc-20160816; b=sMRCjZ8wM0xbvdZJmNvbccxatAlNxJL+e7U5/0dmJWL4ZXP5qCggpQhPbV9tE+lGxa ae2749jSnCkLGbujbUY9EYkTQIRvDSYTJxlMgpCM1t8VnejId+OR5vEIF3kB+9cNGZ2v PEFBJU3UtmLZelUbSAI5qVzNQlEDE7/wTF7iSIB4TddOF8K0PBJ645lvZ0pRZC/0wlD/ 5Z67nZrMrcLh2PtIHNcSNYr9TlH+lSPmlOIWsNV9+QFg1A37CVkpqEhsqQyN+XKtpe/B hCwA6q6yGgsVaghcb512KefyVgOacDIB/NB7cBXbPG/YsYK4gp0O5Tc5ewC992vDm7GU yu2A== 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 :dkim-signature; bh=WYaGnISu1YfOE/7UiWGOnu7UNyMRUmG6vqNEYiYQnuw=; b=t2FX1nmY+X1nqAENRVTsU9z+rcJ8f5nwSQMxgdNUZpY+kBWUinRwC6e+btvzzw03U2 blgJk94uKyrcWKcnR9SHAGJDLhjSPwbohsCrnNVdA+/tajDxi9BeXJMJjXOmcXG2lJjQ yV2y6LTsvmqC5U3DrASOUqHRT0DASfwWXG4RLIl+5PDeXmEM9pb1RY+kG97PItrOWGLB i/pIaJsPFgsTIZP6XDk2FhQ9E3In1ZigT2w112YPmnMNapPpFIpd+ahK0wgfXGtQ7jWf 9caGG017aXbGwRELO7bF3mgeVZ1Xlgs1ksFDeeibI5G37x2yVuC0nA51AjrCM0g0GP+w zZ4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oOrrc83d; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i9si2632827edu.471.2021.06.10.09.44.29; Thu, 10 Jun 2021 09:44:53 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oOrrc83d; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231715AbhFJQoW (ORCPT + 99 others); Thu, 10 Jun 2021 12:44:22 -0400 Received: from mail-ej1-f45.google.com ([209.85.218.45]:36688 "EHLO mail-ej1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231626AbhFJQnr (ORCPT ); Thu, 10 Jun 2021 12:43:47 -0400 Received: by mail-ej1-f45.google.com with SMTP id a11so227553ejf.3; Thu, 10 Jun 2021 09:41:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WYaGnISu1YfOE/7UiWGOnu7UNyMRUmG6vqNEYiYQnuw=; b=oOrrc83d8TfIoeXmdiRoiQg6glDODRsfbpbGcLCinVvDPPg4EwsRnclPpJGstuwomD Loe/4iW8ArsQULGi5DaAxbHMvjJ13BPDnbOvZFsEIy2ZPqa51dMbtxYcG4fAawlfR5Jw gKTx7B4SvmEIZY4c0R/PpJdoCQghcoPfzZVhxZ7hdlYVA+oiAlarlUZJGfRfK2IWs1Td UZzn1wJtbaW8kK82d/ly2IcvdtRmbDm2YUKBIz3x6xvsxQcsRVk/ALJGw+GQysJYmabr kg3GsAnLtefhEN7Mwo92YkIbiYiaolH7vbQ77mxVB7Hn9LPpR2OIxhHZvc1a34OC2264 AXQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WYaGnISu1YfOE/7UiWGOnu7UNyMRUmG6vqNEYiYQnuw=; b=tUixhB4BaaXSXiKsn+NiKFjlDVpgxidpzcGY4SC6jpNLQSITaHvgYlLU/yBhct4ZKK y/AkoXfHf+DFDPgbAi6nV6tvJGZxVDsHYoWNhE0gcvmL51H4sr1IbKimphu0TqyTaNcT MugTHXVjKPV3KBI8Dy0XmCjzgdYPOUIPReBym5bU0NNwFcNAMqsl0aVX3FCNV8/O8TOZ MppJfESDO+6xINqwuM+LBUiHt7SG/I9oEMa1cUanjs7JbUD+g7QYSWhh0w/2C7F2T+3r A0emKUlewr9vSYJMu3hpDPzx/FSKvNRMqNn3fH4fYhAu7NrfZI3rkT39si8ciN1c1Ldx ZeqQ== X-Gm-Message-State: AOAM5319UDdUvzCAUiJIg47d+eivf5FlUIGvzSAUbCvOi6KxVq7WRIoQ 9ewHvJ/TJ+rKt/Rd04Rihnw= X-Received: by 2002:a17:906:714d:: with SMTP id z13mr515845ejj.48.1623343236264; Thu, 10 Jun 2021 09:40:36 -0700 (PDT) Received: from yoga-910.localhost ([188.26.52.84]) by smtp.gmail.com with ESMTPSA id e22sm1657166edv.57.2021.06.10.09.40.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 09:40:35 -0700 (PDT) From: Ioana Ciornei To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap , calvin.johnson@nxp.com Cc: Cristi Sovaiala , Florin Laurentiu Chiculita , Madalin Bucur , linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Len Brown , "Rafael J . Wysocki" , Calvin Johnson , Ioana Ciornei Subject: [PATCH net-next v8 10/15] ACPI: utils: Introduce acpi_get_local_address() Date: Thu, 10 Jun 2021 19:39:12 +0300 Message-Id: <20210610163917.4138412-11-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210610163917.4138412-1-ciorneiioana@gmail.com> References: <20210610163917.4138412-1-ciorneiioana@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Calvin Johnson Introduce a wrapper around the _ADR evaluation. Signed-off-by: Calvin Johnson Reviewed-by: Andy Shevchenko Signed-off-by: Ioana Ciornei --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: - Replace fwnode_get_id() with acpi_get_local_address() Changes in v4: - Improve code structure to handle all cases Changes in v3: - Modified to retrieve reg property value for ACPI as well - Resolved compilation issue with CONFIG_ACPI = n - Added more info into documentation drivers/acpi/utils.c | 14 ++++++++++++++ include/linux/acpi.h | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 3b54b8fd7396..e7ddd281afff 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -277,6 +277,20 @@ acpi_evaluate_integer(acpi_handle handle, EXPORT_SYMBOL(acpi_evaluate_integer); +int acpi_get_local_address(acpi_handle handle, u32 *addr) +{ + unsigned long long adr; + acpi_status status; + + status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr); + if (ACPI_FAILURE(status)) + return -ENODATA; + + *addr = (u32)adr; + return 0; +} +EXPORT_SYMBOL(acpi_get_local_address); + acpi_status acpi_evaluate_reference(acpi_handle handle, acpi_string pathname, diff --git a/include/linux/acpi.h b/include/linux/acpi.h index c60745f657e9..6ace3a0f1415 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -710,6 +710,8 @@ static inline u64 acpi_arch_get_root_pointer(void) } #endif +int acpi_get_local_address(acpi_handle handle, u32 *addr); + #else /* !CONFIG_ACPI */ #define acpi_disabled 1 @@ -965,6 +967,11 @@ static inline struct acpi_device *acpi_resource_consumer(struct resource *res) return NULL; } +static inline int acpi_get_local_address(acpi_handle handle, u32 *addr) +{ + return -ENODEV; +} + #endif /* !CONFIG_ACPI */ #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC -- 2.31.1