diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2017-09-26 05:08:27 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-10-11 15:15:44 -0400 |
commit | c343bc2ce2c627b6cef2b09794a4a5b63419a798 (patch) | |
tree | 49636b7f7c4f3e6dc9ff4be45a1516fac57fecd5 | |
parent | 5ab894aee0f171a682bcd90dd5d1930cb53c55dc (diff) |
ACPI: properties: Align return codes of __acpi_node_get_property_reference()
acpi_fwnode_get_reference_args(), the function implementing ACPI
support for fwnode_property_get_reference_args(), returns directly
error codes from __acpi_node_get_property_reference(). The latter
uses different error codes than the OF implementation. In particular,
the OF implementation uses -ENOENT to indicate that the property is
not found, a reference entry is empty and there are no more
references.
Document and align the error codes for property for
fwnode_property_get_reference_args() so that they match with
of_parse_phandle_with_args().
Fixes: 3e3119d3088f (device property: Introduce fwnode_property_get_reference_args)
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/property.c | 19 | ||||
-rw-r--r-- | drivers/base/property.c | 4 |
2 files changed, 13 insertions, 10 deletions
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 3fb8ff513461..5a8ac5e1081b 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c | |||
@@ -571,10 +571,9 @@ static int acpi_data_get_property_array(const struct acpi_device_data *data, | |||
571 | * } | 571 | * } |
572 | * } | 572 | * } |
573 | * | 573 | * |
574 | * Calling this function with index %2 return %-ENOENT and with index %3 | 574 | * Calling this function with index %2 or index %3 return %-ENOENT. If the |
575 | * returns the last entry. If the property does not contain any more values | 575 | * property does not contain any more values %-ENOENT is returned. The NULL |
576 | * %-ENODATA is returned. The NULL entry must be single integer and | 576 | * entry must be single integer and preferably contain value %0. |
577 | * preferably contain value %0. | ||
578 | * | 577 | * |
579 | * Return: %0 on success, negative error code on failure. | 578 | * Return: %0 on success, negative error code on failure. |
580 | */ | 579 | */ |
@@ -590,7 +589,7 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, | |||
590 | 589 | ||
591 | data = acpi_device_data_of_node(fwnode); | 590 | data = acpi_device_data_of_node(fwnode); |
592 | if (!data) | 591 | if (!data) |
593 | return -EINVAL; | 592 | return -ENOENT; |
594 | 593 | ||
595 | ret = acpi_data_get_property(data, propname, ACPI_TYPE_ANY, &obj); | 594 | ret = acpi_data_get_property(data, propname, ACPI_TYPE_ANY, &obj); |
596 | if (ret) | 595 | if (ret) |
@@ -635,7 +634,7 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, | |||
635 | ret = acpi_bus_get_device(element->reference.handle, | 634 | ret = acpi_bus_get_device(element->reference.handle, |
636 | &device); | 635 | &device); |
637 | if (ret) | 636 | if (ret) |
638 | return -ENODEV; | 637 | return -EINVAL; |
639 | 638 | ||
640 | nargs = 0; | 639 | nargs = 0; |
641 | element++; | 640 | element++; |
@@ -649,11 +648,11 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, | |||
649 | else if (type == ACPI_TYPE_LOCAL_REFERENCE) | 648 | else if (type == ACPI_TYPE_LOCAL_REFERENCE) |
650 | break; | 649 | break; |
651 | else | 650 | else |
652 | return -EPROTO; | 651 | return -EINVAL; |
653 | } | 652 | } |
654 | 653 | ||
655 | if (nargs > MAX_ACPI_REFERENCE_ARGS) | 654 | if (nargs > MAX_ACPI_REFERENCE_ARGS) |
656 | return -EPROTO; | 655 | return -EINVAL; |
657 | 656 | ||
658 | if (idx == index) { | 657 | if (idx == index) { |
659 | args->adev = device; | 658 | args->adev = device; |
@@ -670,13 +669,13 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, | |||
670 | return -ENOENT; | 669 | return -ENOENT; |
671 | element++; | 670 | element++; |
672 | } else { | 671 | } else { |
673 | return -EPROTO; | 672 | return -EINVAL; |
674 | } | 673 | } |
675 | 674 | ||
676 | idx++; | 675 | idx++; |
677 | } | 676 | } |
678 | 677 | ||
679 | return -ENODATA; | 678 | return -ENOENT; |
680 | } | 679 | } |
681 | EXPORT_SYMBOL_GPL(__acpi_node_get_property_reference); | 680 | EXPORT_SYMBOL_GPL(__acpi_node_get_property_reference); |
682 | 681 | ||
diff --git a/drivers/base/property.c b/drivers/base/property.c index 21fcc13013a5..7ed99c1b2a8b 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c | |||
@@ -683,6 +683,10 @@ EXPORT_SYMBOL_GPL(fwnode_property_match_string); | |||
683 | * Caller is responsible to call fwnode_handle_put() on the returned | 683 | * Caller is responsible to call fwnode_handle_put() on the returned |
684 | * args->fwnode pointer. | 684 | * args->fwnode pointer. |
685 | * | 685 | * |
686 | * Returns: %0 on success | ||
687 | * %-ENOENT when the index is out of bounds, the index has an empty | ||
688 | * reference or the property was not found | ||
689 | * %-EINVAL on parse error | ||
686 | */ | 690 | */ |
687 | int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, | 691 | int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, |
688 | const char *prop, const char *nargs_prop, | 692 | const char *prop, const char *nargs_prop, |