[PATCH v3 28/28] sound: soc: soc-usb: Rediscover USB SND devices on USB port add

From: Wesley Cheng
Date: Wed Mar 08 2023 - 19:00:19 EST


In case the USB backend device has not been initialized/probed, USB SND
device connections can still occur. When the USB backend is eventually
made available, previous USB SND device connections are not communicated to
the USB backend. Call snd_usb_rediscover_devices() to generate the connect
callbacks for all USB SND devices connected. This will allow for the USB
backend to be updated with the current set of devices available.

Signed-off-by: Wesley Cheng <quic_wcheng@xxxxxxxxxxx>
---
sound/soc/soc-usb.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c
index 84dc6d0b2eab..a9413e3d18df 100644
--- a/sound/soc/soc-usb.c
+++ b/sound/soc/soc-usb.c
@@ -111,6 +111,8 @@ struct snd_soc_usb *snd_soc_usb_add_port(struct device *dev, void *priv,
list_add_tail(&usb->list, &usb_ctx_list);
mutex_unlock(&ctx_mutex);

+ snd_usb_rediscover_devices();
+
return usb;
}
EXPORT_SYMBOL_GPL(snd_soc_usb_add_port);