[RFC PATCH v3 7/9] ipu3-cio2: Check if pci_dev->dev's fwnode is a software_node in cio2_parse_firmware() and set FWNODE_GRAPH_DEVICE_DISABLED if so

From: Daniel Scally
Date: Mon Oct 19 2020 - 18:59:57 EST


fwnode_graph_get_endpoint_by_id() will optionally parse enabled devices
only; that status being determined through the .device_is_available() op
of the device's fwnode. As software_nodes don't have that operation and
adding it is meaningless, we instead need to check if the device's fwnode
is a software_node and if so pass the appropriate flag to disable that
check

Signed-off-by: Daniel Scally <djrscally@xxxxxxxxx>
---
Changes in v3:
- patch introduced

drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
index 4e598e937..f68ef0f6b 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
@@ -1466,6 +1466,7 @@ static const struct v4l2_async_notifier_operations cio2_async_ops = {

static int cio2_parse_firmware(struct cio2_device *cio2)
{
+ unsigned long allow_disabled;
unsigned int i;
int ret;

@@ -1474,11 +1475,15 @@ static int cio2_parse_firmware(struct cio2_device *cio2)
.bus_type = V4L2_MBUS_CSI2_DPHY
};
struct sensor_async_subdev *s_asd = NULL;
+ struct fwnode_handle *fwnode;
struct fwnode_handle *ep;

+ fwnode = dev_fwnode(&cio2->pci_dev->dev);
+ allow_disabled = is_software_node(fwnode) ? FWNODE_GRAPH_DEVICE_DISABLED : 0;
+
ep = fwnode_graph_get_endpoint_by_id(
- dev_fwnode(&cio2->pci_dev->dev), i, 0,
- FWNODE_GRAPH_ENDPOINT_NEXT);
+ fwnode, i, 0,
+ FWNODE_GRAPH_ENDPOINT_NEXT | allow_disabled);

if (!ep)
continue;
--
2.17.1