Thread (38 messages) 38 messages, 5 authors, 2021-01-22

Re: [net-next PATCH v3 09/15] device property: Introduce fwnode_get_id()

From: "Rafael J. Wysocki" <rafael@kernel.org>
Date: 2021-01-20 19:17:40
Also in: linux-acpi, linux-arm-kernel, lkml

On Wed, Jan 20, 2021 at 7:51 PM Andy Shevchenko
[off-list ref] wrote:
On Wed, Jan 20, 2021 at 8:18 PM Rafael J. Wysocki [off-list ref] wrote:
quoted
On Tue, Jan 12, 2021 at 7:02 PM Andy Shevchenko
[off-list ref] wrote:
quoted
On Tue, Jan 12, 2021 at 09:30:31AM -0800, Saravana Kannan wrote:
quoted
On Tue, Jan 12, 2021 at 5:42 AM Calvin Johnson
[off-list ref] wrote:
...
quoted
quoted
quoted
quoted
+       ret = fwnode_property_read_u32(fwnode, "reg", id);
+       if (!(ret && is_acpi_node(fwnode)))
+               return ret;
+
+#ifdef CONFIG_ACPI
+       status = acpi_evaluate_integer(ACPI_HANDLE_FWNODE(fwnode),
+                                      METHOD_NAME__ADR, NULL, &adr);
+       if (ACPI_FAILURE(status))
+               return -EINVAL;
+       *id = (u32)adr;
+#endif
+       return 0;
quoted
quoted
quoted
Also ACPI and DT
aren't mutually exclusive if I'm not mistaken.
That's why we try 'reg' property for both cases first.

is_acpi_fwnode() conditional is that what I don't like though.
I'm not sure what you mean here, care to elaborate?
I meant is_acpi_node(fwnode) in the conditional.

I think it's redundant and we can simple do something like this:

  if (ret) {
#ifdef ACPI
    ...
#else
    return ret;
#endif
  }
  return 0;

--
Right, that should work.  And I'd prefer it too.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help