Re: [PATCH v4 4/7] soundwire: Handle multiple master instances in a stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




  /**
@@ -918,13 +951,22 @@ static void sdw_release_master_stream(struct sdw_stream_runtime *stream)
  int sdw_stream_remove_master(struct sdw_bus *bus,
  		struct sdw_stream_runtime *stream)
  {
+	struct sdw_master_runtime *m_rt, *_m_rt;
+
  	mutex_lock(&bus->bus_lock);
- sdw_release_master_stream(stream);
-	sdw_master_port_release(bus, stream->m_rt);
-	stream->state = SDW_STREAM_RELEASED;
-	kfree(stream->m_rt);
-	stream->m_rt = NULL;
+	list_for_each_entry_safe(m_rt, _m_rt,
+			&stream->master_list, stream_node) {
+
+		if (m_rt->bus != bus)
+			continue;
+
+		sdw_master_port_release(bus, m_rt);
+		sdw_release_master_stream(m_rt, stream);
+	}
+
+	if (list_empty(&stream->master_list))
+		stream->state = SDW_STREAM_RELEASED;
When a master is removed, there is an explicit test to make sure the stream state changes when there are no masters left in the list, but...

mutex_unlock(&bus->bus_lock); @@ -1127,7 +1169,7 @@ int sdw_stream_add_master(struct sdw_bus *bus,
  	stream->state = SDW_STREAM_CONFIGURED;
... it's not symmetrical for the add_master case. The stream state changes on the first added master. In addition the stream state changes both when a slave is added and a master is added. Is this intentional or not - and are there side effects resulting from this inconsistency?

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux