Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp295363pxf; Thu, 11 Mar 2021 04:12:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNoiC7YKabCfQjEgSzVe2ldpxf46nf0jY9b8Yp3ABtvKhwb9NqTDZvvpjVht762XtZJt5H X-Received: by 2002:a17:906:eda3:: with SMTP id sa3mr2772400ejb.147.1615464772733; Thu, 11 Mar 2021 04:12:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615464772; cv=none; d=google.com; s=arc-20160816; b=PBOYOxT7tX/fOlTTiZAYvsoZkls5XrwBaB/DpZ5gUAgPvZZR4zZQUkyY/ji8F+sEfH B/bPbGXJQiJbDX650ousw2SoUSM+SjQO3FLH0KxzT0eZ4xXHEdCn8HNcOLMKLKkLJ/03 w1nDrvOHsOuFGz27jWp8FFpQaMa+WQuB5TM5Ks5onlU8onNZYn5V3MJNga3zZ1zJ95nw 8cZH4jV4r9hTbobezzXyTvoqRK0f5SDE+8tgRMN3lwGLs/z4hSAZGMeP8OGdRY4x0yHU c3YD8Vb1GkEfDHJDuQJYXwVPTBOHnHNGOrq8y1Xbfp1lRHJxJ6Dq1LaeheZm9dcjLepH FtFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=w69u9haWUp7YyyRifTBBdCO9AMFL3iKp2esRU3gVS/w=; b=JdumZGIm4b/gip2ebAq5BZ1AwAJgMH/2xbifAej0CgXUN9UAzyPSb9aDlTpl/SMKDx h82oFkJtqjTy1oP5kDQlCoy0gYWAvMZ9d9r/1MBeETeiB+JtAog+D8n4AJaQWAxVAFP6 PQ9apDWnbeLJqFvbtyw1WMoOZmR8teGMsRWnN+Uj+ZNaAMUWHEGzxsQ5gLLbyeEj/hkY K28z5ZyJvqxGe9Qv/AKlCo7+OUGzR+XCbiErwT/zKKUBdsxtsOmp76vBxeKqUbZF2ryV eQV+E7mPn+Ml4p6+i5bmrI9RpPTzXoFwDWvfJRbw41+NgxoRee+hwG2XUBBJOQzC9SbX rczQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Uzq1lJTQ; 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 kw15si1622589ejc.217.2021.03.11.04.12.29; Thu, 11 Mar 2021 04:12:52 -0800 (PST) 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=Uzq1lJTQ; 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 S232984AbhCKMLW (ORCPT + 99 others); Thu, 11 Mar 2021 07:11:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232781AbhCKMLK (ORCPT ); Thu, 11 Mar 2021 07:11:10 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBA7FC061574; Thu, 11 Mar 2021 04:11:09 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id 16so7126308pgo.13; Thu, 11 Mar 2021 04:11:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=w69u9haWUp7YyyRifTBBdCO9AMFL3iKp2esRU3gVS/w=; b=Uzq1lJTQHfliiP9ckv3avNMXf3O4PAJF/m/o25aGvNCDamWpxVXQI2c0kIZizBdeKm hcNZ88NTPFuexUtkXAAaT+8TqRoxmq8P9mUa+q0EXzHivpwAVQSiRiHoO3BwF2O0sRvc 4MUQwnCOSl2KNBur4T1OemCxhBtvDS1bKRNF3MnQK2fa+6ll/aW3wzLkwoMv9fA8y1tE jjhlfYPIh8PnAGTYbQlmznDUtpyanW5cbtpHnDGrtgbjuPUyoHpR1ayX7Z0T9iA0HdKL RuYzvDZd/sz7WOi1NL4NK5kJJP4GAfuVBsWvBo9zT25AaYGLZYplr9WkFxKhCUdNtpf5 fDYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=w69u9haWUp7YyyRifTBBdCO9AMFL3iKp2esRU3gVS/w=; b=Gx7tTfYMD+C4BX0iodI88Tgp/p5CIBu5Chdjoq5oSzYG1w7Tl/uYiLGunB77imabFc hyor5j/xxV9sLuL56u+cyRdxxBOg81S9RquyYTnFJVaXzL3ZdGkijBCEv/LRYHB2FQO1 PCgnR4UdCpBOj5Vr99D1mxTGbC+TqKrnR+sKpyL6kUu+GcCnffHy6JvAZ7wZ+GqvGm9L KKWFXNtCwCqrOK13Fi2VrMlIkYS/tbx5UyVtvqcw1jIOJCbXh7XdDMJkmuV8PhZVvMMO rTpfbuOPj1obrYel6SdWywwUww+bmYHFNfUjfZbVm6oO3o9z4Q9xLM+tnaW+lxqu1ZnF W8kg== X-Gm-Message-State: AOAM530sOA6wgkvJ5VGk54f929Ts1z0POsR2FZ9jEOlLkNrQqtY52mVL xnmMp/x5AUXDjypLMi5FO3hFJZ1nyubrk5qvPs0= X-Received: by 2002:a62:7c43:0:b029:1ef:20ce:ba36 with SMTP id x64-20020a627c430000b02901ef20ceba36mr7662587pfc.40.1615464669404; Thu, 11 Mar 2021 04:11:09 -0800 (PST) MIME-Version: 1.0 References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> <20210311062011.8054-11-calvin.johnson@oss.nxp.com> In-Reply-To: <20210311062011.8054-11-calvin.johnson@oss.nxp.com> From: Andy Shevchenko Date: Thu, 11 Mar 2021 14:10:53 +0200 Message-ID: Subject: Re: [net-next PATCH v7 10/16] ACPI: utils: Introduce acpi_get_local_address() To: Calvin Johnson Cc: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap , linux-arm Mailing List , Diana Madalina Craciun , ACPI Devel Maling List , Linux Kernel Mailing List , "linux.cj" , netdev , Laurentiu Tudor , Len Brown , "Rafael J. Wysocki" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 11, 2021 at 8:22 AM Calvin Johnson wrote: > > Introduce a wrapper around the _ADR evaluation. Reviewed-by: Andy Shevchenko > Signed-off-by: Calvin Johnson > --- > > 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 > > Changes in v2: None > > 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 682edd913b3b..41fe380a09a7 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 fcdaab723916..700f9fc303ab 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -706,6 +706,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 > @@ -953,6 +955,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.17.1 > -- With Best Regards, Andy Shevchenko