[PATCH 6.18 166/752] ALSA: usb-audio: presonus s18xx uses little-endian

Sasha Levin
2026-02-28T17:50:28Z

From: fenugrec <fenugrec@mail.com>

[ Upstream commit 3ce03297baff0ba116769044e4594fb324d4a551 ]

Use __le32 types for USB control transfers

Signed-off-by: fenugrec <fenugrec@mail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260111-preso_clean1-v2-1-44b4e5129a75@mail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/usb/mixer_s1810c.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/sound/usb/mixer_s1810c.c b/sound/usb/mixer_s1810c.c
index 6e09e074c0e7f..93510aa0dc5ef 100644
--- a/sound/usb/mixer_s1810c.c
+++ b/sound/usb/mixer_s1810c.c
@@ -82,13 +82,13 @@
* mixer and output but a different set for device.
*/
struct s1810c_ctl_packet {
- u32 a;
- u32 b;
- u32 fixed1;
- u32 fixed2;
- u32 c;
- u32 d;
- u32 e;
+ __le32 a;
+ __le32 b;
+ __le32 fixed1;
+ __le32 fixed2;
+ __le32 c;
+ __le32 d;
+ __le32 e;
};

#define SC1810C_CTL_LINE_SW 0
@@ -118,7 +118,7 @@ struct s1810c_ctl_packet {
* being zero and different f1/f2.
*/
struct s1810c_state_packet {
- u32 fields[63];
+ __le32 fields[63];
};

#define SC1810C_STATE_48V_SW 58
@@ -140,14 +140,14 @@ snd_s1810c_send_ctl_packet(struct usb_device *dev, u32 a,
struct s1810c_ctl_packet pkt = { 0 };
int ret = 0;

- pkt.fixed1 = SC1810C_CMD_F1;
- pkt.fixed2 = SC1810C_CMD_F2;
+ pkt.fixed1 = __cpu_to_le32(SC1810C_CMD_F1);
+ pkt.fixed2 = __cpu_to_le32(SC1810C_CMD_F2);

- pkt.a = a;
- pkt.b = b;
- pkt.c = c;
- pkt.d = d;
- pkt.e = e;
+ pkt.a = __cpu_to_le32(a);
+ pkt.b = __cpu_to_le32(b);
+ pkt.c = __cpu_to_le32(c);
+ pkt.d = __cpu_to_le32(d);
+ pkt.e = __cpu_to_le32(e);

ret = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
SC1810C_CMD_REQ,
@@ -176,8 +176,8 @@ snd_sc1810c_get_status_field(struct usb_device *dev,
struct s1810c_state_packet pkt_in = { { 0 } };
int ret = 0;

- pkt_out.fields[SC1810C_STATE_F1_IDX] = SC1810C_SET_STATE_F1;
- pkt_out.fields[SC1810C_STATE_F2_IDX] = SC1810C_SET_STATE_F2;
+ pkt_out.fields[SC1810C_STATE_F1_IDX] = __cpu_to_le32(SC1810C_SET_STATE_F1);
+ pkt_out.fields[SC1810C_STATE_F2_IDX] = __cpu_to_le32(SC1810C_SET_STATE_F2);
ret = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
SC1810C_SET_STATE_REQ,
SC1810C_SET_STATE_REQTYPE,
@@ -197,7 +197,7 @@ snd_sc1810c_get_status_field(struct usb_device *dev,
return ret;
}

- (*field) = pkt_in.fields[field_idx];
+ (*field) = __le32_to_cpu(pkt_in.fields[field_idx]);
(*seqnum)++;
return 0;
}
--
2.51.0