summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@linux.intel.com>2017-06-06 12:37:39 +0300
committerTao Huang <huangtao@rock-chips.com>2017-11-27 14:12:20 +0800
commitfe88941ff6cd5bcae20b05697c20b3fea269744f (patch)
tree72b395c95109cde2a7cbf01a6be5d8ab287c7aac /drivers/acpi
parent339a6f76b037acd4e1a9697ef3d18565d1cdf75b (diff)
UPSTREAM: device property: Introduce fwnode_device_is_available()
Add fwnode_device_is_available() to tell whether the device corresponding to a certain fwnode_handle is available for use. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit 2294b3af05e9b3fe0b84a78971e709037bd7593c) Signed-off-by: Brian J Lovin <brian.j.lovin@intel.com> Signed-off-by: Marc Herbert <marc.herbert@intel.com> Conflicts: include/linux/property.h (purely contextual; dev_fwnode() was added by I41bf4db9d04eeb91) BUG=b:64133998 TEST=media device topology shows subdevs registered successfully TEST=no camera regression Change-Id: I0cd566e2d1cbadbb2fdfe99592fe8ae1ab5589d5 Reviewed-on: https://chromium-review.googlesource.com/693678 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/property.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index a24ca61294eb..917c789f953d 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1121,6 +1121,14 @@ int acpi_graph_get_remote_endpoint(struct fwnode_handle *fwnode,
return 0;
}
+static bool acpi_fwnode_device_is_available(struct fwnode_handle *fwnode)
+{
+ if (!is_acpi_device_node(fwnode))
+ return false;
+
+ return acpi_device_is_present(to_acpi_device_node(fwnode));
+}
+
static bool acpi_fwnode_property_present(struct fwnode_handle *fwnode,
const char *propname)
{
@@ -1216,6 +1224,7 @@ static int acpi_fwnode_graph_parse_endpoint(struct fwnode_handle *fwnode,
}
const struct fwnode_operations acpi_fwnode_ops = {
+ .device_is_available = acpi_fwnode_device_is_available,
.property_present = acpi_fwnode_property_present,
.property_read_int_array = acpi_fwnode_property_read_int_array,
.property_read_string_array = acpi_fwnode_property_read_string_array,