git: eccd366b0a8b - main - sound: Replace MIN() with min()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 12 Jan 2026 13:38:45 UTC
The branch main has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=eccd366b0a8ba7d902fcf0b1bec447926a75c36c
commit eccd366b0a8ba7d902fcf0b1bec447926a75c36c
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-01-12 13:38:39 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-01-12 13:38:39 +0000
sound: Replace MIN() with min()
We use min() in most places.
No functional change intended.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
---
sys/dev/sound/midi/midi.c | 10 +++++-----
sys/dev/sound/midi/midiq.h | 4 ++--
sys/dev/sound/pci/cs4281.c | 2 +-
sys/dev/sound/pci/hdspe-pcm.c | 4 ++--
sys/dev/sound/usb/uaudio.c | 4 ++--
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/sys/dev/sound/midi/midi.c b/sys/dev/sound/midi/midi.c
index 8c38b00f15ad..4fd0e3dcf134 100644
--- a/sys/dev/sound/midi/midi.c
+++ b/sys/dev/sound/midi/midi.c
@@ -236,7 +236,7 @@ midi_out(struct snd_midi *m, uint8_t *buf, int size)
return (0);
}
- used = MIN(size, MIDIQ_LEN(m->outq));
+ used = min(size, MIDIQ_LEN(m->outq));
if (used)
MIDIQ_DEQ(m->outq, buf, used);
if (MIDIQ_EMPTY(m->outq)) {
@@ -387,8 +387,8 @@ midi_read(struct cdev *i_dev, struct uio *uio, int ioflag)
* At this point, it is certain that m->inq has data
*/
- used = MIN(MIDIQ_LEN(m->inq), uio->uio_resid);
- used = MIN(used, MIDI_RSIZE);
+ used = min(MIDIQ_LEN(m->inq), uio->uio_resid);
+ used = min(used, MIDI_RSIZE);
MIDIQ_DEQ(m->inq, buf, used);
mtx_unlock(&m->lock);
@@ -456,8 +456,8 @@ midi_write(struct cdev *i_dev, struct uio *uio, int ioflag)
* We are certain than data can be placed on the queue
*/
- used = MIN(MIDIQ_AVAIL(m->outq), uio->uio_resid);
- used = MIN(used, MIDI_WSIZE);
+ used = min(MIDIQ_AVAIL(m->outq), uio->uio_resid);
+ used = min(used, MIDI_WSIZE);
mtx_unlock(&m->lock);
retval = uiomove(buf, used, uio);
diff --git a/sys/dev/sound/midi/midiq.h b/sys/dev/sound/midi/midiq.h
index 80825974283e..8ffa4a40d23d 100644
--- a/sys/dev/sound/midi/midiq.h
+++ b/sys/dev/sound/midi/midiq.h
@@ -56,7 +56,7 @@ struct name { \
* No protection against overflow, underflow
*/
#define MIDIQ_ENQ(head, buf, size) do { \
- MIDIQ_MOVE(&(head).b[(head).h], (buf), sizeof(*(head).b) * MIN((size), (head).s - (head).h)); \
+ MIDIQ_MOVE(&(head).b[(head).h], (buf), sizeof(*(head).b) * min((size), (head).s - (head).h)); \
if( (head).s - (head).h < (size) ) { \
MIDIQ_MOVE((head).b, (buf) + (head).s - (head).h, sizeof(*(head).b) * ((size) - (head).s + (head).h) ); \
} \
@@ -67,7 +67,7 @@ struct name { \
#define MIDIQ_DEQ_I(head, buf, size, move, update) do { \
if(MIDIQ_FULL(head)) (head).h=(head).t; \
- if (move) MIDIQ_MOVE((buf), &(head).b[(head).t], sizeof(*(head).b) * MIN((size), (head).s - (head).t)); \
+ if (move) MIDIQ_MOVE((buf), &(head).b[(head).t], sizeof(*(head).b) * min((size), (head).s - (head).t)); \
if( (head).s - (head).t < (size) ) { \
if (move) MIDIQ_MOVE((buf) + (head).s - (head).t, (head).b, sizeof(*(head).b) * ((size) - (head).s + (head).t) ); \
} \
diff --git a/sys/dev/sound/pci/cs4281.c b/sys/dev/sound/pci/cs4281.c
index 5b0b229a021b..eecfc740bb3f 100644
--- a/sys/dev/sound/pci/cs4281.c
+++ b/sys/dev/sound/pci/cs4281.c
@@ -350,7 +350,7 @@ cs4281chan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
/* 2 interrupts are possible and used in buffer (half-empty,empty),
* hence factor of 2. */
- ch->blksz = MIN(blocksize, sc->bufsz / 2);
+ ch->blksz = min(blocksize, sc->bufsz / 2);
sndbuf_resize(ch->buffer, 2, ch->blksz);
ch->dma_setup = 0;
adcdac_prog(ch);
diff --git a/sys/dev/sound/pci/hdspe-pcm.c b/sys/dev/sound/pci/hdspe-pcm.c
index 678693960e5e..0ccdf69c32ee 100644
--- a/sys/dev/sound/pci/hdspe-pcm.c
+++ b/sys/dev/sound/pci/hdspe-pcm.c
@@ -474,7 +474,7 @@ buffer_mux_port(uint32_t *dma, uint32_t *pcm, uint32_t subset, uint32_t ports,
channels = hdspe_channel_count(ports, pcm_width);
/* Only copy as much as supported by both hardware and pcm channel. */
- slots = hdspe_port_slot_width(subset, MIN(adat_width, pcm_width));
+ slots = hdspe_port_slot_width(subset, min(adat_width, pcm_width));
/* Let the compiler inline and loop unroll common cases. */
if (slots == 2)
@@ -520,7 +520,7 @@ buffer_demux_port(uint32_t *dma, uint32_t *pcm, uint32_t subset, uint32_t ports,
channels = hdspe_channel_count(ports, pcm_width);
/* Only copy as much as supported by both hardware and pcm channel. */
- slots = hdspe_port_slot_width(subset, MIN(adat_width, pcm_width));
+ slots = hdspe_port_slot_width(subset, min(adat_width, pcm_width));
/* Let the compiler inline and loop unroll common cases. */
if (slots == 2)
diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c
index 0987ca12d933..7f49bae9ce5e 100644
--- a/sys/dev/sound/usb/uaudio.c
+++ b/sys/dev/sound/usb/uaudio.c
@@ -150,7 +150,7 @@ SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, debug, CTLFLAG_RWTUN,
#define UAUDIO_NCHANBUFS 2 /* number of outstanding request */
#define UAUDIO_RECURSE_LIMIT 255 /* rounds */
#define UAUDIO_BITS_MAX 32 /* maximum sample size in bits */
-#define UAUDIO_CHANNELS_MAX MIN(64, AFMT_CHANNEL_MAX)
+#define UAUDIO_CHANNELS_MAX min(64, AFMT_CHANNEL_MAX)
#define UAUDIO_MATRIX_MAX 8 /* channels */
#define MAKE_WORD(h,l) (((h) << 8) | (l))
@@ -1651,7 +1651,7 @@ uaudio20_check_rate(struct usb_device *udev, uint8_t iface_no,
* buffer. Try using a larger buffer and see if that
* helps:
*/
- rates = MIN(UAUDIO20_MAX_RATES, (255 - 2) / 12);
+ rates = min(UAUDIO20_MAX_RATES, (255 - 2) / 12);
error = USB_ERR_INVAL;
} else {
rates = UGETW(data);