devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: rafael-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: [RFC 4/5] ACPI: align acpi_fwnode_get_reference_args with OF counterpart
Date: Thu, 14 Sep 2017 15:29:13 +0300	[thread overview]
Message-ID: <20170914122914.14122-5-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <20170914122914.14122-1-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

acpi_fwnode_get_reference_args currently returns -EINVAL if a property
isn't found. -EINVAL is returned on parse error as well, and a
non-existent property is, for a list of references with arguments, usually
effectively the same as a property without entries.

Thus use -ENODATA to signal this as well. -EINVAL is still used to tell
about parse errors.

Signed-off-by: Sakari Ailus <sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/acpi/property.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index c1c216163de3..c6c777341023 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1211,6 +1211,9 @@ acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
 	unsigned int i;
 	int ret;
 
+	if (acpi_node_prop_get(fwnode, prop, NULL))
+		return -ENODATA;
+
 	ret = __acpi_node_get_property_reference(fwnode, prop, index,
 						 args_count, &acpi_args);
 	if (ret < 0)
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-09-14 12:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14 12:29 [RFC 0/5] Align and document return values of phandle and reference parsing for OF and ACPI Sakari Ailus
2017-09-14 12:29 ` [RFC 2/5] of: Return -ENODATA on accessing out of bounds indices in phandle parsing Sakari Ailus
2017-09-14 12:29 ` [RFC 3/5] of: Return total number of entries in of_count_phandle_with_args Sakari Ailus
     [not found] ` <20170914122914.14122-1-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-14 12:29   ` [RFC 1/5] clk: Increment assigned-clocks index for empty phandles Sakari Ailus
2017-09-14 12:29   ` Sakari Ailus [this message]
2017-09-14 12:29   ` [RFC 5/5] device property: Document fwnode_property_get_reference_args better Sakari Ailus
2017-09-15 19:57 ` [RFC 0/5] Align and document return values of phandle and reference parsing for OF and ACPI Rob Herring
2017-09-19 23:01   ` Sakari Ailus
2017-09-26  9:02     ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170914122914.14122-5-sakari.ailus@linux.intel.com \
    --to=sakari.ailus-vuqaysv1563yd54fqh9/ca@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=rafael-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).