From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEAA7C48BE6 for ; Fri, 11 Jun 2021 10:58:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 82C8361246 for ; Fri, 11 Jun 2021 10:58:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82C8361246 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=02xVCBkAmzz/8bToSeuiaiRzXCaWNmhLXV1gW1aA7jw=; b=wqqP0aBJRMgs4+ Hw5joZ/3KdNscHr1XCs8JHGW6C1vEZacPWB/OLWsTrgtdZvXaP/ErEZcK9N3lW3UU+6GUw0ZBLxk2 3NKrNkz1Dgt1zatcZ6SvKI6VhC3Nu14QQG6Ggru039cM9+6zuJbfADjpXdQiwf/jJDiiC/PVp90Bp PocE+4yv4C5vXzvdTDBOoQot8OlNgU090c0mlsKibofvD+te6iRDDfBomP/FKInwQPNN7SANIXcWy egzSoMLk//T+RQYmNvLyKHq0AiDjHE+kdyv6aITadjgCnUj3lB+Ti6f3JmwWX3+MkBcpoen6UUHAu XoqbAOkYOanzd1ylM/1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lrepn-004pAv-7Y; Fri, 11 Jun 2021 10:56:19 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lreoj-004omV-3c for linux-arm-kernel@lists.infradead.org; Fri, 11 Jun 2021 10:55:15 +0000 Received: by mail-ej1-x62e.google.com with SMTP id g20so4005501ejt.0 for ; Fri, 11 Jun 2021 03:55:13 -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=nD0FvHmxOFRRWKT1YrUDX8wRFZH1BwQpKvwiKOY2Wm4=; b=benHG22ahSfVkYfxO/0xdrFr9jO2kZiyud+VZo9+gm5/n0T0iJ2QvFFWMS1UVRlEO6 J4JtrhdCn0VhxcThOECLR0XI71rW0vp5+N1xwMC/u0l/6LwgD//1bsvKN2RCPGWrzKHe /KTTxwJD8AC3SzPV/WzSSZw2+3lpuwlB/EMfVQeU4UGD4AnpJsvsV9m+l9GgaFEGxRPz VC8dwkD6jbhYDQKCUMqavXya+QgzRUFWt1OK8jyl6olZKADl9hKY0fH/Pkr1uH4ZpAyk XhYotwBdGyIeY2NpIcSghwBqJxiuiF7Ajafn/WwTsp2ctDCCGl66dAtZ/hOQsq/vddqc wSMQ== 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=nD0FvHmxOFRRWKT1YrUDX8wRFZH1BwQpKvwiKOY2Wm4=; b=tq4DTDPpyVLzhzWVwSeU+SFzv8bBC7o6Sfjj0lflsGaiRd7ibM8pIo522CKfGe2Hil 5e8GKij4IaL+H1+gSei9n+8xWExNy4mNahDi1a+a3Eua/r3o8MrPORFWSPNKLvh98JHY E9QNn8MyViCjEhxCzU4RBmKzM2pBTgX4qSQ5x3w8RiqQdG2ZC2ur75NR1n5a2mLioEKl 7N0p7U+JkLOzHAEqEG7Iuq/8vkvCPG6DxRjwuUKDEl7qOWibkMLKsN3bzJL/+B1Z8Kmv 951ZxxctygeVU4wMM3e35P5qFKtVujv7UHuAfbWK+kidq1OCl1VKOp/AX6DD/hyHbfYR Ouqg== X-Gm-Message-State: AOAM532asp6RlVyeMevMdMr9CMnHvj3ZiFVjpok059ZrraUxSCg2WclP +iqTLGaGFAWmaswkRUNRNWo= X-Google-Smtp-Source: ABdhPJw2/O82wbK7zKE8NB0q+0btIDMCmQPSgZ3WH5y7acwzCyJQOpi9+amaa4UTtBrYPVROxfDsLQ== X-Received: by 2002:a17:906:f192:: with SMTP id gs18mr3192101ejb.114.1623408911861; Fri, 11 Jun 2021 03:55:11 -0700 (PDT) Received: from yoga-910.localhost ([188.26.52.84]) by smtp.gmail.com with ESMTPSA id r19sm2492051eds.75.2021.06.11.03.55.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 03:55:11 -0700 (PDT) From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, hkallweit1@gmail.com, netdev@vger.kernel.org, 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@oss.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, Laurentiu Tudor , Len Brown , "Rafael J . Wysocki" , Ioana Ciornei Subject: [PATCH net-next v9 10/15] ACPI: utils: Introduce acpi_get_local_address() Date: Fri, 11 Jun 2021 13:53:56 +0300 Message-Id: <20210611105401.270673-11-ciorneiioana@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210611105401.270673-1-ciorneiioana@gmail.com> References: <20210611105401.270673-1-ciorneiioana@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210611_035513_187126_FC86BD01 X-CRM114-Status: GOOD ( 12.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Acked-by: Rafael J. Wysocki Acked-by: Grant Likely --- Changes in v9: None 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel