summaryrefslogtreecommitdiffstats
path: root/drivers/base/property.c
diff options
context:
space:
mode:
authorDaniel Scally <djrscally@gmail.com>2021-01-07 14:28:26 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-01-26 19:21:34 +0100
commit5273382d03763277aaf8c6a2d6088e2afaee0cf0 (patch)
tree4215f43bb6fe0154f665400907d2ad6270f7600d /drivers/base/property.c
parentec9ded4fa864b1eeafb496902b014f5d5dd52994 (diff)
downloadlinux-5273382d03763277aaf8c6a2d6088e2afaee0cf0.tar.gz
linux-5273382d03763277aaf8c6a2d6088e2afaee0cf0.tar.bz2
linux-5273382d03763277aaf8c6a2d6088e2afaee0cf0.zip
media: device property: Return true in fwnode_device_is_available for NULL ops
Some types of fwnode_handle do not implement the device_is_available() check, such as those created by software_nodes. There isn't really a meaningful way to check for the availability of a device that doesn't actually exist, so if the check isn't implemented just assume that the "device" is present. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Daniel Scally <djrscally@gmail.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/base/property.c')
-rw-r--r--drivers/base/property.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 35b95c6ac0c6..0bf5260f14c6 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -837,9 +837,15 @@ EXPORT_SYMBOL_GPL(fwnode_handle_put);
/**
* fwnode_device_is_available - check if a device is available for use
* @fwnode: Pointer to the fwnode of the device.
+ *
+ * For fwnode node types that don't implement the .device_is_available()
+ * operation, this function returns true.
*/
bool fwnode_device_is_available(const struct fwnode_handle *fwnode)
{
+ if (!fwnode_has_op(fwnode, device_is_available))
+ return true;
+
return fwnode_call_bool_op(fwnode, device_is_available);
}
EXPORT_SYMBOL_GPL(fwnode_device_is_available);