diff mbox series

[v3,3/5] media: ipu-bridge: Serialise calls to IPU bridge init

Message ID 20240214091754.399340-4-sakari.ailus@linux.intel.com
State Accepted
Commit bef852dcd5a16418856b69699484c7df6803917b
Headers show
Series IPU bridge improvements for IPU6 | expand

Commit Message

Sakari Ailus Feb. 14, 2024, 9:17 a.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;