git: 66a82f5fa471 - main - sound: De-macro array definitions in chn_calclatency()

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Tue, 07 Apr 2026 15:44:54 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=66a82f5fa471b8eda018b7566c3725a6742dfc0c

commit 66a82f5fa471b8eda018b7566c3725a6742dfc0c
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-04-07 15:44:34 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-04-07 15:44:34 +0000

    sound: De-macro array definitions in chn_calclatency()
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D56263
---
 sys/dev/sound/pcm/channel.c | 37 ++++++++++++++++---------------------
 1 file changed, 16 insertions(+), 21 deletions(-)

diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 9b71d93ac7f9..0b940fe4e843 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -1748,19 +1748,6 @@ round_blksz(u_int32_t v, int round)
  * aggressively through possibly real time programming technique.
  *
  */
-#define CHN_LATENCY_PBLKCNT_REF				\
-	{{1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1},		\
-	{1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1}}
-#define CHN_LATENCY_PBUFSZ_REF				\
-	{{7, 9, 12, 13, 14, 15, 15, 15, 15, 15, 16},	\
-	{11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 17}}
-
-#define CHN_LATENCY_RBLKCNT_REF				\
-	{{9, 8, 7, 6, 5, 5, 4, 3, 2, 1, 1},		\
-	{9, 8, 7, 6, 5, 5, 4, 3, 2, 1, 1}}
-#define CHN_LATENCY_RBUFSZ_REF				\
-	{{14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16},	\
-	{15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17}}
 
 #define CHN_LATENCY_DATA_REF	192000 /* 48khz stereo 16bit ~ 48000 x 2 x 2 */
 
@@ -1768,14 +1755,22 @@ static int
 chn_calclatency(int dir, int latency, int bps, u_int32_t datarate,
 				u_int32_t max, int *rblksz, int *rblkcnt)
 {
-	static int pblkcnts[CHN_LATENCY_PROFILE_MAX + 1][CHN_LATENCY_MAX + 1] =
-	    CHN_LATENCY_PBLKCNT_REF;
-	static int  pbufszs[CHN_LATENCY_PROFILE_MAX + 1][CHN_LATENCY_MAX + 1] =
-	    CHN_LATENCY_PBUFSZ_REF;
-	static int rblkcnts[CHN_LATENCY_PROFILE_MAX + 1][CHN_LATENCY_MAX + 1] =
-	    CHN_LATENCY_RBLKCNT_REF;
-	static int  rbufszs[CHN_LATENCY_PROFILE_MAX + 1][CHN_LATENCY_MAX + 1] =
-	    CHN_LATENCY_RBUFSZ_REF;
+	static int pblkcnts[CHN_LATENCY_PROFILE_MAX + 1][CHN_LATENCY_MAX + 1] = {
+		{1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1},
+		{1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 1}
+	};
+	static int  pbufszs[CHN_LATENCY_PROFILE_MAX + 1][CHN_LATENCY_MAX + 1] = {
+		{7, 9, 12, 13, 14, 15, 15, 15, 15, 15, 16},
+		{11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 17}
+	};
+	static int rblkcnts[CHN_LATENCY_PROFILE_MAX + 1][CHN_LATENCY_MAX + 1] = {
+		{9, 8, 7, 6, 5, 5, 4, 3, 2, 1, 1},
+		{9, 8, 7, 6, 5, 5, 4, 3, 2, 1, 1}
+	};
+	static int  rbufszs[CHN_LATENCY_PROFILE_MAX + 1][CHN_LATENCY_MAX + 1] = {
+		{14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16},
+		{15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17}
+	};
 	u_int32_t bufsz;
 	int lprofile, blksz, blkcnt;