diff mbox

[v4,4/4] ALSA: usb-audio: UAC3: Parse Input Terminal number of channels.

Message ID 20180511152537.32267-5-jorge.sanjuan@codethink.co.uk
State New, archived
Headers show

Commit Message

Jorge Sanjuan May 11, 2018, 3:25 p.m. UTC
Obtain the number of channels for the Input Terminal from the
Logical Cluster Descriptor. This achieves a useful minimal parsing
of this unit so it can be used in other units in the topology.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
---
 sound/usb/mixer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jorge Sanjuan May 14, 2018, 8:54 a.m. UTC | #1
On 11/05/18 16:25, Jorge Sanjuan wrote:
> Obtain the number of channels for the Input Terminal from the
> Logical Cluster Descriptor. This achieves a useful minimal parsing
> of this unit so it can be used in other units in the topology.
> 
> Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
> ---
>   sound/usb/mixer.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> index 431f3c319839..19b25fbc7437 100644
> --- a/sound/usb/mixer.c
> +++ b/sound/usb/mixer.c
> @@ -903,9 +903,9 @@ static int check_input_term(struct mixer_build *state, int id,
>   				 * recursion calls */
>   				term->id = id;
>   				term->type = le16_to_cpu(d->wTerminalType);
> +				term->channels = get_cluster_channels_v3(state, d->wClusterDescrID);


Sorry about this. I just spotted that I should have used the helper 
function I added to access d->wClusterDescrID 
`uac3_mixer_unit_wClusterDescrID`.

I got the sparse warning for the endianess and realized that. I'll 
resend this one patch.

>   
> -				/* REVISIT: UAC3 IT doesn't have channels/cfg */
> -				term->channels = 0;
> +				/* REVISIT: UAC3 IT doesn't have channels cfg */
>   				term->chconfig = 0;
>   
>   				term->name = le16_to_cpu(d->wTerminalDescrStr);
>
Ruslan Bilovol May 14, 2018, 9:36 a.m. UTC | #2
On Mon, May 14, 2018 at 11:54 AM, Jorge <jorge.sanjuan@codethink.co.uk> wrote:
>
>
> On 11/05/18 16:25, Jorge Sanjuan wrote:
>>
>> Obtain the number of channels for the Input Terminal from the
>> Logical Cluster Descriptor. This achieves a useful minimal parsing
>> of this unit so it can be used in other units in the topology.
>>
>> Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
>> ---
>>   sound/usb/mixer.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
>> index 431f3c319839..19b25fbc7437 100644
>> --- a/sound/usb/mixer.c
>> +++ b/sound/usb/mixer.c
>> @@ -903,9 +903,9 @@ static int check_input_term(struct mixer_build *state,
>> int id,
>>                                  * recursion calls */
>>                                 term->id = id;
>>                                 term->type =
>> le16_to_cpu(d->wTerminalType);
>> +                               term->channels =
>> get_cluster_channels_v3(state, d->wClusterDescrID);
>
>
>
> Sorry about this. I just spotted that I should have used the helper function
> I added to access d->wClusterDescrID `uac3_mixer_unit_wClusterDescrID`.
>
> I got the sparse warning for the endianess and realized that. I'll resend
> this one patch.

While here, please add checking output of get_cluster_channels_v3() as
it can return negative errno.

BTW, I've just tested your Mixer patches and this is the only comment I have
so far.

Thanks,
Ruslan

>
>>   -                             /* REVISIT: UAC3 IT doesn't have
>> channels/cfg */
>> -                               term->channels = 0;
>> +                               /* REVISIT: UAC3 IT doesn't have channels
>> cfg */
>>                                 term->chconfig = 0;
>>                                 term->name =
>> le16_to_cpu(d->wTerminalDescrStr);
>>
>
diff mbox

Patch

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 431f3c319839..19b25fbc7437 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -903,9 +903,9 @@  static int check_input_term(struct mixer_build *state, int id,
 				 * recursion calls */
 				term->id = id;
 				term->type = le16_to_cpu(d->wTerminalType);
+				term->channels = get_cluster_channels_v3(state, d->wClusterDescrID);
 
-				/* REVISIT: UAC3 IT doesn't have channels/cfg */
-				term->channels = 0;
+				/* REVISIT: UAC3 IT doesn't have channels cfg */
 				term->chconfig = 0;
 
 				term->name = le16_to_cpu(d->wTerminalDescrStr);