sound: Replace MIN() with min()

We use min() in most places.

No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Christos Margiolis
2026-01-12 14:38:39 +01:00
parent aa58af04dc
commit eccd366b0a
5 changed files with 12 additions and 12 deletions
+5 -5
View File
@@ -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);
+2 -2
View File
@@ -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) ); \
} \
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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)
+2 -2
View File
@@ -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);