git: 5c3bc8ab427c - main - snd_uaudio: Use uDWord for the UAC2 sample rate

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Fri, 21 Aug 2026 14:02:28 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=5c3bc8ab427c8624b29cd9ac9265445002da3ba8

commit 5c3bc8ab427c8624b29cd9ac9265445002da3ba8
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-08-21 14:02:19 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-08-21 14:02:19 +0000

    snd_uaudio: Use uDWord for the UAC2 sample rate
    
    uaudio20_set_speed() split the sample rate into bytes by hand. Use
    uDWord and USETDW() instead.
    
    No functional change intended.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D59066
---
 sys/dev/sound/usb/uaudio.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index 7c01051b7af1..f12fc1ede541 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -5419,7 +5419,7 @@ uaudio20_set_speed(struct usb_device *udev, uint8_t iface_no,
     uint8_t clockid, uint32_t speed)
 {
 	struct usb_device_request req;
-	uint8_t data[4];
+	uDWord data;
 
 	DPRINTFN(6, "ifaceno=%d clockid=%d speed=%u\n",
 	    iface_no, clockid, speed);
@@ -5428,11 +5428,8 @@ uaudio20_set_speed(struct usb_device *udev, uint8_t iface_no,
 	req.bRequest = UA20_CS_CUR;
 	USETW2(req.wValue, UA20_CS_SAM_FREQ_CONTROL, 0);
 	USETW2(req.wIndex, clockid, iface_no);
-	USETW(req.wLength, 4);
-	data[0] = speed;
-	data[1] = speed >> 8;
-	data[2] = speed >> 16;
-	data[3] = speed >> 24;
+	USETW(req.wLength, sizeof(data));
+	USETDW(data, speed);
 
 	return (usbd_do_request(udev, NULL, &req, data));
 }