From nobody Fri Oct 18 08:44:52 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XVJDN6J5Nz5Ywdn; Fri, 18 Oct 2024 08:44:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XVJDN4WwDz4lmN; Fri, 18 Oct 2024 08:44:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729241092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RXTYN6iREz4f7ExfQCoEhRnYO9nBA34nJWvHq4Nlx1U=; b=gsqu4eSRpoZjaB7AsauuQRKp/Sc9ORuJqOll5+f6sTAhp2dUmXQNYJIpOZISLJzkjtYW/z T2wrROG4951vQDEjBsxhU6+UoP8Z5l6HFOjzuJPcaMOCYhhWYnhK7eCPVqOeqOZQaPy3Tl zBrPFi1YDmfvD/9ZNLsbYC62pzCgH5xlu61f6YTzP1/4pphMx67JQH4JEJtNfwwLzIZlpX z+Hsinb6We3SJWRrVVgViGR1fovGZgwmH7uY4td301XYRcHa5/u7Ud/1IarobvfRUdLq/j Aev2tA0DahT/lL3dgoCTvw6qqO39jKrtHBCWFVA+O5xlFHrLKVd8rg9xI0VLrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729241092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RXTYN6iREz4f7ExfQCoEhRnYO9nBA34nJWvHq4Nlx1U=; b=rDtv44Ighh61cI1XXnmurY6Ukpbky1hmJ1eKG3AVr7AN2yNNJgL8wqFL8fAu9rY/5VcPZx N747/IIj+NAqnKYF+tZiHBN4io2ZcGWLQuEND7MgEz2fc8oU+XxS0QqCMKyht3ITr/BJyZ BlbCNR60ka6w0gdWAmTOLplpOoRQboiYkiFXz13FPsenY092U97ErBGbalwaZPPnYG9zkQ 9g7TgpUtPegsfhmJLdqjtXVF2pblqU5Mr5IKsxnbdbKn+PLAUzdaFJ/2B24rqZ1/g0Jik/ xQ9W2x9VyERPm02mF1ztHGolU5Tji2/l4CNwDhOHvxrqG/+FC1Coqp3fL16uYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729241092; a=rsa-sha256; cv=none; b=BNQ9xjwATpWyqP13quJOjNQiJeIpFsdxV/gtIJ1joJkwk32pt4xptN6P3bBnyzBiczsIsM 6iJ8ZCiN74ejojGBHJOoazCwnU5auCcP2Efcx6We25yWm0H4da3BlrNcOd8CONHpxdmT13 jJKXg+tviSXLC+Ly1L8p0T8SaIkBNNyal0BrSlj5iDte82gYiPnY67Y21+cSGoSFVYTq2K Jz1SAV/tZ4JdiS1CoetWGkXD86uJXFxyMdLXYwZwqpLmlLyauE5q4YESiIkDsf690sHWfH vxUjY+LtCg5mPlSuTOpp2lrY1oCoAjLsd/MKtronCLs8MkD/7N1wRYYxeEtJFA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XVJDN47bKzRgv; Fri, 18 Oct 2024 08:44:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49I8iqfS087799; Fri, 18 Oct 2024 08:44:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49I8iq4Q087796; Fri, 18 Oct 2024 08:44:52 GMT (envelope-from git) Date: Fri, 18 Oct 2024 08:44:52 GMT Message-Id: <202410180844.49I8iq4Q087796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 142aca25b07c - main - sound: Sort channels by unit number as well List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 142aca25b07c9a7067d8040ea98812c54b253bbf Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=142aca25b07c9a7067d8040ea98812c54b253bbf commit 142aca25b07c9a7067d8040ea98812c54b253bbf Author: Christos Margiolis AuthorDate: 2024-10-18 08:39:00 +0000 Commit: Christos Margiolis CommitDate: 2024-10-18 08:39:00 +0000 sound: Sort channels by unit number as well Refactor CHN_INSERT_SORT() to also take into account the unit number of each channel, while still prioritizing the type, to make the channel list easier to work with. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D46549 --- sys/dev/sound/pcm/channel.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h index 445882a62f0a..d146f51120d8 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -225,7 +225,8 @@ struct pcm_channel { #define CHN_INSERT_SORT(w, x, y, z) do { \ struct pcm_channel *t, *a = NULL; \ CHN_FOREACH(t, x, z) { \ - if ((y)->type w t->type) \ + if (((y)->type w t->type) || \ + (((y)->type == t->type) && ((y)->unit w t->unit))) \ a = t; \ else \ break; \ @@ -236,7 +237,7 @@ struct pcm_channel { CHN_INSERT_HEAD(x, y, z); \ } while (0) -#define CHN_INSERT_SORT_ASCEND(x, y, z) CHN_INSERT_SORT(>=, x, y, z) +#define CHN_INSERT_SORT_ASCEND(x, y, z) CHN_INSERT_SORT(>, x, y, z) #define CHN_INSERT_SORT_DESCEND(x, y, z) CHN_INSERT_SORT(<, x, y, z) #define CHN_BUF_PARENT(x, y) \