Skip to content

Commit

Permalink
ALSA: usb-audio: scarlett2: Update get_config to do endian conversion
Browse files Browse the repository at this point in the history
For configuration items with a size of 16, scarlett2_usb_get_config()
was filling *buf with little-endian data. Update it to convert to CPU
endian. This function is not currently used so affects nothing yet;
will be used by the upcoming talkback feature.

Signed-off-by: Geoffrey D. Bennett <g@b4.vu>
Link: https://lore.kernel.org/r/cbc8b6eedd859dd27086ab4126d724a86dd50bcb.1624379707.git.g@b4.vu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Geoffrey D. Bennett authored and Takashi Iwai committed Jun 22, 2021
1 parent e914d84 commit ac34df7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sound/usb/mixer_scarlett_gen2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,13 @@ static int scarlett2_usb_get_config(
/* For byte-sized parameters, retrieve directly into buf */
if (config_item->size >= 8) {
size = config_item->size / 8 * count;
return scarlett2_usb_get(mixer, config_item->offset, buf, size);
err = scarlett2_usb_get(mixer, config_item->offset, buf, size);
if (err < 0)
return err;
if (size == 2)
for (i = 0; i < count; i++, (u16 *)buf++)
*(u16 *)buf = le16_to_cpu(*(__le16 *)buf);
return 0;
}

/* For bit-sized parameters, retrieve into value */
Expand Down

0 comments on commit ac34df7

Please sign in to comment.