1 Aug
2024
1 Aug
'24
10:46 a.m.
+static int q6usb_get_offload_dev(struct snd_soc_component *component,
int card, int pcm, enum snd_soc_usb_kctl route)
+{
- struct q6usb_port_data *data = dev_get_drvdata(component->dev);
- struct snd_soc_usb_device *sdev;
- int ret = -1;
- mutex_lock(&data->mutex);
- if (list_empty(&data->devices))
goto out;
- sdev = list_last_entry(&data->devices, struct snd_soc_usb_device, list);
- if ((card == sdev->card_idx) && (pcm == sdev->pcm_idx)) {
if (route == SND_SOC_USB_KCTL_CARD_ROUTE)
ret = component->card->snd_card->number;
else if (route == SND_SOC_USB_KCTL_PCM_ROUTE)
ret = q6usb_get_pcm_id(component);
- }
+out:
- mutex_unlock(&data->mutex);
- return ret;
+}
well I obviously didn't get how this function worked until now, it's supposed to be call TWICE with a different argument.
Not sure it's really wise with the locking, why not get both in one shot?
Also how does this update the kcontrol value?