ASoC: SOF: sof-client: Use event-handler mutex consistently#5803
Open
ujfalusi wants to merge 1 commit into
Open
ASoC: SOF: sof-client: Use event-handler mutex consistently#5803ujfalusi wants to merge 1 commit into
ujfalusi wants to merge 1 commit into
Conversation
Protect IPC RX and FW state handler list unregister/dispatch paths with client_event_handler_mutex to match list registration and locking comments. Fixes: 5c19da3 ("ASoC: SOF: Use guard()/scoped_guard() for mutex locks where it makes sense") Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
There was a problem hiding this comment.
Pull request overview
This PR aligns locking for SOF client event handler lists by using client_event_handler_mutex consistently across register/unregister and dispatch paths, matching the intent documented for protecting the handler lists.
Changes:
- Switch IPC RX handler unregistration to use
client_event_handler_mutex. - Switch FW state handler dispatch and unregistration to use
client_event_handler_mutex.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
612
to
616
| struct snd_sof_dev *sdev = sof_client_dev_to_sof_dev(cdev); | ||
| struct sof_ipc_event_entry *event; | ||
|
|
||
| guard(mutex)(&sdev->ipc_client_mutex); | ||
| guard(mutex)(&sdev->client_event_handler_mutex); | ||
|
|
Member
There was a problem hiding this comment.
@ujfalusi seems valid. Fwiw not sure if this matters today, but this also made me think about the pcm and kcontrol using different locks since they are async, eventually a sof client could hold either pcm/kcontrol lock.
Comment on lines
+632
to
635
| guard(mutex)(&sdev->client_event_handler_mutex); | ||
|
|
||
| list_for_each_entry(event, &sdev->fw_state_handler_list, list) | ||
| event->callback(event->cdev, sdev->fw_state); |
jsarha
approved these changes
Jun 8, 2026
jsarha
left a comment
There was a problem hiding this comment.
Reading the sof_client.c through, the change looks correct and necessary.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Protect IPC RX and FW state handler list unregister/dispatch paths with client_event_handler_mutex to match list registration and locking comments.
Fixes: 5c19da3 ("ASoC: SOF: Use guard()/scoped_guard() for mutex locks where it makes sense")