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

Christos Margiolis <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src,gmane.os.freebsd.current.scm
Message-ID <[email protected]>
The branch main has been updated by christos:

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

commit 5c3bc8ab427c8624b29cd9ac9265445002da3ba8
Author:     Christos Margiolis <[email protected]>
AuthorDate: 2026-08-21 14:02:19 +0000
Commit:     Christos Margiolis <[email protected]>
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));
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.