Re: [PATCH v2 04/13] ALSA: dice: cache stream formats at current mode of sampling transmission frequency

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

 



On Sun, 29 Apr 2018 08:50:23 +0200,
Takashi Sakamoto wrote:
> 
> In former commits, proxy structure get members for cache of stream
> formats. This commit fills the cache with stream formats at current mode
> of sampling transmission frequency.
> 
> Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
> ---
>  sound/firewire/dice/dice-stream.c | 76 +++++++++++++++++++++++++++++++++++++++
>  sound/firewire/dice/dice.c        |  4 +++
>  sound/firewire/dice/dice.h        |  3 ++
>  3 files changed, 83 insertions(+)
> 
> diff --git a/sound/firewire/dice/dice-stream.c b/sound/firewire/dice/dice-stream.c
> index 928a255bfc35..2a9f0cd994a5 100644
> --- a/sound/firewire/dice/dice-stream.c
> +++ b/sound/firewire/dice/dice-stream.c
> @@ -30,6 +30,24 @@ const unsigned int snd_dice_rates[SND_DICE_RATES_COUNT] = {
>  	[6] = 192000,
>  };
>  
> +int snd_dice_stream_get_rate_mode(struct snd_dice *dice, unsigned int rate,
> +				  unsigned int *mode)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(snd_dice_rates); i++) {
> +		if (!(dice->clock_caps & BIT(i)))
> +			continue;
> +		if (snd_dice_rates[i] != rate)
> +			continue;
> +
> +		*mode = (i - 1) / 2;

What if i=0?  It'll be a negative value?


thanks,

Takashi
_______________________________________________
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