[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YAr8PFRcR8gNZz95@smile.fi.intel.com>
Date: Fri, 22 Jan 2021 18:24:28 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Calvin Johnson <calvin.johnson@....nxp.com>
Cc: Grant Likely <grant.likely@....com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Jeremy Linton <jeremy.linton@....com>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Russell King - ARM Linux admin <linux@...linux.org.uk>,
Cristi Sovaiala <cristian.sovaiala@....com>,
Florin Laurentiu Chiculita <florinlaurentiu.chiculita@....com>,
Ioana Ciornei <ioana.ciornei@....com>,
Madalin Bucur <madalin.bucur@....nxp.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Marcin Wojtas <mw@...ihalf.com>,
Pieter Jansen Van Vuuren <pieter.jansenvv@...boosystems.io>,
Jon <jon@...id-run.com>, Saravana Kannan <saravanak@...gle.com>,
Randy Dunlap <rdunlap@...radead.org>, linux.cj@...il.com,
Diana Madalina Craciun <diana.craciun@....com>,
linux-acpi@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Laurentiu Tudor <laurentiu.tudor@....com>,
Bartosz Golaszewski <bgolaszewski@...libre.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>
Subject: Re: [net-next PATCH v4 09/15] device property: Introduce
fwnode_get_id()
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
Powered by blists - more mailing lists