diff mbox series

[v2,3/4] media: ipu-bridge: Serialise calls to IPU bridge init

Message ID 20240213130815.382792-4-sakari.ailus@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series IPU bridge improvements for IPU6 | expand

Commit Message

Sakari Ailus Feb. 13, 2024, 1:08 p.m. UTC
The IPU bridge initialisation will be called from multiple locations in
the future. Serialise the access to devices' fwnodes in this context.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/pci/intel/ipu-bridge.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c
index 735c62c37c22..e994db4f4d91 100644
--- a/drivers/media/pci/intel/ipu-bridge.c
+++ b/drivers/media/pci/intel/ipu-bridge.c
@@ -766,6 +766,8 @@  static int ipu_bridge_check_fwnode_graph(struct fwnode_handle *fwnode)
 	return ipu_bridge_check_fwnode_graph(fwnode->secondary);
 }
 
+static DEFINE_MUTEX(ipu_bridge_mutex);
+
 int ipu_bridge_init(struct device *dev,
 		    ipu_parse_sensor_fwnode_t parse_sensor_fwnode)
 {
@@ -774,6 +776,8 @@  int ipu_bridge_init(struct device *dev,
 	unsigned int i;
 	int ret;
 
+	guard(mutex)(&ipu_bridge_mutex);
+
 	if (!ipu_bridge_check_fwnode_graph(dev_fwnode(dev)))
 		return 0;