Re: [PATCH v24 19/34] ASoC: qcom: qdsp6: Fetch USB offload mapped card and PCM device

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

 




> +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?




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux