Re: [PATCH 4/4] staging: greybus: audio: Ensure proper byte order

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

 



On Sat, Jan 14, 2017 at 11:17:07PM +0530, Vaibhav Agarwal wrote:
> @@ -656,13 +660,13 @@ static int gbaudio_tplg_create_enum_kctl(struct gbaudio_module_info *gb,
>  	gb_enum = &ctl->info.value.enumerated;
>  
>  	/* since count=1, and reg is dummy */
> -	gbe->max = gb_enum->items;
> +	gbe->max = le32_to_cpu(gb_enum->items);
>  	gbe->texts = gb_generate_enum_strings(gb, gb_enum);
>  
>  	/* debug enum info */
>  	dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gb_enum->items,

This is printing little endian max.  Just use gbe->max here.

> -		 gb_enum->names_length);
> -	for (i = 0; i < gb_enum->items; i++)
> +		 le16_to_cpu(gb_enum->names_length));
> +	for (i = 0; i < le32_to_cpu(gb_enum->items); i++)

And here as well probably?

>  		dev_dbg(gb->dev, "src[%d]: %s\n", i, gbe->texts[i]);
>  
>  	*kctl = (struct snd_kcontrol_new)
> @@ -691,7 +695,7 @@ static int gbaudio_tplg_create_kcontrol(struct gbaudio_module_info *gb,
>  			if (!ctldata)
>  				return -ENOMEM;
>  			ctldata->ctl_id = ctl->id;
> -			ctldata->data_cport = ctl->data_cport;
> +			ctldata->data_cport = le16_to_cpu(ctl->data_cport);
>  			ctldata->access = ctl->access;
>  			ctldata->vcount = ctl->count_values;
>  			ctldata->info = &ctl->info;
> @@ -865,12 +869,12 @@ static int gbaudio_tplg_create_enum_ctl(struct gbaudio_module_info *gb,
>  	gb_enum = &ctl->info.value.enumerated;
>  
>  	/* since count=1, and reg is dummy */
> -	gbe->max = gb_enum->items;
> +	gbe->max = le32_to_cpu(gb_enum->items);
>  	gbe->texts = gb_generate_enum_strings(gb, gb_enum);
>  
>  	/* debug enum info */
>  	dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gb_enum->items,

Same.

> -		 gb_enum->names_length);
> +		 le16_to_cpu(gb_enum->names_length));
>  	for (i = 0; i < gb_enum->items; i++)
                        ^^^^^^^^^^^^^^
This one needs to be converted as well, I think.

>  		dev_dbg(gb->dev, "src[%d]: %s\n", i, gbe->texts[i]);
>  

regards,
dan carpenter

_______________________________________________
greybus-dev mailing list
greybus-dev@xxxxxxxxxxxxxxxx
https://lists.linaro.org/mailman/listinfo/greybus-dev




[Index of Archives]     [Asterisk App Development]     [PJ SIP]     [Gnu Gatekeeper]     [IETF Sipping]     [Info Cyrus]     [ALSA User]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite News]     [Deep Creek Hot Springs]     [Yosemite Campsites]     [ISDN Cause Codes]     [Asterisk Books]

  Powered by Linux