Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1158882pxb; Fri, 22 Jan 2021 08:30:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSf2LwDPHMSsoUmlY4rACWiJOUaErMbIsSwU/pUgoYdxPVwzeGvQurRvukEEI6l4hP9Erx X-Received: by 2002:a05:6402:2707:: with SMTP id y7mr3699447edd.5.1611333016202; Fri, 22 Jan 2021 08:30:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611333016; cv=none; d=google.com; s=arc-20160816; b=Y458pZlIYcxNeXNFpvZGsGHJ4myCFW13rthXsXXMoNTX/zSXt+xC4qRpo7/OpBfh6C FZ6w8lsqn84CF9LKoFZLUDV2lKhbBQiwdapBMoK92gpPn4Dml7It2mz0H4c+JKDJ1VqL afwPEnfkSOQch2Nn8ecS0OOq3gkapCi7H2gGaOt6M8zzFnEURdjMbw8kcqfeVZUYj1ym b1e9lZT3dTv62k70C57+IfNiMFtxAMK3IGfHBZEjbbtTReIahcqyNfs35fPNsmeRsEFC uOQq3HH+G+zFUl8yrFUmjY6RiSOqBxgQcvHeaPtZllXXQoOYdyh20fUTzEkximnUFbql MvEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=sXOXFWBI7tp75sqvhlA6+uWB8MbwUWq04R8ZrYJnKss=; b=IejlrqiP3/Qnwwsl1wkU5qImZINADDXcHIXTpx87q2gLaTycD5S8eX5rl9qy3TtZrL cPkqTmgbXehThEK2OXrYXJCfpXiNABpixdFBrsD5/JiiJSJRS3QyNOMdfn/IWT/efNf7 /KzpSgU4oCcgJ1Vd3zK0W0XvTQ3vmBnmNKYEde66g2Fry/y8GJWqHWMPoWyXcjAQREnI ZSi95tFrhh8+DV9O5tBeQPt6AopkrbsrU/q7R98gc52ALPNCiPTkNSWw2Go5mEbdWhqa iOptXVOlZZ0OQlmQ7zEZPFDBDwkwu4WUD0gEEwZ05kBXyis4fzfT3ue2DtIJBHBKRfZq qUKA== 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; dmarc=fail (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 q19si3732538edv.94.2021.01.22.08.29.51; Fri, 22 Jan 2021 08:30:16 -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; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729656AbhAVQ1L (ORCPT + 99 others); Fri, 22 Jan 2021 11:27:11 -0500 Received: from mga12.intel.com ([192.55.52.136]:40752 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729375AbhAVQYN (ORCPT ); Fri, 22 Jan 2021 11:24:13 -0500 IronPort-SDR: OqFOsM55xEFkAnDjVFuulwUhNk8aSw33ialNwX/GtkjcExfdunTE1bmfp5iFI65wu/7XXO8Vz5 VlWNWIYzFNsQ== X-IronPort-AV: E=McAfee;i="6000,8403,9872"; a="158647360" X-IronPort-AV: E=Sophos;i="5.79,367,1602572400"; d="scan'208";a="158647360" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2021 08:23:32 -0800 IronPort-SDR: zH6cmzMCzs2f3MLaQCT+ofDfO04zG8dDAVZwC3WO5cL9ERgr1FmFxFEg2RiK8Guzp2ejipaZNP jJv9ZIW3dCKQ== X-IronPort-AV: E=Sophos;i="5.79,367,1602572400"; d="scan'208";a="400719709" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2021 08:23:27 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1l2zEa-0097Gd-FZ; Fri, 22 Jan 2021 18:24:28 +0200 Date: Fri, 22 Jan 2021 18:24:28 +0200 From: Andy Shevchenko 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.cj@gmail.com, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Laurentiu Tudor , Bartosz Golaszewski , Greg Kroah-Hartman , Kieran Bingham , Laurent Pinchart Subject: Re: [net-next PATCH v4 09/15] device property: Introduce fwnode_get_id() Message-ID: References: <20210122154300.7628-1-calvin.johnson@oss.nxp.com> <20210122154300.7628-10-calvin.johnson@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210122154300.7628-10-calvin.johnson@oss.nxp.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 22, 2021 at 09:12:54PM +0530, Calvin Johnson wrote: > Using fwnode_get_id(), get the reg property value for DT node > or get the _ADR object value for ACPI node. ... > +/** > + * fwnode_get_id - Get the id of a fwnode. > + * @fwnode: firmware node > + * @id: id of the fwnode > + * > + * This function provides the id of a fwnode which can be either > + * DT or ACPI node. For ACPI, "reg" property value, if present will > + * be provided or else _ADR value will be provided. > + * Returns 0 on success or a negative errno. > + */ > +int fwnode_get_id(struct fwnode_handle *fwnode, u32 *id) > +{ > +#ifdef CONFIG_ACPI > + unsigned long long adr; > + acpi_status status; > +#endif Instead you may do... > + int ret; > + > + ret = fwnode_property_read_u32(fwnode, "reg", id); > + if (ret) { > +#ifdef CONFIG_ACPI ...it here like unsigned long long adr; acpi_status status; > + status = acpi_evaluate_integer(ACPI_HANDLE_FWNODE(fwnode), > + METHOD_NAME__ADR, NULL, &adr); > + if (ACPI_FAILURE(status)) > + return -EINVAL; > + *id = (u32)adr; > +#else > + return ret; > +#endif > + } > + return 0; > +} -- With Best Regards, Andy Shevchenko