summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2018-09-03 16:29:22 +0000
committerriastradh <riastradh@NetBSD.org>2018-09-03 16:29:22 +0000
commita8a5c538b6388ff28a5944a8f637db644ee9a623 (patch)
tree4969c43ed378ff98e7f37be97a07b435cede6cb0 /sys/dev
parentcc0f01d7332d63adc5489e77fd27e50767bcc316 (diff)
Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int. The generic name min/max should not silently truncate to 32 bits on 64-bit systems. This is purely a name change -- no functional change intended. HOWEVER! Some subsystems have #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) even though our standard name for that is MIN/MAX. Although these may invite multiple evaluation bugs, these do _not_ cause integer truncation. To avoid `fixing' these cases, I first changed the name in libkern, and then compile-tested every file where min/max occurred in order to confirm that it failed -- and thus confirm that nothing shadowed min/max -- before changing it. I have left a handful of bootloaders that are too annoying to compile-test, and some dead code: cobalt ews4800mips hp300 hppa ia64 luna68k vax acorn32/if_ie.c (not included in any kernels) macppc/if_gm.c (superseded by gem(4)) It should be easy to fix the fallout once identified -- this way of doing things fails safe, and the goal here, after all, is to _avoid_ silent integer truncations, not introduce them. Maybe one day we can reintroduce min/max as type-generic things that never silently truncate. But we should avoid doing that for a while, so that existing code has a chance to be detected by the compiler for conversion to uimin/uimax without changing the semantics until we can properly audit it all. (Who knows, maybe in some cases integer truncation is actually intended!)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ata/ata_wdc.c6
-rw-r--r--sys/dev/ata/ld_ataraid.c8
-rw-r--r--sys/dev/auconv.c40
-rw-r--r--sys/dev/audio.c12
-rw-r--r--sys/dev/audiobell.c8
-rw-r--r--sys/dev/aurateconv.c6
-rw-r--r--sys/dev/auvolconv.c8
-rw-r--r--sys/dev/bluetooth/btmagic.c6
-rw-r--r--sys/dev/cardbus/cardbus_exrom.c6
-rw-r--r--sys/dev/dksubr.c8
-rw-r--r--sys/dev/dtv/dtv_buffer.c10
-rw-r--r--sys/dev/dtv/dtv_demux.c6
-rw-r--r--sys/dev/dtv/dtv_scatter.c8
-rw-r--r--sys/dev/gpib/ppi.c8
-rw-r--r--sys/dev/hid/hid.c6
-rw-r--r--sys/dev/hil/hil.c4
-rw-r--r--sys/dev/i2c/ddc.c8
-rw-r--r--sys/dev/i2c/fcu.c8
-rw-r--r--sys/dev/i2c/ibmhawk.c8
-rw-r--r--sys/dev/i2c/xc3028.c6
-rw-r--r--sys/dev/i2c/xc5k.c6
-rw-r--r--sys/dev/i2o/dpti.c8
-rw-r--r--sys/dev/i2o/iop.c6
-rw-r--r--sys/dev/ic/aic6360.c6
-rw-r--r--sys/dev/ic/an.c6
-rw-r--r--sys/dev/ic/atppc.c10
-rw-r--r--sys/dev/ic/cac.c6
-rw-r--r--sys/dev/ic/ciss.c6
-rw-r--r--sys/dev/ic/clmpcc.c6
-rw-r--r--sys/dev/ic/dp8390.c6
-rw-r--r--sys/dev/ic/dpt.c10
-rw-r--r--sys/dev/ic/dwc_mmc.c8
-rw-r--r--sys/dev/ic/elink3.c6
-rw-r--r--sys/dev/ic/elinkxl.c6
-rw-r--r--sys/dev/ic/gem.c6
-rw-r--r--sys/dev/ic/hme.c6
-rw-r--r--sys/dev/ic/i82586.c8
-rw-r--r--sys/dev/ic/igsfb_subr.c8
-rw-r--r--sys/dev/ic/isp_netbsd.c8
-rw-r--r--sys/dev/ic/isp_target.c6
-rw-r--r--sys/dev/ic/lance.c18
-rw-r--r--sys/dev/ic/lpt.c6
-rw-r--r--sys/dev/ic/lsi64854.c8
-rw-r--r--sys/dev/ic/malo.c6
-rw-r--r--sys/dev/ic/mb86960.c8
-rw-r--r--sys/dev/ic/mb89352.c6
-rw-r--r--sys/dev/ic/mfi.c8
-rw-r--r--sys/dev/ic/midway.c12
-rw-r--r--sys/dev/ic/mlx.c8
-rw-r--r--sys/dev/ic/msm6258.c12
-rw-r--r--sys/dev/ic/mtd803.c6
-rw-r--r--sys/dev/ic/mvsata.c6
-rw-r--r--sys/dev/ic/mx98905.c12
-rw-r--r--sys/dev/ic/ncr53c9x.c10
-rw-r--r--sys/dev/ic/pl041.c6
-rw-r--r--sys/dev/ic/pl181.c8
-rw-r--r--sys/dev/ic/qemufwcfg.c6
-rw-r--r--sys/dev/ic/rrunner.c6
-rw-r--r--sys/dev/ic/rrunnerreg.h6
-rw-r--r--sys/dev/ic/rt2560.c6
-rw-r--r--sys/dev/ic/rt2661.c10
-rw-r--r--sys/dev/ic/rt2860.c6
-rw-r--r--sys/dev/ic/seeq8005.c8
-rw-r--r--sys/dev/ic/sl811hs.c12
-rw-r--r--sys/dev/ic/tcic2.c6
-rw-r--r--sys/dev/ic/tropic.c6
-rw-r--r--sys/dev/ic/wi.c8
-rw-r--r--sys/dev/ieee1394/firewire.c6
-rw-r--r--sys/dev/ieee1394/fwmem.c6
-rw-r--r--sys/dev/ieee1394/if_fwip.c6
-rw-r--r--sys/dev/ieee1394/sbp.c10
-rw-r--r--sys/dev/isa/fd.c8
-rw-r--r--sys/dev/isa/if_eg.c8
-rw-r--r--sys/dev/isa/if_el.c8
-rw-r--r--sys/dev/isa/if_iy.c6
-rw-r--r--sys/dev/isa/mcd.c6
-rw-r--r--sys/dev/isa/sbdsp.c6
-rw-r--r--sys/dev/kttcp.c6
-rw-r--r--sys/dev/marvell/gtidmac.c8
-rw-r--r--sys/dev/marvell/gtmpsc.c6
-rw-r--r--sys/dev/marvell/if_mvgbe.c6
-rw-r--r--sys/dev/marvell/if_mvxpe.c6
-rw-r--r--sys/dev/marvell/mvcesa.c12
-rw-r--r--sys/dev/mca/ed_mca.c12
-rw-r--r--sys/dev/mulaw.c24
-rw-r--r--sys/dev/mvme/lpt_mvme.c6
-rw-r--r--sys/dev/mvme/mvmebus.c6
-rw-r--r--sys/dev/ofisa/ofisa.c10
-rw-r--r--sys/dev/ofw/ofnet.c6
-rw-r--r--sys/dev/pad/pad.c6
-rw-r--r--sys/dev/pci/amr.c8
-rw-r--r--sys/dev/pci/arcmsr.c6
-rw-r--r--sys/dev/pci/auvia.c6
-rw-r--r--sys/dev/pci/bktr/bktr_core.c16
-rw-r--r--sys/dev/pci/cxgb/cxgb_main.c6
-rw-r--r--sys/dev/pci/cxgb/cxgb_offload.c8
-rw-r--r--sys/dev/pci/cxgb/cxgb_osdep.h2
-rw-r--r--sys/dev/pci/cxgb/cxgb_sge.c12
-rw-r--r--sys/dev/pci/cxgb/cxgb_t3_hw.c16
-rw-r--r--sys/dev/pci/cxgb/cxgb_xgmac.c10
-rw-r--r--sys/dev/pci/cz.c12
-rw-r--r--sys/dev/pci/if_bge.c6
-rw-r--r--sys/dev/pci/if_bwfm_pci.c8
-rw-r--r--sys/dev/pci/if_de.c6
-rw-r--r--sys/dev/pci/if_dge.c6
-rw-r--r--sys/dev/pci/if_enavar.h4
-rw-r--r--sys/dev/pci/if_iwi.c10
-rw-r--r--sys/dev/pci/if_lmc.c6
-rw-r--r--sys/dev/pci/if_vge.c6
-rw-r--r--sys/dev/pci/if_wm.c12
-rw-r--r--sys/dev/pci/if_wpi.c6
-rw-r--r--sys/dev/pci/if_xge.c6
-rw-r--r--sys/dev/pci/iwic_bchan.c6
-rw-r--r--sys/dev/pci/iwic_dchan.c6
-rw-r--r--sys/dev/pci/ixgbe/if_sriov.c2
-rw-r--r--sys/dev/pci/ixgbe/ixgbe.c12
-rw-r--r--sys/dev/pci/ixgbe/ixgbe_dcb.c4
-rw-r--r--sys/dev/pci/ixgbe/ixv.c6
-rw-r--r--sys/dev/pci/machfb.c6
-rw-r--r--sys/dev/pci/mly.c10
-rw-r--r--sys/dev/pci/nvme_pci.c6
-rw-r--r--sys/dev/pci/pccbb.c6
-rw-r--r--sys/dev/pci/pciide_common.c6
-rw-r--r--sys/dev/pci/piixide.c8
-rw-r--r--sys/dev/pci/pm2fb.c10
-rw-r--r--sys/dev/pci/radeonfb.c14
-rw-r--r--sys/dev/pci/twa.c6
-rw-r--r--sys/dev/pci/ubsec.c8
-rw-r--r--sys/dev/pcmcia/if_cnw.c6
-rw-r--r--sys/dev/pcmcia/if_xi.c6
-rw-r--r--sys/dev/pcmcia/wdc_pcmcia.c8
-rw-r--r--sys/dev/podulebus/hcsc.c6
-rw-r--r--sys/dev/podulebus/oak.c6
-rw-r--r--sys/dev/ppbus/lpt.c6
-rw-r--r--sys/dev/rndpseudo.c6
-rw-r--r--sys/dev/sbus/be.c6
-rw-r--r--sys/dev/sbus/bpp.c6
-rw-r--r--sys/dev/sbus/dbri.c8
-rw-r--r--sys/dev/sbus/magma.c8
-rw-r--r--sys/dev/sbus/mgx.c6
-rw-r--r--sys/dev/sbus/qe.c6
-rw-r--r--sys/dev/sbus/zx.c8
-rw-r--r--sys/dev/scsipi/cd.c10
-rw-r--r--sys/dev/scsipi/if_se.c6
-rw-r--r--sys/dev/scsipi/scsipi_base.c6
-rw-r--r--sys/dev/scsipi/scsipi_ioctl.c8
-rw-r--r--sys/dev/sdmmc/sdmmc_mem.c8
-rw-r--r--sys/dev/spi/spi.c6
-rw-r--r--sys/dev/spi/spiflash.c8
-rw-r--r--sys/dev/spkr.c6
-rw-r--r--sys/dev/tc/asc_tcds.c6
-rw-r--r--sys/dev/tc/bba.c8
-rw-r--r--sys/dev/tc/if_le_ioasic.c12
-rw-r--r--sys/dev/usb/aubtfwl.c6
-rw-r--r--sys/dev/usb/auvitek_video.c6
-rw-r--r--sys/dev/usb/ehci.c18
-rw-r--r--sys/dev/usb/emdtv.c6
-rw-r--r--sys/dev/usb/if_ural.c6
-rw-r--r--sys/dev/usb/if_zyd.c8
-rw-r--r--sys/dev/usb/motg.c14
-rw-r--r--sys/dev/usb/ohci.c12
-rw-r--r--sys/dev/usb/pseye.c8
-rw-r--r--sys/dev/usb/uatp.c6
-rw-r--r--sys/dev/usb/uaudio.c8
-rw-r--r--sys/dev/usb/udl.c6
-rw-r--r--sys/dev/usb/udsir.c8
-rw-r--r--sys/dev/usb/ugen.c44
-rw-r--r--sys/dev/usb/uhci.c8
-rw-r--r--sys/dev/usb/uhid.c8
-rw-r--r--sys/dev/usb/ulpt.c8
-rw-r--r--sys/dev/usb/umass_isdata.c6
-rw-r--r--sys/dev/usb/umidi.c6
-rw-r--r--sys/dev/usb/urio.c8
-rw-r--r--sys/dev/usb/usbroothub.c24
-rw-r--r--sys/dev/usb/uscanner.c8
-rw-r--r--sys/dev/usb/utoppy.c18
-rw-r--r--sys/dev/usb/xhci.c12
-rw-r--r--sys/dev/video.c12
-rw-r--r--sys/dev/vnd.c6
-rw-r--r--sys/dev/wscons/wscons_rinit.c8
-rw-r--r--sys/dev/wscons/wsdisplay_glyphcache.c6
-rw-r--r--sys/dev/wscons/wsemul_dumb.c6
-rw-r--r--sys/dev/wscons/wsemul_sun.c28
-rw-r--r--sys/dev/wscons/wsemul_vt100.c6
-rw-r--r--sys/dev/wscons/wsemul_vt100_subr.c30
-rw-r--r--sys/dev/wsfb/genfb.c6
-rw-r--r--sys/dev/wsfont/wsfont.c8
187 files changed, 785 insertions, 785 deletions
diff --git a/sys/dev/ata/ata_wdc.c b/sys/dev/ata/ata_wdc.c
index 57ff3b1eb4b..2e8287ba915 100644
--- a/sys/dev/ata/ata_wdc.c
+++ b/sys/dev/ata/ata_wdc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ata_wdc.c,v 1.110 2018/06/01 18:13:30 macallan Exp $ */
+/* $NetBSD: ata_wdc.c,v 1.111 2018/09/03 16:29:30 riastradh Exp $ */
/*
* Copyright (c) 1998, 2001, 2003 Manuel Bouyer.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.110 2018/06/01 18:13:30 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_wdc.c,v 1.111 2018/09/03 16:29:30 riastradh Exp $");
#include "opt_ata.h"
#include "opt_wdc.h"
@@ -516,7 +516,7 @@ _wdc_ata_bio_start(struct ata_channel *chp, struct ata_xfer *xfer)
}
}
#endif
- ata_bio->nblks = min(nblks, drvp->multi);
+ ata_bio->nblks = uimin(nblks, drvp->multi);
ata_bio->nbytes = ata_bio->nblks * drvp->lp->d_secsize;
KASSERT(nblks == 1 || (ata_bio->flags & ATA_SINGLE) == 0);
if (ata_bio->nblks > 1) {
diff --git a/sys/dev/ata/ld_ataraid.c b/sys/dev/ata/ld_ataraid.c
index 30ea0aa1b4d..1ba4cf4a58f 100644
--- a/sys/dev/ata/ld_ataraid.c
+++ b/sys/dev/ata/ld_ataraid.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ld_ataraid.c,v 1.45 2018/06/03 10:20:54 martin Exp $ */
+/* $NetBSD: ld_ataraid.c,v 1.46 2018/09/03 16:29:30 riastradh Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.45 2018/06/03 10:20:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.46 2018/09/03 16:29:30 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "bio.h"
@@ -419,12 +419,12 @@ ld_ataraid_start_raid0(struct ld_softc *ld, struct buf *bp)
comp = off / sz;
cbn = ((tbn / aai->aai_width) * aai->aai_interleave) +
(off % sz);
- rcount = min(bcount, dbtob(sz));
+ rcount = uimin(bcount, dbtob(sz));
} else {
comp = tbn % aai->aai_width;
cbn = ((tbn / aai->aai_width) * aai->aai_interleave) +
off;
- rcount = min(bcount, dbtob(aai->aai_interleave - off));
+ rcount = uimin(bcount, dbtob(aai->aai_interleave - off));
}
/*
diff --git a/sys/dev/auconv.c b/sys/dev/auconv.c
index ba7aab10f09..2d8ef56483f 100644
--- a/sys/dev/auconv.c
+++ b/sys/dev/auconv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: auconv.c,v 1.36 2018/06/23 03:18:49 nat Exp $ */
+/* $NetBSD: auconv.c,v 1.37 2018/09/03 16:29:30 riastradh Exp $ */
/*
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.36 2018/06/23 03:18:49 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.37 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/types.h>
#include <sys/audioio.h>
@@ -389,7 +389,7 @@ DEFINE_FILTER(change_sign8)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = dst->end - dst->start;
- m = min(m, max_used);
+ m = uimin(m, max_used);
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 1, m) {
*d = *s ^ 0x80;
} FILTER_LOOP_EPILOGUE(this->src, dst);
@@ -406,7 +406,7 @@ DEFINE_FILTER(change_sign16)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
enc = dst->param.encoding;
if (enc == AUDIO_ENCODING_SLINEAR_LE
|| enc == AUDIO_ENCODING_ULINEAR_LE) {
@@ -433,7 +433,7 @@ DEFINE_FILTER(swap_bytes)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
FILTER_LOOP_PROLOGUE(this->src, 2, dst, 2, m) {
d[0] = s[1];
d[1] = s[0];
@@ -451,7 +451,7 @@ DEFINE_FILTER(null_filter)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 1, m) {
*d = *s;
} FILTER_LOOP_EPILOGUE(this->src, dst);
@@ -469,7 +469,7 @@ DEFINE_FILTER(swap_bytes_change_sign16)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
enc = dst->param.encoding;
if (enc == AUDIO_ENCODING_SLINEAR_LE
|| enc == AUDIO_ENCODING_ULINEAR_LE) {
@@ -496,7 +496,7 @@ DEFINE_FILTER(linear8_8_to_linear32)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~3;
- m = min(m, max_used / 4);
+ m = uimin(m, max_used / 4);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
@@ -590,7 +590,7 @@ DEFINE_FILTER(linear8_8_to_linear24)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (((dst->end - dst->start) / 3) * 3) & ~1;
- m = min(m, max_used / 3);
+ m = uimin(m, max_used / 3);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
@@ -680,7 +680,7 @@ DEFINE_FILTER(linear8_8_to_linear16)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used / 2);
+ m = uimin(m, max_used / 2);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
@@ -769,7 +769,7 @@ DEFINE_FILTER(linearN_to_linear8)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start);
- m = min(m, max_used * hw);
+ m = uimin(m, max_used * hw);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
@@ -852,7 +852,7 @@ DEFINE_FILTER(linear16_16_to_linear32)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~3;
- m = min(m, max_used / 2);
+ m = uimin(m, max_used / 2);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
@@ -979,7 +979,7 @@ DEFINE_FILTER(linear16_16_to_linear24)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = ((dst->end - dst->start) / 3) * 3;
- m = min(m, max_used * 2 / 3);
+ m = uimin(m, max_used * 2 / 3);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
@@ -1098,7 +1098,7 @@ DEFINE_FILTER(linear16_16_to_linear16)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
@@ -1199,7 +1199,7 @@ DEFINE_FILTER(linear24_24_to_linear32)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~3;
- m = min(m, max_used * 3 / 4);
+ m = uimin(m, max_used * 3 / 4);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
@@ -1326,7 +1326,7 @@ DEFINE_FILTER(linear24_24_to_linear24)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) / 3 * 3;
- m = min(m, max_used);
+ m = uimin(m, max_used);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
@@ -1433,7 +1433,7 @@ DEFINE_FILTER(linear24_24_to_linear16)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used * 3 / 2);
+ m = uimin(m, max_used * 3 / 2);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
@@ -1544,7 +1544,7 @@ DEFINE_FILTER(linear32_32_to_linear32)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~3;
- m = min(m, max_used);
+ m = uimin(m, max_used);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
@@ -1657,7 +1657,7 @@ DEFINE_FILTER(linear32_32_to_linear24)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = ((dst->end - dst->start) / 3) * 3;
- m = min(m, max_used * 4 / 3);
+ m = uimin(m, max_used * 4 / 3);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
@@ -1776,7 +1776,7 @@ DEFINE_FILTER(linear32_32_to_linear16)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used * 2);
+ m = uimin(m, max_used * 2);
enc_dst = dst->param.encoding;
enc_src = this->src->param.encoding;
if ((enc_src == AUDIO_ENCODING_SLINEAR_LE
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index 69b8a5f67c3..49fc0cce9c2 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.457 2018/05/22 01:35:49 nat Exp $ */
+/* $NetBSD: audio.c,v 1.458 2018/09/03 16:29:30 riastradh Exp $ */
/*-
* Copyright (c) 2016 Nathanial Sloss <nathanialsloss@yahoo.com.au>
@@ -148,7 +148,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.457 2018/05/22 01:35:49 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.458 2018/09/03 16:29:30 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "audio.h"
@@ -1491,7 +1491,7 @@ audio_stream_ctor(audio_stream_t *stream, const audio_params_t *param, int size)
{
int frame_size;
- size = min(size, AU_RING_SIZE);
+ size = uimin(size, AU_RING_SIZE);
stream->bufsize = size;
stream->start = kmem_zalloc(size, KM_SLEEP);
frame_size = (param->precision + 7) / 8 * param->channels;
@@ -2874,7 +2874,7 @@ audio_silence_copyout(struct audio_softc *sc, int n, struct uio *uio)
error = 0;
while (n > 0 && uio->uio_resid > 0 && !error) {
- k = min(n, min(uio->uio_resid, sizeof zerobuf));
+ k = uimin(n, uimin(uio->uio_resid, sizeof zerobuf));
mutex_exit(sc->sc_lock);
error = uiomove(zerobuf, k, uio);
mutex_enter(sc->sc_lock);
@@ -2907,7 +2907,7 @@ uio_fetcher_fetch_to(struct audio_softc *sc, stream_fetcher_t *self,
* for audio_prinfo::seek and kfilters.
*/
stream_space = audio_stream_get_space(p);
- size = min(this->uio->uio_resid, stream_space);
+ size = uimin(this->uio->uio_resid, stream_space);
/* the first fragment of the space */
stream_space = p->end - p->inp;
@@ -3000,7 +3000,7 @@ audio_write(struct audio_softc *sc, struct uio *uio, int ioflag,
}
if (!(vc->sc_mode & AUMODE_PLAY_ALL) && vc->sc_playdrop > 0) {
- m = min(vc->sc_playdrop, uio->uio_resid);
+ m = uimin(vc->sc_playdrop, uio->uio_resid);
DPRINTF(("audio_write: playdrop %d\n", m));
uio->uio_offset += m;
uio->uio_resid -= m;
diff --git a/sys/dev/audiobell.c b/sys/dev/audiobell.c
index 7c9fd665468..5a1b5865a1d 100644
--- a/sys/dev/audiobell.c
+++ b/sys/dev/audiobell.c
@@ -1,4 +1,4 @@
-/* $NetBSD: audiobell.c,v 1.25 2017/07/01 05:32:24 nat Exp $ */
+/* $NetBSD: audiobell.c,v 1.26 2018/09/03 16:29:30 riastradh Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/types.h>
-__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.25 2017/07/01 05:32:24 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audiobell.c,v 1.26 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/audioio.h>
#include <sys/conf.h>
@@ -147,7 +147,7 @@ audiobell(void *v, u_int pitch, u_int period, u_int volume, int poll)
ai.blocksize = BELL_SAMPLE_RATE;
len = period * BELL_SAMPLE_RATE / 1000 * 2;
- size = min(len, ai.blocksize);
+ size = uimin(len, ai.blocksize);
if (size == 0)
goto out;
@@ -157,7 +157,7 @@ audiobell(void *v, u_int pitch, u_int period, u_int volume, int poll)
phase = 0;
while (len > 0) {
- size = min(len, ai.blocksize);
+ size = uimin(len, ai.blocksize);
if (audiobell_synthesize(buf, pitch, size *
1000 / BELL_SAMPLE_RATE, volume, &phase) != 0)
goto out;
diff --git a/sys/dev/aurateconv.c b/sys/dev/aurateconv.c
index 8c0145e6c3f..9a693ae4d7a 100644
--- a/sys/dev/aurateconv.c
+++ b/sys/dev/aurateconv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: aurateconv.c,v 1.22 2017/08/07 13:30:51 isaki Exp $ */
+/* $NetBSD: aurateconv.c,v 1.23 2018/09/03 16:29:30 riastradh Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aurateconv.c,v 1.22 2017/08/07 13:30:51 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aurateconv.c,v 1.23 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/systm.h>
#include <sys/types.h>
@@ -187,7 +187,7 @@ aurateconv_fetch_to(struct audio_softc *sc, stream_fetcher_t *self,
if ((err = this->base.prev->fetch_to(sc, this->base.prev, this->base.src, m)))
return err;
m = (dst->end - dst->start) / frame_dst * frame_dst;
- m = min(m, max_used);
+ m = uimin(m, max_used);
switch (this->from.encoding) {
case AUDIO_ENCODING_SLINEAR_LE:
diff --git a/sys/dev/auvolconv.c b/sys/dev/auvolconv.c
index 75fbf0a2468..c5848272ac5 100644
--- a/sys/dev/auvolconv.c
+++ b/sys/dev/auvolconv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: auvolconv.c,v 1.3 2016/02/26 13:08:28 nat Exp $ */
+/* $NetBSD: auvolconv.c,v 1.4 2018/09/03 16:29:30 riastradh Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auvolconv.c,v 1.3 2016/02/26 13:08:28 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvolconv.c,v 1.4 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -59,7 +59,7 @@ auvolconv_slinear16_le_fetch_to(struct audio_softc *asc,
if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
FILTER_LOOP_PROLOGUE(this->src, 2, dst, 2, m) {
j = le16dec(s);
wp = (int16_t *)d;
@@ -87,7 +87,7 @@ auvolconv_slinear16_be_fetch_to(struct audio_softc *asc,
if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
FILTER_LOOP_PROLOGUE(this->src, 2, dst, 2, m) {
j = be16dec(s);
wp = (int16_t *)d;
diff --git a/sys/dev/bluetooth/btmagic.c b/sys/dev/bluetooth/btmagic.c
index b64ee6d1f01..672506b7b82 100644
--- a/sys/dev/bluetooth/btmagic.c
+++ b/sys/dev/bluetooth/btmagic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: btmagic.c,v 1.17 2017/12/10 17:03:07 bouyer Exp $ */
+/* $NetBSD: btmagic.c,v 1.18 2018/09/03 16:29:30 riastradh Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -85,7 +85,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.17 2017/12/10 17:03:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.18 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -657,7 +657,7 @@ btmagic_sysctl_taptimeout(SYSCTLFN_ARGS)
if (error || newp == NULL)
return error;
- if (t < max(1000 / hz, 1) || t > 999)
+ if (t < uimax(1000 / hz, 1) || t > 999)
return EINVAL;
sc->sc_taptimeout = t;
diff --git a/sys/dev/cardbus/cardbus_exrom.c b/sys/dev/cardbus/cardbus_exrom.c
index dda0a7466f2..509fa12413f 100644
--- a/sys/dev/cardbus/cardbus_exrom.c
+++ b/sys/dev/cardbus/cardbus_exrom.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cardbus_exrom.c,v 1.12 2010/02/24 19:52:51 dyoung Exp $ */
+/* $NetBSD: cardbus_exrom.c,v 1.13 2018/09/03 16:29:30 riastradh Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cardbus_exrom.c,v 1.12 2010/02/24 19:52:51 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cardbus_exrom.c,v 1.13 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -178,7 +178,7 @@ pci_exrom_parse_data_structure(bus_space_tag_t tag,
header->data_revision = LEINT16(hdr, PCI_EXROM_DATA_DATA_REV);
header->code_type = hdr[PCI_EXROM_DATA_CODE_TYPE];
header->indicator = hdr[PCI_EXROM_DATA_INDICATOR];
- length = min(length, header->image_length - 0x18 - offset);
+ length = uimin(length, header->image_length - 0x18 - offset);
bus_space_read_region_1(tag, handle, dataptr + 0x18 + offset,
buf, length);
ret = length;
diff --git a/sys/dev/dksubr.c b/sys/dev/dksubr.c
index cdcdf9a5934..d12e3e616c5 100644
--- a/sys/dev/dksubr.c
+++ b/sys/dev/dksubr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.102 2018/05/12 10:33:06 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.103 2018/09/03 16:29:30 riastradh Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.102 2018/05/12 10:33:06 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.103 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -521,7 +521,7 @@ dk_discard(struct dk_softc *dksc, dev_t dev, off_t pos, off_t len)
/* enough data to please the bounds checking code */
bp->b_dev = dev;
bp->b_blkno = (daddr_t)(pos / secsize);
- bp->b_bcount = min(len, maxsz);
+ bp->b_bcount = uimin(len, maxsz);
bp->b_flags = B_WRITE;
error = dk_translate(dksc, bp);
@@ -847,7 +847,7 @@ dk_dump(struct dk_softc *dksc, dev_t dev,
/* Start dumping and return when done. */
maxblkcnt = howmany(maxxfer, lp->d_secsize);
while (towrt > 0) {
- nblk = min(maxblkcnt, towrt);
+ nblk = uimin(maxblkcnt, towrt);
if ((rv = (*dkd->d_dumpblocks)(dksc->sc_dev, va, blkno, nblk))
!= 0) {
diff --git a/sys/dev/dtv/dtv_buffer.c b/sys/dev/dtv/dtv_buffer.c
index 713ba6bb27a..aa1d1136d96 100644
--- a/sys/dev/dtv/dtv_buffer.c
+++ b/sys/dev/dtv/dtv_buffer.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dtv_buffer.c,v 1.8 2017/06/01 02:45:10 chs Exp $ */
+/* $NetBSD: dtv_buffer.c,v 1.9 2018/09/03 16:29:30 riastradh Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca>
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dtv_buffer.c,v 1.8 2017/06/01 02:45:10 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dtv_buffer.c,v 1.9 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -73,7 +73,7 @@ dtv_buffer_write(struct dtv_softc *sc, const uint8_t *buf, size_t buflen)
db = SIMPLEQ_FIRST(&ds->ds_ingress);
mutex_exit(&ds->ds_ingress_lock);
- avail = min(db->db_length - db->db_bytesused, resid);
+ avail = uimin(db->db_length - db->db_bytesused, resid);
if (dtv_scatter_io_init(&ds->ds_data,
db->db_offset + db->db_bytesused, avail, &sio)) {
dtv_scatter_io_copyin(&sio, buf + offset);
@@ -154,7 +154,7 @@ dtv_buffer_realloc(struct dtv_softc *sc, size_t bufsize)
ds->ds_buf = NULL;
}
- minnbufs = min(nbufs, oldnbufs);
+ minnbufs = uimin(nbufs, oldnbufs);
for (i = 0; i < minnbufs; i++)
ds->ds_buf[i] = oldbuf[i];
for (; i < nbufs; i++)
@@ -269,7 +269,7 @@ retry:
goto retry;
}
- len = min(uio->uio_resid, db->db_bytesused - ds->ds_bytesread);
+ len = uimin(uio->uio_resid, db->db_bytesused - ds->ds_bytesread);
offset = db->db_offset + ds->ds_bytesread;
if (dtv_scatter_io_init(&ds->ds_data, offset, len, &sio)) {
diff --git a/sys/dev/dtv/dtv_demux.c b/sys/dev/dtv/dtv_demux.c
index 8acfd303bc2..d007859609c 100644
--- a/sys/dev/dtv/dtv_demux.c
+++ b/sys/dev/dtv/dtv_demux.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dtv_demux.c,v 1.8 2017/11/30 20:25:55 christos Exp $ */
+/* $NetBSD: dtv_demux.c,v 1.9 2018/09/03 16:29:30 riastradh Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca>
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dtv_demux.c,v 1.8 2017/11/30 20:25:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dtv_demux.c,v 1.9 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -668,7 +668,7 @@ dtv_demux_process(struct dtv_demux *demux, const uint8_t *tspkt,
sec->sec_bytesused = sec->sec_length = 0;
/* Copy data into section buffer */
- avail = min(sec->sec_length - sec->sec_bytesused, brem);
+ avail = uimin(sec->sec_length - sec->sec_bytesused, brem);
if (avail < 0)
goto done;
memcpy(&sec->sec_buf[sec->sec_bytesused], p, avail);
diff --git a/sys/dev/dtv/dtv_scatter.c b/sys/dev/dtv/dtv_scatter.c
index 8078449f997..9e90f75aa3c 100644
--- a/sys/dev/dtv/dtv_scatter.c
+++ b/sys/dev/dtv/dtv_scatter.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dtv_scatter.c,v 1.4 2017/11/09 22:16:34 riastradh Exp $ */
+/* $NetBSD: dtv_scatter.c,v 1.5 2018/09/03 16:29:30 riastradh Exp $ */
/*
* Copyright (c) 2008 Patrick Mahoney <pat@polycrystal.org>
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dtv_scatter.c,v 1.4 2017/11/09 22:16:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dtv_scatter.c,v 1.5 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/param.h>
#include <sys/ioctl.h>
@@ -95,7 +95,7 @@ dtv_scatter_buf_set_size(struct dtv_scatter_buf *sb, size_t sz)
sb->sb_page_ary = NULL;
}
- minpages = min(npages, oldnpages);
+ minpages = uimin(npages, oldnpages);
/* copy any pages that will be reused */
for (i = 0; i < minpages; ++i)
sb->sb_page_ary[i] = old_ary[i];
@@ -174,7 +174,7 @@ dtv_scatter_io_next(struct dtv_scatter_io *sio, void **p, size_t *sz)
pg = sio->sio_offset >> PAGE_SHIFT;
pgo = sio->sio_offset & PAGE_MASK;
- *sz = min(PAGE_SIZE - pgo, sio->sio_resid);
+ *sz = uimin(PAGE_SIZE - pgo, sio->sio_resid);
*p = sio->sio_buf->sb_page_ary[pg] + pgo;
sio->sio_offset += *sz;
diff --git a/sys/dev/gpib/ppi.c b/sys/dev/gpib/ppi.c
index a1e4c51bceb..e7a06ea19ad 100644
--- a/sys/dev/gpib/ppi.c
+++ b/sys/dev/gpib/ppi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ppi.c,v 1.23 2017/10/28 04:53:56 riastradh Exp $ */
+/* $NetBSD: ppi.c,v 1.24 2018/09/03 16:29:30 riastradh Exp $ */
/*-
* Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ppi.c,v 1.23 2017/10/28 04:53:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppi.c,v 1.24 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -303,7 +303,7 @@ ppirw(dev_t dev, struct uio *uio)
dev, uio, uio->uio_rw == UIO_READ ? 'R' : 'W',
sc->sc_burst, sc->sc_timo, uio->uio_resid));
- buflen = min(sc->sc_burst, uio->uio_resid);
+ buflen = uimin(sc->sc_burst, uio->uio_resid);
buf = (char *)malloc(buflen, M_DEVBUF, M_WAITOK);
sc->sc_flags |= PPIF_UIO;
if (sc->sc_timo > 0) {
@@ -312,7 +312,7 @@ ppirw(dev_t dev, struct uio *uio)
}
len = cnt = 0;
while (uio->uio_resid > 0) {
- len = min(buflen, uio->uio_resid);
+ len = uimin(buflen, uio->uio_resid);
cp = buf;
if (uio->uio_rw == UIO_WRITE) {
error = uiomove(cp, len, uio);
diff --git a/sys/dev/hid/hid.c b/sys/dev/hid/hid.c
index 64c870cdfd2..25407d95201 100644
--- a/sys/dev/hid/hid.c
+++ b/sys/dev/hid/hid.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hid.c,v 1.1 2017/12/10 17:03:07 bouyer Exp $ */
+/* $NetBSD: hid.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $ */
/* $FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.1 2017/12/10 17:03:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -132,7 +132,7 @@ hid_get_item(struct hid_data *s, struct hid_item *h)
s->multi, s->multimax));
if (s->multimax != 0) {
if (s->multi < s->multimax) {
- c->usage = s->usages[min(s->multi, s->nu-1)];
+ c->usage = s->usages[uimin(s->multi, s->nu-1)];
s->multi++;
*h = *c;
c->loc.pos += c->loc.size;
diff --git a/sys/dev/hil/hil.c b/sys/dev/hil/hil.c
index 5cb9582f941..546b5583a70 100644
--- a/sys/dev/hil/hil.c
+++ b/sys/dev/hil/hil.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hil.c,v 1.2 2011/02/15 11:05:51 tsutsui Exp $ */
+/* $NetBSD: hil.c,v 1.3 2018/09/03 16:29:31 riastradh Exp $ */
/* $OpenBSD: hil.c,v 1.24 2010/11/20 16:45:46 miod Exp $ */
/*
* Copyright (c) 2003, 2004, Miodrag Vallat.
@@ -762,7 +762,7 @@ send_hildev_cmd(struct hildev_softc *hdsc, u_int cmd,
* Return the command response in the buffer if necessary
*/
if (outbuf != NULL && outlen != NULL) {
- *outlen = min(*outlen, sc->sc_cmdbp - sc->sc_cmdbuf);
+ *outlen = uimin(*outlen, sc->sc_cmdbp - sc->sc_cmdbuf);
memcpy(outbuf, sc->sc_cmdbuf, *outlen);
}
}
diff --git a/sys/dev/i2c/ddc.c b/sys/dev/i2c/ddc.c
index a94bbbaa2ba..4cfc45065c2 100644
--- a/sys/dev/i2c/ddc.c
+++ b/sys/dev/i2c/ddc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ddc.c,v 1.7 2018/06/16 21:22:13 thorpej Exp $ */
+/* $NetBSD: ddc.c,v 1.8 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ddc.c,v 1.7 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddc.c,v 1.8 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -115,9 +115,9 @@ ddc_read_edid_block(i2c_tag_t tag, uint8_t *dest, size_t len, uint8_t block)
iic_release_bus(tag, I2C_F_POLL);
if (block & 1) {
- memcpy(dest, &edid[128], min(len, 128));
+ memcpy(dest, &edid[128], uimin(len, 128));
} else {
- memcpy(dest, &edid[0], min(len, 128));
+ memcpy(dest, &edid[0], uimin(len, 128));
}
return 0;
diff --git a/sys/dev/i2c/fcu.c b/sys/dev/i2c/fcu.c
index 0d17cab1c19..5670c4f3f13 100644
--- a/sys/dev/i2c/fcu.c
+++ b/sys/dev/i2c/fcu.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fcu.c,v 1.7 2018/06/28 21:21:03 macallan Exp $ */
+/* $NetBSD: fcu.c,v 1.8 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2018 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.7 2018/06/28 21:21:03 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.8 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -431,10 +431,10 @@ fcu_set_fan_rpm(struct fcu_softc *sc, fcu_fan_t *f, int speed)
diff = data - speed;
DPRINTF("d %d s %d t %d diff %d ", f->duty, data, speed, diff);
if (diff > 100) {
- nduty = max(20, nduty - 1);
+ nduty = uimax(20, nduty - 1);
}
if (diff < -100) {
- nduty = min(0xd0, nduty + 1);
+ nduty = uimin(0xd0, nduty + 1);
}
cmd = f->reg;
DPRINTF("%s nduty %d", __func__, nduty);
diff --git a/sys/dev/i2c/ibmhawk.c b/sys/dev/i2c/ibmhawk.c
index ee74a20c150..675ba0a3e6e 100644
--- a/sys/dev/i2c/ibmhawk.c
+++ b/sys/dev/i2c/ibmhawk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ibmhawk.c,v 1.7 2018/06/16 21:22:13 thorpej Exp $ */
+/* $NetBSD: ibmhawk.c,v 1.8 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -136,8 +136,8 @@ ibmhawk_attach(device_t parent, device_t self, void *aux)
aprint_error_dev(sc->sc_dev, "equip query failed\n");
return;
}
- sc->sc_numcpus = min(resp.ihr_numcpus, IBMHAWK_MAX_CPU);
- sc->sc_numfans = min(resp.ihr_numfans, IBMHAWK_MAX_FAN);
+ sc->sc_numcpus = uimin(resp.ihr_numcpus, IBMHAWK_MAX_CPU);
+ sc->sc_numfans = uimin(resp.ihr_numfans, IBMHAWK_MAX_FAN);
#if IBMHAWK_DEBUG > 0
aprint_normal_dev(sc->sc_dev, "monitoring %d/%d cpu(s) %d/%d fan(s)\n",
sc->sc_numcpus, resp.ihr_numcpus, sc->sc_numfans, resp.ihr_numfans);
@@ -258,7 +258,7 @@ again:
bad:
#if IBMHAWK_DEBUG > 1
- for (i = 0; i < min(buf[0]+1, sizeof buf); i++)
+ for (i = 0; i < uimin(buf[0]+1, sizeof buf); i++)
printf(" %02x", buf[i]);
printf(" ] => %d\n", error);
#endif
diff --git a/sys/dev/i2c/xc3028.c b/sys/dev/i2c/xc3028.c
index 68752c70145..56ac60efa2d 100644
--- a/sys/dev/i2c/xc3028.c
+++ b/sys/dev/i2c/xc3028.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xc3028.c,v 1.8 2017/06/01 02:45:10 chs Exp $ */
+/* $NetBSD: xc3028.c,v 1.9 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca>
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xc3028.c,v 1.8 2017/06/01 02:45:10 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xc3028.c,v 1.9 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -401,7 +401,7 @@ xc3028_firmware_upload(struct xc3028 *xc, struct xc3028_fw *xcfw)
p = &fw[i + 1];
rem = len - 1;
while (rem > 0) {
- wrlen = min(rem, __arraycount(cmd) - 1);
+ wrlen = uimin(rem, __arraycount(cmd) - 1);
memcpy(&cmd[1], p, wrlen);
error = xc3028_write_buffer(xc, cmd, wrlen + 1);
if (error)
diff --git a/sys/dev/i2c/xc5k.c b/sys/dev/i2c/xc5k.c
index 0fb59c89ba2..13d89c2f83e 100644
--- a/sys/dev/i2c/xc5k.c
+++ b/sys/dev/i2c/xc5k.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xc5k.c,v 1.8 2018/04/12 21:14:53 christos Exp $ */
+/* $NetBSD: xc5k.c,v 1.9 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2010 Jared D. McNeill <jmcneill@invisible.ca>
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xc5k.c,v 1.8 2018/04/12 21:14:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xc5k.c,v 1.9 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -111,7 +111,7 @@ xc5k_firmware_upload(struct xc5k *xc, const uint8_t *fw, size_t fwlen)
p = &fw[i + 2];
rem = len - 2;
while (rem > 0) {
- wrlen = min(rem, __arraycount(cmd) - 2);
+ wrlen = uimin(rem, __arraycount(cmd) - 2);
memcpy(&cmd[2], p, wrlen);
error = xc5k_write_buffer(xc, cmd, wrlen + 2);
if (error)
diff --git a/sys/dev/i2o/dpti.c b/sys/dev/i2o/dpti.c
index ac99654fb50..519c00f5a75 100644
--- a/sys/dev/i2o/dpti.c
+++ b/sys/dev/i2o/dpti.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dpti.c,v 1.49 2017/10/28 04:53:55 riastradh Exp $ */
+/* $NetBSD: dpti.c,v 1.50 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dpti.c,v 1.49 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dpti.c,v 1.50 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -353,7 +353,7 @@ dpti_ctlrinfo(struct dpti_softc *sc, int size, void *data)
info.Interrupt = 10; /* XXX */
if (size > sizeof(char)) {
- memcpy(data, &info, min(sizeof(info), size));
+ memcpy(data, &info, uimin(sizeof(info), size));
rv = 0;
} else
rv = copyout(&info, *(void **)data, sizeof(info));
@@ -438,7 +438,7 @@ dpti_sysinfo(struct dpti_softc *sc, int size, void *data)
* Copy out the info structure to the user.
*/
if (size > sizeof(char)) {
- memcpy(data, &info, min(sizeof(info), size));
+ memcpy(data, &info, uimin(sizeof(info), size));
rv = 0;
} else
rv = copyout(&info, *(void **)data, sizeof(info));
diff --git a/sys/dev/i2o/iop.c b/sys/dev/i2o/iop.c
index 66b906d824f..df93b71b60a 100644
--- a/sys/dev/i2o/iop.c
+++ b/sys/dev/i2o/iop.c
@@ -1,4 +1,4 @@
-/* $NetBSD: iop.c,v 1.88 2017/10/28 04:53:55 riastradh Exp $ */
+/* $NetBSD: iop.c,v 1.89 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2000, 2001, 2002, 2007 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.88 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.89 2018/09/03 16:29:31 riastradh Exp $");
#include "iop.h"
@@ -2018,7 +2018,7 @@ iop_msg_map_bio(struct iop_softc *sc, struct iop_msg *im, u_int32_t *mb,
while (slen > 0) {
eaddr = (saddr + PAGE_SIZE) & ~(PAGE_SIZE - 1);
- tlen = min(eaddr - saddr, slen);
+ tlen = uimin(eaddr - saddr, slen);
slen -= tlen;
*p++ = le32toh(saddr);
saddr = eaddr;
diff --git a/sys/dev/ic/aic6360.c b/sys/dev/ic/aic6360.c
index 8ffc22f89ec..2f2a19dc68b 100644
--- a/sys/dev/ic/aic6360.c
+++ b/sys/dev/ic/aic6360.c
@@ -1,4 +1,4 @@
-/* $NetBSD: aic6360.c,v 1.101 2017/10/28 04:53:55 riastradh Exp $ */
+/* $NetBSD: aic6360.c,v 1.102 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Charles M. Hannum. All rights reserved.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aic6360.c,v 1.101 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic6360.c,v 1.102 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_ddb.h"
@@ -1621,7 +1621,7 @@ aic_datain_pio(struct aic_softc *sc, u_char *p, int n)
} else {
int xfer;
- xfer = min(bus_space_read_1(iot, ioh, FIFOSTAT), n);
+ xfer = uimin(bus_space_read_1(iot, ioh, FIFOSTAT), n);
AIC_MISC((">%d ", xfer));
n -= xfer;
diff --git a/sys/dev/ic/an.c b/sys/dev/ic/an.c
index d4b0b5a2e50..4f32b99c1af 100644
--- a/sys/dev/ic/an.c
+++ b/sys/dev/ic/an.c
@@ -1,4 +1,4 @@
-/* $NetBSD: an.c,v 1.68 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: an.c,v 1.69 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
* Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.68 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.69 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
@@ -1761,7 +1761,7 @@ an_mwrite_bap(struct an_softc *sc, int id, int off, struct mbuf *m, int totlen)
for (len = 0; m != NULL; m = m->m_next) {
if (m->m_len == 0)
continue;
- len = min(m->m_len, totlen);
+ len = uimin(m->m_len, totlen);
if ((mtod(m, u_long) & 0x1) || (len & 0x1)) {
m_copydata(m, 0, totlen, (void *)&sc->sc_buf.sc_txbuf);
diff --git a/sys/dev/ic/atppc.c b/sys/dev/ic/atppc.c
index bf34e266d9f..980486fb310 100644
--- a/sys/dev/ic/atppc.c
+++ b/sys/dev/ic/atppc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: atppc.c,v 1.33 2017/06/01 02:45:10 chs Exp $ */
+/* $NetBSD: atppc.c,v 1.34 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 2001 Alcove - Nicolas Souchu
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atppc.c,v 1.33 2017/06/01 02:45:10 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atppc.c,v 1.34 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_atppc.h"
@@ -1883,7 +1883,7 @@ atppc_ecp_read_dma(struct atppc_softc *atppc, unsigned int *length,
unsigned char ecr)
{
/* Limit transfer to maximum DMA size and start it */
- *length = min(*length, atppc->sc_dma_maxsize);
+ *length = uimin(*length, atppc->sc_dma_maxsize);
atppc->sc_dmastat = ATPPC_DMA_INIT;
atppc->sc_dma_start(atppc, atppc->sc_inbstart, *length,
ATPPC_DMA_MODE_READ);
@@ -2109,7 +2109,7 @@ atppc_fifo_write_dma(struct atppc_softc * const atppc, unsigned char ecr,
atppc_barrier_w(atppc);
/* Limit transfer to maximum DMA size and start it */
- worklen = min(len, atppc->sc_dma_maxsize);
+ worklen = uimin(len, atppc->sc_dma_maxsize);
atppc->sc_dmastat = ATPPC_DMA_INIT;
atppc->sc_dma_start(atppc, atppc->sc_outbstart,
worklen, ATPPC_DMA_MODE_WRITE);
@@ -2194,7 +2194,7 @@ atppc_fifo_write_pio(struct atppc_softc * const atppc, unsigned char ecr,
return;
/* Limit transfer to minimum of space in FIFO and buffer */
- worklen = min(len, atppc->sc_fifo);
+ worklen = uimin(len, atppc->sc_fifo);
/* Write to FIFO */
atppc_w_fifo_multi(atppc, atppc->sc_outbstart, worklen);
diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c
index 2bea98acbab..a569ec6b110 100644
--- a/sys/dev/ic/cac.c
+++ b/sys/dev/ic/cac.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cac.c,v 1.58 2017/10/28 04:53:55 riastradh Exp $ */
+/* $NetBSD: cac.c,v 1.59 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2000, 2006, 2007 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.58 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.59 2018/09/03 16:29:31 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "bio.h"
@@ -333,7 +333,7 @@ cac_cmd(struct cac_softc *sc, int command, void *data, int datasize,
BUS_DMASYNC_PREWRITE);
sgb = ccb->ccb_seg;
- nsegs = min(ccb->ccb_dmamap_xfer->dm_nsegs, CAC_SG_SIZE);
+ nsegs = uimin(ccb->ccb_dmamap_xfer->dm_nsegs, CAC_SG_SIZE);
for (i = 0; i < nsegs; i++, sgb++) {
size += ccb->ccb_dmamap_xfer->dm_segs[i].ds_len;
diff --git a/sys/dev/ic/ciss.c b/sys/dev/ic/ciss.c
index d75f99e5dcd..93437bc50df 100644
--- a/sys/dev/ic/ciss.c
+++ b/sys/dev/ic/ciss.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ciss.c,v 1.38 2018/02/12 23:11:00 joerg Exp $ */
+/* $NetBSD: ciss.c,v 1.39 2018/09/03 16:29:31 riastradh Exp $ */
/* $OpenBSD: ciss.c,v 1.68 2013/05/30 16:15:02 deraadt Exp $ */
/*
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.38 2018/02/12 23:11:00 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.39 2018/09/03 16:29:31 riastradh Exp $");
#include "bio.h"
@@ -380,7 +380,7 @@ ciss_attach(struct ciss_softc *sc)
sc->sc_adapter.adapt_dev = sc->sc_dev;
sc->sc_adapter.adapt_openings = sc->sc_channel.chan_openings;
- sc->sc_adapter.adapt_max_periph = min(sc->sc_adapter.adapt_openings, 256);
+ sc->sc_adapter.adapt_max_periph = uimin(sc->sc_adapter.adapt_openings, 256);
sc->sc_adapter.adapt_request = ciss_scsi_cmd;
sc->sc_adapter.adapt_minphys = cissminphys;
sc->sc_adapter.adapt_ioctl = ciss_scsi_ioctl;
diff --git a/sys/dev/ic/clmpcc.c b/sys/dev/ic/clmpcc.c
index cdce4c9dbe1..36cbb5494c3 100644
--- a/sys/dev/ic/clmpcc.c
+++ b/sys/dev/ic/clmpcc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: clmpcc.c,v 1.52 2017/10/28 04:53:55 riastradh Exp $ */
+/* $NetBSD: clmpcc.c,v 1.53 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clmpcc.c,v 1.52 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clmpcc.c,v 1.53 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_ddb.h"
@@ -1233,7 +1233,7 @@ clmpcc_txintr(void *arg)
}
if ( ch->ch_obuf_size > 0 ) {
- u_int n = min(ch->ch_obuf_size, ftc);
+ u_int n = uimin(ch->ch_obuf_size, ftc);
clmpcc_wrtx_multi(sc, ch->ch_obuf_addr, n);
diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c
index e3a4c96a50d..8e85dfc4945 100644
--- a/sys/dev/ic/dp8390.c
+++ b/sys/dev/ic/dp8390.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dp8390.c,v 1.90 2018/07/15 05:16:45 maxv Exp $ */
+/* $NetBSD: dp8390.c,v 1.91 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -14,7 +14,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.90 2018/07/15 05:16:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.91 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_inet.h"
@@ -1042,7 +1042,7 @@ dp8390_get(struct dp8390_softc *sc, int src, u_short total_len)
m->m_data = newdata;
}
- m->m_len = len = min(total_len, len);
+ m->m_len = len = uimin(total_len, len);
src = (*sc->ring_copy)(sc, src, mtod(m, void *), len);
total_len -= len;
diff --git a/sys/dev/ic/dpt.c b/sys/dev/ic/dpt.c
index f014fad533f..b1f219557a2 100644
--- a/sys/dev/ic/dpt.c
+++ b/sys/dev/ic/dpt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dpt.c,v 1.74 2017/10/28 04:53:55 riastradh Exp $ */
+/* $NetBSD: dpt.c,v 1.75 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.74 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.75 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -346,7 +346,7 @@ dpt_init(struct dpt_softc *sc, const char *intrstr)
* Allocate the CCB/status packet/scratch DMA map and load.
*/
sc->sc_nccbs =
- min(be16toh(*(int16_t *)ec->ec_queuedepth), DPT_MAX_CCBS);
+ uimin(be16toh(*(int16_t *)ec->ec_queuedepth), DPT_MAX_CCBS);
sc->sc_stpoff = sc->sc_nccbs * sizeof(struct dpt_ccb);
sc->sc_scroff = sc->sc_stpoff + sizeof(struct eata_sp);
mapsize = sc->sc_nccbs * sizeof(struct dpt_ccb) +
@@ -1134,7 +1134,7 @@ dptioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
switch (cmd & 0xffff) {
case DPT_SIGNATURE:
- memcpy(data, &dpt_sig, min(IOCPARM_LEN(cmd), sizeof(dpt_sig)));
+ memcpy(data, &dpt_sig, uimin(IOCPARM_LEN(cmd), sizeof(dpt_sig)));
break;
case DPT_CTRLINFO:
@@ -1375,7 +1375,7 @@ dpt_passthrough(struct dpt_softc *sc, struct eata_ucp *ucp, struct lwp *l)
}
}
if (rv == 0 && ucp->ucp_senseaddr != NULL) {
- i = min(uslen, sizeof(ccb->ccb_sense));
+ i = uimin(uslen, sizeof(ccb->ccb_sense));
rv = copyout(&ccb->ccb_sense, ucp->ucp_senseaddr, i);
if (rv != 0) {
DPRINTF(("%s: sense copyout() failed\n",
diff --git a/sys/dev/ic/dwc_mmc.c b/sys/dev/ic/dwc_mmc.c
index d0abfb23bbd..234495ad9cf 100644
--- a/sys/dev/ic/dwc_mmc.c
+++ b/sys/dev/ic/dwc_mmc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_mmc.c,v 1.14 2018/07/02 12:47:19 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.15 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2014-2017 Jared McNeill <jmcneill@invisible.ca>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.14 2018/07/02 12:47:19 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.15 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -480,12 +480,12 @@ dwc_mmc_dma_prepare(struct dwc_mmc_softc *sc, struct sdmmc_command *cmd)
for (seg = 0; seg < cmd->c_dmamap->dm_nsegs; seg++) {
bus_addr_t paddr = cmd->c_dmamap->dm_segs[seg].ds_addr;
bus_size_t len = cmd->c_dmamap->dm_segs[seg].ds_len;
- resid = min(len, cmd->c_resid);
+ resid = uimin(len, cmd->c_resid);
off = 0;
while (resid > 0) {
if (desc == sc->sc_idma_ndesc)
break;
- len = min(sc->sc_idma_xferlen, resid);
+ len = uimin(sc->sc_idma_xferlen, resid);
dma[desc].dma_buf_size = htole32(len);
dma[desc].dma_buf_addr = htole32(paddr + off);
dma[desc].dma_config = htole32(
diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c
index 80f59cb0eb1..b6d983a4581 100644
--- a/sys/dev/ic/elink3.c
+++ b/sys/dev/ic/elink3.c
@@ -1,4 +1,4 @@
-/* $NetBSD: elink3.c,v 1.142 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: elink3.c,v 1.143 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.142 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.143 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_inet.h"
@@ -1341,7 +1341,7 @@ eptxstat(struct ep_softc *sc)
device_xname(sc->sc_dev), i,
sc->tx_start_thresh);
if (sc->tx_succ_ok < 100)
- sc->tx_start_thresh = min(ETHER_MAX_LEN,
+ sc->tx_start_thresh = uimin(ETHER_MAX_LEN,
sc->tx_start_thresh + 20);
sc->tx_succ_ok = 0;
epreset(sc);
diff --git a/sys/dev/ic/elinkxl.c b/sys/dev/ic/elinkxl.c
index f22deb6f8ff..a7baa27eebf 100644
--- a/sys/dev/ic/elinkxl.c
+++ b/sys/dev/ic/elinkxl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: elinkxl.c,v 1.124 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: elinkxl.c,v 1.125 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.124 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.125 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -816,7 +816,7 @@ ex_txstat(struct ex_softc *sc)
if (err & TXS_UNDERRUN) {
aprint_error(" @%d", sc->tx_start_thresh);
if (sc->tx_succ_ok < 256 &&
- (i = min(ETHER_MAX_LEN, sc->tx_start_thresh + 20))
+ (i = uimin(ETHER_MAX_LEN, sc->tx_start_thresh + 20))
> sc->tx_start_thresh) {
aprint_error(", new threshold is %d", i);
sc->tx_start_thresh = i;
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c
index 23c9ddad3c7..2033e07e308 100644
--- a/sys/dev/ic/gem.c
+++ b/sys/dev/ic/gem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gem.c,v 1.110 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: gem.c,v 1.111 2018/09/03 16:29:31 riastradh Exp $ */
/*
*
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.110 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.111 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_inet.h"
@@ -1158,7 +1158,7 @@ gem_init(struct ifnet *ifp)
/* step 4. TX MAC registers & counters */
gem_init_regs(sc);
- max_frame_size = max(sc->sc_ethercom.ec_if.if_mtu, ETHERMTU);
+ max_frame_size = uimax(sc->sc_ethercom.ec_if.if_mtu, ETHERMTU);
max_frame_size += ETHER_HDR_LEN + ETHER_CRC_LEN;
if (sc->sc_ethercom.ec_capenable & ETHERCAP_VLAN_MTU)
max_frame_size += ETHER_VLAN_ENCAP_LEN;
diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c
index ed990bbf88d..6467ef0ea02 100644
--- a/sys/dev/ic/hme.c
+++ b/sys/dev/ic/hme.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hme.c,v 1.99 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: hme.c,v 1.100 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.99 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.100 2018/09/03 16:29:31 riastradh Exp $");
/* #define HMEDEBUG */
@@ -718,7 +718,7 @@ hme_get(struct hme_softc *sc, int ri, uint32_t flags)
m->m_data = newdata;
}
- m->m_len = len = min(totlen, len);
+ m->m_len = len = uimin(totlen, len);
memcpy(mtod(m, void *), bp, len);
bp += len;
diff --git a/sys/dev/ic/i82586.c b/sys/dev/ic/i82586.c
index ee5a250c176..91b4641cf35 100644
--- a/sys/dev/ic/i82586.c
+++ b/sys/dev/ic/i82586.c
@@ -1,4 +1,4 @@
-/* $NetBSD: i82586.c,v 1.78 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: i82586.c,v 1.79 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -137,7 +137,7 @@ Mode of operation:
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.78 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82586.c,v 1.79 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
@@ -930,7 +930,7 @@ ieget(struct ie_softc *sc, int head, int totlen)
m->m_data = newdata;
}
- m->m_len = len = min(totlen, len);
+ m->m_len = len = uimin(totlen, len);
totlen -= len;
if (totlen > 0) {
@@ -961,7 +961,7 @@ ieget(struct ie_softc *sc, int head, int totlen)
while (resid > 0) {
int thisrblen = IE_RBUF_SIZE - thisrboff,
thismblen = m->m_len - thismboff;
- len = min(thisrblen, thismblen);
+ len = uimin(thisrblen, thismblen);
(sc->memcopyin)(sc, mtod(m, char *) + thismboff,
IE_RBUF_ADDR(sc,head) + thisrboff,
diff --git a/sys/dev/ic/igsfb_subr.c b/sys/dev/ic/igsfb_subr.c
index 7c960701629..7b33c27b17e 100644
--- a/sys/dev/ic/igsfb_subr.c
+++ b/sys/dev/ic/igsfb_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: igsfb_subr.c,v 1.14 2017/04/03 17:40:07 christos Exp $ */
+/* $NetBSD: igsfb_subr.c,v 1.15 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 2002 Valeriy E. Ushakov
@@ -32,7 +32,7 @@
* Integraphics Systems IGA 168x and CyberPro series.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: igsfb_subr.c,v 1.14 2017/04/03 17:40:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: igsfb_subr.c,v 1.15 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -542,7 +542,7 @@ igsfb_set_mode(struct igsfb_devconfig *dc, const struct videomode *mode,
hsync_start = mode->hsync_start;
hsync_end = mode->hsync_end;
- hblank_start = min(mode->hsync_start, mode->hdisplay);
+ hblank_start = uimin(mode->hsync_start, mode->hdisplay);
hblank_end = hsync_end;
if ((hblank_end - hblank_start) >= 63 * 8) {
@@ -552,7 +552,7 @@ igsfb_set_mode(struct igsfb_devconfig *dc, const struct videomode *mode,
hblank_start = hblank_end - 63 * 8;
}
- vblank_start = min(mode->vsync_start, mode->vdisplay);
+ vblank_start = uimin(mode->vsync_start, mode->vdisplay);
vblank_end = mode->vsync_end;
vsync_start = mode->vsync_start;
diff --git a/sys/dev/ic/isp_netbsd.c b/sys/dev/ic/isp_netbsd.c
index c8e361616c4..9c018a0bffa 100644
--- a/sys/dev/ic/isp_netbsd.c
+++ b/sys/dev/ic/isp_netbsd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.89 2017/07/28 15:02:52 riastradh Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.90 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Platform (NetBSD) dependent common attachment code for Qlogic adapters.
*/
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.89 2017/07/28 15:02:52 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.90 2018/09/03 16:29:31 riastradh Exp $");
#include <dev/ic/isp_netbsd.h>
#include <dev/ic/isp_ioctl.h>
@@ -105,7 +105,7 @@ isp_attach(struct ispsoftc *isp)
* It's not stated whether max_periph is limited by SPI
* tag uage, but let's assume that it is.
*/
- isp->isp_osinfo.adapter.adapt_max_periph = min(isp->isp_maxcmds, 255);
+ isp->isp_osinfo.adapter.adapt_max_periph = uimin(isp->isp_maxcmds, 255);
isp->isp_osinfo.adapter.adapt_ioctl = ispioctl;
isp->isp_osinfo.adapter.adapt_request = isprequest;
if (isp->isp_type <= ISP_HA_SCSI_1020A) {
@@ -137,7 +137,7 @@ isp_attach(struct ispsoftc *isp)
* Until the midlayer is fixed to use REPORT LUNS,
* limit to 8 luns.
*/
- isp->isp_osinfo.chan[i].chan_nluns = min(isp->isp_maxluns, 8);
+ isp->isp_osinfo.chan[i].chan_nluns = uimin(isp->isp_maxluns, 8);
if (IS_FC(isp)) {
isp->isp_osinfo.chan[i].chan_ntargets = MAX_FC_TARG;
if (ISP_CAP_2KLOGIN(isp) == 0 && MAX_FC_TARG > 256) {
diff --git a/sys/dev/ic/isp_target.c b/sys/dev/ic/isp_target.c
index 1bb557bb2c9..9c4c67d5c2f 100644
--- a/sys/dev/ic/isp_target.c
+++ b/sys/dev/ic/isp_target.c
@@ -1,4 +1,4 @@
--/* $NetBSD: isp_target.c,v 1.34 2010/03/26 20:52:00 mjacob Exp $ */
+-/* $NetBSD: isp_target.c,v 1.35 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1997-2008 by Matthew Jacob
* All rights reserved.
@@ -65,7 +65,7 @@
#ifdef __NetBSD__
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isp_target.c,v 1.34 2010/03/26 20:52:00 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_target.c,v 1.35 2018/09/03 16:29:31 riastradh Exp $");
#include <dev/ic/isp_netbsd.h>
#endif
#ifdef __FreeBSD__
@@ -686,7 +686,7 @@ isp_endcmd(ispsoftc_t *isp, ...)
} else if (code & ECMD_SVALID) {
cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
cto->ct_scsi_status |= (FCP_SNSLEN_VALID << 8);
- cto->rsp.m1.ct_resplen = cto->ct_senselen = min(16, MAXRESPLEN_24XX);
+ cto->rsp.m1.ct_resplen = cto->ct_senselen = uimin(16, MAXRESPLEN_24XX);
ISP_MEMZERO(cto->rsp.m1.ct_resp, sizeof (cto->rsp.m1.ct_resp));
cto->rsp.m1.ct_resp[0] = 0xf0;
cto->rsp.m1.ct_resp[2] = (code >> 12) & 0xf;
diff --git a/sys/dev/ic/lance.c b/sys/dev/ic/lance.c
index 0f1f48be929..f549a78c63e 100644
--- a/sys/dev/ic/lance.c
+++ b/sys/dev/ic/lance.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lance.c,v 1.53 2018/06/22 04:17:42 msaitoh Exp $ */
+/* $NetBSD: lance.c,v 1.54 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.53 2018/06/22 04:17:42 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.54 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -391,7 +391,7 @@ lance_get(struct lance_softc *sc, int boff, int totlen)
m->m_data = newdata;
}
- m->m_len = len = min(totlen, len);
+ m->m_len = len = uimin(totlen, len);
(*sc->sc_copyfrombuf)(sc, mtod(m, void *), boff, len);
boff += len;
@@ -764,14 +764,14 @@ lance_copytobuf_gap16(struct lance_softc *sc, void *fromv, int boff, int len)
bptr = buf + ((boff << 1) & ~0x1f);
boff &= 0xf;
- xfer = min(len, 16 - boff);
+ xfer = uimin(len, 16 - boff);
while (len > 0) {
memcpy(bptr + boff, from, xfer);
from += xfer;
bptr += 32;
boff = 0;
len -= xfer;
- xfer = min(len, 16);
+ xfer = uimin(len, 16);
}
}
@@ -785,14 +785,14 @@ lance_copyfrombuf_gap16(struct lance_softc *sc, void *tov, int boff, int len)
bptr = buf + ((boff << 1) & ~0x1f);
boff &= 0xf;
- xfer = min(len, 16 - boff);
+ xfer = uimin(len, 16 - boff);
while (len > 0) {
memcpy(to, bptr + boff, xfer);
to += xfer;
bptr += 32;
boff = 0;
len -= xfer;
- xfer = min(len, 16);
+ xfer = uimin(len, 16);
}
}
@@ -805,13 +805,13 @@ lance_zerobuf_gap16(struct lance_softc *sc, int boff, int len)
bptr = buf + ((boff << 1) & ~0x1f);
boff &= 0xf;
- xfer = min(len, 16 - boff);
+ xfer = uimin(len, 16 - boff);
while (len > 0) {
memset(bptr + boff, 0, xfer);
bptr += 32;
boff = 0;
len -= xfer;
- xfer = min(len, 16);
+ xfer = uimin(len, 16);
}
}
#endif /* Example only */
diff --git a/sys/dev/ic/lpt.c b/sys/dev/ic/lpt.c
index 2c1374ab241..130f0ed9e55 100644
--- a/sys/dev/ic/lpt.c
+++ b/sys/dev/ic/lpt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lpt.c,v 1.81 2017/10/28 04:53:55 riastradh Exp $ */
+/* $NetBSD: lpt.c,v 1.82 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 1993, 1994 Charles M. Hannum.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lpt.c,v 1.81 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lpt.c,v 1.82 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -369,7 +369,7 @@ lptwrite(dev_t dev, struct uio *uio, int flags)
size_t n;
int error = 0;
- while ((n = min(LPT_BSIZE, uio->uio_resid)) != 0) {
+ while ((n = uimin(LPT_BSIZE, uio->uio_resid)) != 0) {
uiomove(sc->sc_cp = sc->sc_inbuf, n, uio);
sc->sc_count = n;
error = lptpushbytes(sc);
diff --git a/sys/dev/ic/lsi64854.c b/sys/dev/ic/lsi64854.c
index 101809f83b5..96cef935611 100644
--- a/sys/dev/ic/lsi64854.c
+++ b/sys/dev/ic/lsi64854.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lsi64854.c,v 1.38 2012/10/27 17:18:21 chs Exp $ */
+/* $NetBSD: lsi64854.c,v 1.39 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lsi64854.c,v 1.38 2012/10/27 17:18:21 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lsi64854.c,v 1.39 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -300,7 +300,7 @@ lsi64854_setup(struct lsi64854_softc *sc, uint8_t **addr, size_t *len,
* and we cannot cross a 16Mb boundary.
*/
*dmasize = sc->sc_dmasize =
- min(*dmasize, DMAMAX((size_t)*sc->sc_dmaaddr));
+ uimin(*dmasize, DMAMAX((size_t)*sc->sc_dmaaddr));
DPRINTF(LDB_ANY, ("%s: dmasize = %ld\n",
__func__, (long)sc->sc_dmasize));
@@ -558,7 +558,7 @@ lsi64854_setup_pp(struct lsi64854_softc *sc, uint8_t **addr, size_t *len,
* and we cannot cross a 16Mb boundary.
*/
*dmasize = sc->sc_dmasize =
- min(*dmasize, DMAMAX((size_t) *sc->sc_dmaaddr));
+ uimin(*dmasize, DMAMAX((size_t) *sc->sc_dmaaddr));
DPRINTF(LDB_PP, ("%s: dmasize = %ld\n",
__func__, (long)sc->sc_dmasize));
diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c
index 7248817df30..bdcdaeecb16 100644
--- a/sys/dev/ic/malo.c
+++ b/sys/dev/ic/malo.c
@@ -1,4 +1,4 @@
-/* $NetBSD: malo.c,v 1.12 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: malo.c,v 1.13 2018/09/03 16:29:31 riastradh Exp $ */
/* $OpenBSD: malo.c,v 1.92 2010/08/27 17:08:00 jsg Exp $ */
/*
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.12 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.13 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -1884,7 +1884,7 @@ malo_hexdump(void *buf, int len)
for (i = 0; i < len; i += l) {
printf("%4i:", i);
- l = min(sizeof(b), len - i);
+ l = uimin(sizeof(b), len - i);
memcpy(b, (char*)buf + i, l);
for (j = 0; j < sizeof(b); j++) {
diff --git a/sys/dev/ic/mb86960.c b/sys/dev/ic/mb86960.c
index b211a604387..0492849772b 100644
--- a/sys/dev/ic/mb86960.c
+++ b/sys/dev/ic/mb86960.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mb86960.c,v 1.87 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: mb86960.c,v 1.88 2018/09/03 16:29:31 riastradh Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.87 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.88 2018/09/03 16:29:31 riastradh Exp $");
/*
* Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards.
@@ -1411,7 +1411,7 @@ mb86960_write_mbufs(struct mb86960_softc *sc, struct mbuf *m)
* packet in the transmission buffer, we can skip the
* padding process. It may gain performance slightly. FIXME.
*/
- len = max(totlen, (ETHER_MIN_LEN - ETHER_CRC_LEN));
+ len = uimax(totlen, (ETHER_MIN_LEN - ETHER_CRC_LEN));
if (sc->sc_flags & FE_FLAGS_SBW_BYTE) {
bus_space_write_1(bst, bsh, FE_BMPR8, len);
bus_space_write_1(bst, bsh, FE_BMPR8, len >> 8);
@@ -1427,7 +1427,7 @@ mb86960_write_mbufs(struct mb86960_softc *sc, struct mbuf *m)
* if the chip is set in SBW_WORD mode.
*/
sc->txb_free -= FE_TXLEN_SIZE +
- max(totlen, (ETHER_MIN_LEN - ETHER_CRC_LEN));
+ uimax(totlen, (ETHER_MIN_LEN - ETHER_CRC_LEN));
sc->txb_count++;
#if FE_DELAYED_PADDING
diff --git a/sys/dev/ic/mb89352.c b/sys/dev/ic/mb89352.c
index 81917c27ada..a712e7f28d9 100644
--- a/sys/dev/ic/mb89352.c
+++ b/sys/dev/ic/mb89352.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mb89352.c,v 1.56 2017/10/28 04:53:55 riastradh Exp $ */
+/* $NetBSD: mb89352.c,v 1.57 2018/09/03 16:29:31 riastradh Exp $ */
/* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */
/*-
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mb89352.c,v 1.56 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mb89352.c,v 1.57 2018/09/03 16:29:31 riastradh Exp $");
#ifdef DDB
#define integrate
@@ -1484,7 +1484,7 @@ spc_dataout_pio(struct spc_softc *sc, uint8_t *p, int n)
DELAY(1);
}
- xfer = min(DOUTAMOUNT, n);
+ xfer = uimin(DOUTAMOUNT, n);
SPC_MISC(("%d> ", xfer));
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c
index 8629e297fcf..f9e9ce1d46a 100644
--- a/sys/dev/ic/mfi.c
+++ b/sys/dev/ic/mfi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.58 2017/10/28 04:53:55 riastradh Exp $ */
+/* $NetBSD: mfi.c,v 1.59 2018/09/03 16:29:31 riastradh Exp $ */
/* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
/*
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.58 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.59 2018/09/03 16:29:31 riastradh Exp $");
#include "bio.h"
@@ -1053,10 +1053,10 @@ mfi_attach(struct mfi_softc *sc, enum mfi_iop iop)
sc->sc_max_cmds = status & MFI_STATE_MAXCMD_MASK;
max_sgl = (status & MFI_STATE_MAXSGL_MASK) >> 16;
if (sc->sc_ioptype == MFI_IOP_TBOLT) {
- sc->sc_max_sgl = min(max_sgl, (128 * 1024) / PAGE_SIZE + 1);
+ sc->sc_max_sgl = uimin(max_sgl, (128 * 1024) / PAGE_SIZE + 1);
sc->sc_sgl_size = sizeof(struct mfi_sg_ieee);
} else if (sc->sc_64bit_dma) {
- sc->sc_max_sgl = min(max_sgl, (128 * 1024) / PAGE_SIZE + 1);
+ sc->sc_max_sgl = uimin(max_sgl, (128 * 1024) / PAGE_SIZE + 1);
sc->sc_sgl_size = sizeof(struct mfi_sg64);
} else {
sc->sc_max_sgl = max_sgl;
diff --git a/sys/dev/ic/midway.c b/sys/dev/ic/midway.c
index 5a6cb274359..660715b8dd5 100644
--- a/sys/dev/ic/midway.c
+++ b/sys/dev/ic/midway.c
@@ -1,4 +1,4 @@
-/* $NetBSD: midway.c,v 1.102 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: midway.c,v 1.103 2018/09/03 16:29:31 riastradh Exp $ */
/* (sync'd to midway.c 1.68) */
/*
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.102 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.103 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_natm.h"
@@ -585,7 +585,7 @@ STATIC INLINE int en_dqneed(struct en_softc *sc, void *data, u_int len, u_int tx
needalign = (((unsigned long) data) % sizeof(u_int32_t));
if (needalign) {
result++;
- sz = min(len, sizeof(u_int32_t) - needalign);
+ sz = uimin(len, sizeof(u_int32_t) - needalign);
len -= sz;
data = (char *)data + sz;
}
@@ -595,7 +595,7 @@ STATIC INLINE int en_dqneed(struct en_softc *sc, void *data, u_int len, u_int tx
needalign = (((unsigned long) data) & sc->bestburstmask);
if (needalign) {
result++; /* alburst */
- sz = min(len, sc->bestburstlen - needalign);
+ sz = uimin(len, sc->bestburstlen - needalign);
len -= sz;
}
}
@@ -658,7 +658,7 @@ STATIC INLINE struct mbuf *en_mget(struct en_softc *sc, u_int totlen, u_int *drq
}
m->m_len = MCLBYTES;
}
- m->m_len = min(totlen, m->m_len);
+ m->m_len = uimin(totlen, m->m_len);
totlen -= m->m_len;
*mp = m;
mp = &m->m_next;
@@ -2381,7 +2381,7 @@ STATIC void en_txlaunch(struct en_softc *sc, int chan, struct en_launch *l)
count = 1;
bcode = MIDDMA_2BYTE;
} else {
- cnt = min(cnt, len); /* prevent overflow */
+ cnt = uimin(cnt, len); /* prevent overflow */
count = cnt;
bcode = MIDDMA_BYTE;
}
diff --git a/sys/dev/ic/mlx.c b/sys/dev/ic/mlx.c
index 855b309eb54..7756455ab7f 100644
--- a/sys/dev/ic/mlx.c
+++ b/sys/dev/ic/mlx.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mlx.c,v 1.66 2017/10/28 04:53:55 riastradh Exp $ */
+/* $NetBSD: mlx.c,v 1.67 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.66 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.67 2018/09/03 16:29:31 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "ld.h"
@@ -480,7 +480,7 @@ mlx_init(struct mlx_softc *mlx, const char *intrstr)
/* Set maximum number of queued commands for `regular' operations. */
mlx->mlx_max_queuecnt =
- min(ci->ci_max_commands, MLX_MAX_QUEUECNT) -
+ uimin(ci->ci_max_commands, MLX_MAX_QUEUECNT) -
MLX_NCCBS_CONTROL;
#ifdef DIAGNOSTIC
if (mlx->mlx_max_queuecnt < MLX_NCCBS_CONTROL + MLX_MAX_DRIVES)
@@ -1005,7 +1005,7 @@ mlx_periodic(struct mlx_softc *mlx)
else
etype = MLX_CMD_ENQUIRY;
- mlx_enquire(mlx, etype, max(sizeof(struct mlx_enquiry),
+ mlx_enquire(mlx, etype, uimax(sizeof(struct mlx_enquiry),
sizeof(struct mlx_enquiry_old)),
mlx_periodic_enquiry, 1);
}
diff --git a/sys/dev/ic/msm6258.c b/sys/dev/ic/msm6258.c
index c71a55d22de..cbd471f4039 100644
--- a/sys/dev/ic/msm6258.c
+++ b/sys/dev/ic/msm6258.c
@@ -1,4 +1,4 @@
-/* $NetBSD: msm6258.c,v 1.24 2017/09/02 12:57:35 isaki Exp $ */
+/* $NetBSD: msm6258.c,v 1.25 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msm6258.c,v 1.24 2017/09/02 12:57:35 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msm6258.c,v 1.25 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/systm.h>
#include <sys/device.h>
@@ -159,7 +159,7 @@ DEFINE_FILTER(msm6258_slinear16_to_adpcm)
if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used * 4)))
return err;
m = dst->end - dst->start;
- m = min(m, max_used);
+ m = uimin(m, max_used);
d = dst->inp;
s = this->src->outp;
enc_src = this->src->param.encoding;
@@ -219,7 +219,7 @@ DEFINE_FILTER(msm6258_linear8_to_adpcm)
if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used * 2)))
return err;
m = dst->end - dst->start;
- m = min(m, max_used);
+ m = uimin(m, max_used);
d = dst->inp;
s = this->src->outp;
enc_src = this->src->param.encoding;
@@ -303,7 +303,7 @@ DEFINE_FILTER(msm6258_adpcm_to_slinear16)
if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used / 4)))
return err;
m = (dst->end - dst->start) & ~3;
- m = min(m, max_used);
+ m = uimin(m, max_used);
d = dst->inp;
s = this->src->outp;
enc_dst = dst->param.encoding;
@@ -365,7 +365,7 @@ DEFINE_FILTER(msm6258_adpcm_to_linear8)
if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used / 2)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
d = dst->inp;
s = this->src->outp;
enc_dst = dst->param.encoding;
diff --git a/sys/dev/ic/mtd803.c b/sys/dev/ic/mtd803.c
index efe951d52d3..1c9fa818904 100644
--- a/sys/dev/ic/mtd803.c
+++ b/sys/dev/ic/mtd803.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mtd803.c,v 1.35 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: mtd803.c,v 1.36 2018/09/03 16:29:31 riastradh Exp $ */
/*-
*
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.35 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.36 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
@@ -602,7 +602,7 @@ mtd_get(struct mtd_softc *sc, int index, int totlen)
m->m_data = newdata;
}
- m->m_len = len = min(totlen, len);
+ m->m_len = len = uimin(totlen, len);
memcpy(mtod(m, void *), buf, len);
buf += len;
diff --git a/sys/dev/ic/mvsata.c b/sys/dev/ic/mvsata.c
index a76f2967706..8d31fe94088 100644
--- a/sys/dev/ic/mvsata.c
+++ b/sys/dev/ic/mvsata.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mvsata.c,v 1.41 2018/08/31 18:43:29 jdolecek Exp $ */
+/* $NetBSD: mvsata.c,v 1.42 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 2008 KIYOHARA Takashi
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.41 2018/08/31 18:43:29 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.42 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_mvsata.h"
@@ -1240,7 +1240,7 @@ do_pio:
cyl = blkno;
head |= WDSD_CHS;
}
- ata_bio->nblks = min(nblks, drvp->multi);
+ ata_bio->nblks = uimin(nblks, drvp->multi);
ata_bio->nbytes = ata_bio->nblks * drvp->lp->d_secsize;
KASSERT(nblks == 1 || (ata_bio->flags & ATA_SINGLE) == 0);
if (ata_bio->nblks > 1)
diff --git a/sys/dev/ic/mx98905.c b/sys/dev/ic/mx98905.c
index 816cef6bed9..db71bcccdec 100644
--- a/sys/dev/ic/mx98905.c
+++ b/sys/dev/ic/mx98905.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mx98905.c,v 1.15 2009/03/14 21:04:20 dsl Exp $ */
+/* $NetBSD: mx98905.c,v 1.16 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: mx98905.c,v 1.15 2009/03/14 21:04:20 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mx98905.c,v 1.16 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/device.h>
#include <sys/mbuf.h>
@@ -181,7 +181,7 @@ mx98905_write_mbuf(struct dp8390_softc *sc, struct mbuf *m, int buf)
resid = savelen = m->m_pkthdr.len;
- dmalen = min(resid, 254);
+ dmalen = uimin(resid, 254);
mx98905_write_setup(sc, dmalen, buf);
@@ -233,7 +233,7 @@ mx98905_write_mbuf(struct dp8390_softc *sc, struct mbuf *m, int buf)
* words as much as we can, then
* buffer the remaining byte, if any.
*/
- len = min(l, dmalen);
+ len = uimin(l, dmalen);
leftover = len & 1;
len &= ~1;
bus_space_write_multi_stream_2(asict,
@@ -247,7 +247,7 @@ mx98905_write_mbuf(struct dp8390_softc *sc, struct mbuf *m, int buf)
}
if (dmalen == 0 && resid > 0) {
mx98905_write_wait(sc);
- dmalen = min(resid, 254);
+ dmalen = uimin(resid, 254);
mx98905_write_setup(sc, dmalen, buf);
@@ -372,7 +372,7 @@ mx98905_readmem(bus_space_tag_t nict, bus_space_handle_t nich, bus_space_tag_t a
++resid;
while (resid > 0) {
- len = min(resid, 254);
+ len = uimin(resid, 254);
mx98905_read_setup(nict, nich, len, src);
if (useword)
bus_space_read_multi_stream_2(asict, asich,
diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c
index b0953ad616e..a96dd6f5e8e 100644
--- a/sys/dev/ic/ncr53c9x.c
+++ b/sys/dev/ic/ncr53c9x.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ncr53c9x.c,v 1.148 2017/07/01 15:54:08 macallan Exp $ */
+/* $NetBSD: ncr53c9x.c,v 1.149 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.148 2017/07/01 15:54:08 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.149 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -2063,7 +2063,7 @@ ncr53c9x_msgout(struct ncr53c9x_softc *sc)
NCRCMD(sc, NCRCMD_TRANS);
} else {
/* (re)send the message */
- size = min(sc->sc_omlen, sc->sc_maxxfer);
+ size = uimin(sc->sc_omlen, sc->sc_maxxfer);
NCRDMA_SETUP(sc, &sc->sc_omp, &sc->sc_omlen, 0, &size);
/* Program the SCSI counter */
NCR_SET_COUNT(sc, size);
@@ -2774,7 +2774,7 @@ msgin:
case DATA_OUT_PHASE:
NCR_PHASE(("DATA_OUT_PHASE [%ld] ",(long)sc->sc_dleft));
NCRCMD(sc, NCRCMD_FLUSH);
- size = min(sc->sc_dleft, sc->sc_maxxfer);
+ size = uimin(sc->sc_dleft, sc->sc_maxxfer);
NCRDMA_SETUP(sc, &sc->sc_dp, &sc->sc_dleft, 0, &size);
sc->sc_prevphase = DATA_OUT_PHASE;
goto setup_xfer;
@@ -2783,7 +2783,7 @@ msgin:
NCR_PHASE(("DATA_IN_PHASE "));
if (sc->sc_rev == NCR_VARIANT_ESP100)
NCRCMD(sc, NCRCMD_FLUSH);
- size = min(sc->sc_dleft, sc->sc_maxxfer);
+ size = uimin(sc->sc_dleft, sc->sc_maxxfer);
NCRDMA_SETUP(sc, &sc->sc_dp, &sc->sc_dleft, 1, &size);
sc->sc_prevphase = DATA_IN_PHASE;
setup_xfer:
diff --git a/sys/dev/ic/pl041.c b/sys/dev/ic/pl041.c
index 99b0c2f95a7..28a45f0cca1 100644
--- a/sys/dev/ic/pl041.c
+++ b/sys/dev/ic/pl041.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl041.c,v 1.4 2018/04/09 10:16:46 jmcneill Exp $ */
+/* $NetBSD: pl041.c,v 1.5 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pl041.c,v 1.4 2018/04/09 10:16:46 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pl041.c,v 1.5 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -106,7 +106,7 @@ aaci_write_data(struct aaci_softc *sc)
return;
while ((AACI_READ(sc, AACISR) & AACISR_TXHE) != 0) {
- const int len = min(AACI_FIFO_DEPTH / 2, min(sc->sc_pblkresid,
+ const int len = uimin(AACI_FIFO_DEPTH / 2, uimin(sc->sc_pblkresid,
(uintptr_t)sc->sc_pend - (uintptr_t)sc->sc_pcur));
KASSERT((len & 3) == 0);
AACI_WRITE_MULTI(sc, AACIDR, sc->sc_pcur, len >> 2);
diff --git a/sys/dev/ic/pl181.c b/sys/dev/ic/pl181.c
index 3cfbc3c6a69..830f00f40df 100644
--- a/sys/dev/ic/pl181.c
+++ b/sys/dev/ic/pl181.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl181.c,v 1.5 2018/02/19 19:00:42 jmcneill Exp $ */
+/* $NetBSD: pl181.c,v 1.6 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pl181.c,v 1.5 2018/02/19 19:00:42 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pl181.c,v 1.6 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -172,7 +172,7 @@ plmmc_intr_xfer(struct plmmc_softc *sc, struct sdmmc_command *cmd)
if (cmd->c_flags & SCF_CMD_READ)
len = sc->sc_fifo_resid - fifo_cnt;
else
- len = min(sc->sc_fifo_resid, PL181_FIFO_DEPTH);
+ len = uimin(sc->sc_fifo_resid, PL181_FIFO_DEPTH);
if (len == 0)
return 0;
@@ -384,7 +384,7 @@ plmmc_do_command(sdmmc_chipset_handle_t sch, struct sdmmc_command *cmd)
KASSERT(mutex_owned(&sc->sc_lock));
- const int xferlen = min(cmd->c_resid, PLMMC_MAXXFER);
+ const int xferlen = uimin(cmd->c_resid, PLMMC_MAXXFER);
sc->sc_cmd = cmd;
sc->sc_fifo_resid = xferlen;
diff --git a/sys/dev/ic/qemufwcfg.c b/sys/dev/ic/qemufwcfg.c
index b7271db7532..02606773e78 100644
--- a/sys/dev/ic/qemufwcfg.c
+++ b/sys/dev/ic/qemufwcfg.c
@@ -1,4 +1,4 @@
-/* $NetBSD: qemufwcfg.c,v 1.1 2017/11/25 16:31:03 jmcneill Exp $ */
+/* $NetBSD: qemufwcfg.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: qemufwcfg.c,v 1.1 2017/11/25 16:31:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qemufwcfg.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -121,7 +121,7 @@ fwcfg_read(dev_t dev, struct uio *uio, int flags)
return ENXIO;
while (uio->uio_resid > 0) {
- count = min(sizeof(buf), uio->uio_resid);
+ count = uimin(sizeof(buf), uio->uio_resid);
bus_space_read_multi_1(sc->sc_bst, sc->sc_bsh, FWCFG_DATA_REG, buf, count);
error = uiomove(buf, count, uio);
if (error != 0)
diff --git a/sys/dev/ic/rrunner.c b/sys/dev/ic/rrunner.c
index 8a48b8a061b..2ebfb46e854 100644
--- a/sys/dev/ic/rrunner.c
+++ b/sys/dev/ic/rrunner.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rrunner.c,v 1.87 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: rrunner.c,v 1.88 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.87 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.88 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_inet.h"
@@ -2250,7 +2250,7 @@ esh_adjust_mbufs(struct esh_softc *sc, struct mbuf *m)
* to do this kind of funky copy.
*/
- len = min(MCLBYTES, write_len);
+ len = uimin(MCLBYTES, write_len);
#ifdef DIAGNOSTIC
assert(n->m_len <= len);
assert(len <= MCLBYTES);
diff --git a/sys/dev/ic/rrunnerreg.h b/sys/dev/ic/rrunnerreg.h
index 089afdb1309..1add1f808ab 100644
--- a/sys/dev/ic/rrunnerreg.h
+++ b/sys/dev/ic/rrunnerreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rrunnerreg.h,v 1.9 2008/04/28 20:23:51 martin Exp $ */
+/* $NetBSD: rrunnerreg.h,v 1.10 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -536,6 +536,6 @@ struct rr_gen_info {
#define RR2_SEND_RING_SIZE 16 /* firmware restriction! */
#define RR2_SNAP_RECV_RING_SIZE 16 /* firmware restriction! */
-#define RR_MAX_SEND_RING_SIZE max(RR_SEND_RING_SIZE, RR2_SEND_RING_SIZE)
+#define RR_MAX_SEND_RING_SIZE uimax(RR_SEND_RING_SIZE, RR2_SEND_RING_SIZE)
#define RR_MAX_SNAP_RECV_RING_SIZE \
- max(RR_SNAP_RECV_RING_SIZE, RR_SNAP_RECV_RING_SIZE)
+ uimax(RR_SNAP_RECV_RING_SIZE, RR_SNAP_RECV_RING_SIZE)
diff --git a/sys/dev/ic/rt2560.c b/sys/dev/ic/rt2560.c
index aebca714228..f0feacc163d 100644
--- a/sys/dev/ic/rt2560.c
+++ b/sys/dev/ic/rt2560.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rt2560.c,v 1.34 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: rt2560.c,v 1.35 2018/09/03 16:29:31 riastradh Exp $ */
/* $OpenBSD: rt2560.c,v 1.15 2006/04/20 20:31:12 miod Exp $ */
/* $FreeBSD: rt2560.c,v 1.3 2006/03/21 21:15:43 damien Exp $*/
@@ -24,7 +24,7 @@
* http://www.ralinktech.com/
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.34 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2560.c,v 1.35 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
@@ -2352,7 +2352,7 @@ rt2560_set_chan(struct rt2560_softc *sc, struct ieee80211_channel *c)
return;
if (IEEE80211_IS_CHAN_2GHZ(c))
- power = min(sc->txpow[chan - 1], 31);
+ power = uimin(sc->txpow[chan - 1], 31);
else
power = 31;
diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c
index 370a4a26b84..f9622e08471 100644
--- a/sys/dev/ic/rt2661.c
+++ b/sys/dev/ic/rt2661.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rt2661.c,v 1.39 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: rt2661.c,v 1.40 2018/09/03 16:29:31 riastradh Exp $ */
/* $OpenBSD: rt2661.c,v 1.17 2006/05/01 08:41:11 damien Exp $ */
/* $FreeBSD: rt2560.c,v 1.5 2006/06/02 19:59:31 csjp Exp $ */
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.39 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.40 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
@@ -2874,9 +2874,9 @@ rt2661_rx_tune(struct rt2661_softc *sc)
if (bbp17 > hi)
bbp17 = hi;
else if (cca > 512)
- bbp17 = min(bbp17 + 1, hi);
+ bbp17 = uimin(bbp17 + 1, hi);
else if (cca < 100)
- bbp17 = max(bbp17 - 1, lo);
+ bbp17 = uimax(bbp17 - 1, lo);
} else if (dbm < -66) {
bbp17 = lo + 0x08;
@@ -2994,7 +2994,7 @@ rt2661_prepare_beacon(struct rt2661_softc *sc)
RT2661_HW_BEACON_BASE0 + 24 +
sizeof (struct ieee80211_frame) +
8 + 2 + 2 + 2 + ni->ni_esslen +
- 2 + min(ni->ni_rates.rs_nrates, IEEE80211_RATE_SIZE) +
+ 2 + uimin(ni->ni_rates.rs_nrates, IEEE80211_RATE_SIZE) +
2 + 1 +
((ic->ic_opmode == IEEE80211_M_IBSS) ? 4 : 6) +
2;
diff --git a/sys/dev/ic/rt2860.c b/sys/dev/ic/rt2860.c
index bce6d19a264..f561199a806 100644
--- a/sys/dev/ic/rt2860.c
+++ b/sys/dev/ic/rt2860.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rt2860.c,v 1.32 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: rt2860.c,v 1.33 2018/09/03 16:29:31 riastradh Exp $ */
/* $OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $ */
/* $FreeBSD: head/sys/dev/ral/rt2860.c 306591 2016-10-02 20:35:55Z avos $ */
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.32 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.33 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/sockio.h>
@@ -389,7 +389,7 @@ rt2860_attachhook(device_t self)
}
/* HW supports up to 255 STAs (0-254) in HostAP and IBSS modes */
- ic->ic_max_aid = min(IEEE80211_AID_MAX, RT2860_WCID_MAX);
+ ic->ic_max_aid = uimin(IEEE80211_AID_MAX, RT2860_WCID_MAX);
ifp->if_softc = sc;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
diff --git a/sys/dev/ic/seeq8005.c b/sys/dev/ic/seeq8005.c
index d7f09d76236..a847bec14ba 100644
--- a/sys/dev/ic/seeq8005.c
+++ b/sys/dev/ic/seeq8005.c
@@ -1,4 +1,4 @@
-/* $NetBSD: seeq8005.c,v 1.59 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: seeq8005.c,v 1.60 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 2000, 2001 Ben Harris
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.59 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.60 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1280,11 +1280,11 @@ ea_get(struct seeq8005_softc *sc, int addr, int totlen, struct ifnet *ifp)
}
m->m_len = MLEN;
}
- len = min(totlen, epkt - cp);
+ len = uimin(totlen, epkt - cp);
if (len >= MINCLSIZE) {
MCLGET(m, M_DONTWAIT);
if (m->m_flags & M_EXT)
- m->m_len = len = min(len, MCLBYTES);
+ m->m_len = len = uimin(len, MCLBYTES);
else
len = m->m_len;
} else {
diff --git a/sys/dev/ic/sl811hs.c b/sys/dev/ic/sl811hs.c
index b2391a8fdf5..9b81d9e861d 100644
--- a/sys/dev/ic/sl811hs.c
+++ b/sys/dev/ic/sl811hs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sl811hs.c,v 1.99 2018/04/09 16:21:10 jakllsch Exp $ */
+/* $NetBSD: sl811hs.c,v 1.100 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Not (c) 2007 Matthew Orgass
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.99 2018/04/09 16:21:10 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.100 2018/09/03 16:29:31 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_slhci.h"
@@ -905,7 +905,7 @@ slhci_start(struct usbd_xfer *xfer)
| (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN ? SL11_PID_IN :
SL11_PID_OUT);
spipe->newlen[0] = xfer->ux_length % max_packet;
- spipe->newlen[1] = min(xfer->ux_length, max_packet);
+ spipe->newlen[1] = uimin(xfer->ux_length, max_packet);
if (spipe->ptype == PT_BULK || spipe->ptype == PT_INTR) {
if (spipe->pflags & PF_TOGGLE)
@@ -3124,7 +3124,7 @@ slhci_set_feature(struct slhci_softc *sc, unsigned int what)
slhci_reset(sc);
} else {
t->flags |= F_RESET;
- callout_schedule(&sc->sc_timer, max(mstohz(50), 2));
+ callout_schedule(&sc->sc_timer, uimax(mstohz(50), 2));
}
} else if (what == UHF_PORT_SUSPEND) {
printf("%s: USB Suspend not implemented!\n", SC_NAME(sc));
@@ -3315,7 +3315,7 @@ slhci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
} else if (value == (UDESC_CONFIG<<8)) {
struct usb_roothub_descriptors confd;
- actlen = min(buflen, sizeof(confd));
+ actlen = uimin(buflen, sizeof(confd));
memcpy(&confd, buf, actlen);
/* 2 mA units */
@@ -3339,7 +3339,7 @@ slhci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
if (value == (UDESC_HUB<<8)) {
usb_hub_descriptor_t hubd;
- actlen = min(buflen, sizeof(hubd));
+ actlen = uimin(buflen, sizeof(hubd));
memcpy(&hubd, buf, actlen);
hubd.bHubContrCurrent =
500 - t->max_current;
diff --git a/sys/dev/ic/tcic2.c b/sys/dev/ic/tcic2.c
index 874273c2eab..eb525fc04ed 100644
--- a/sys/dev/ic/tcic2.c
+++ b/sys/dev/ic/tcic2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tcic2.c,v 1.38 2012/10/27 17:18:22 chs Exp $ */
+/* $NetBSD: tcic2.c,v 1.39 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 1998, 1999 Christoph Badura. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcic2.c,v 1.38 2012/10/27 17:18:22 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcic2.c,v 1.39 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -724,7 +724,7 @@ tcic_chip_mem_alloc(pcmcia_chipset_handle_t pch, bus_size_t size, struct pcmcia_
i = tcic_log2((u_int)size);
if ((1<<i) < size)
i++;
- sizepg = max(i, TCIC_MEM_SHIFT) - (TCIC_MEM_SHIFT-1);
+ sizepg = uimax(i, TCIC_MEM_SHIFT) - (TCIC_MEM_SHIFT-1);
DPRINTF(("tcic_chip_mem_alloc: size %ld sizepg %ld\n", (u_long)size,
(u_long)sizepg));
diff --git a/sys/dev/ic/tropic.c b/sys/dev/ic/tropic.c
index d180b07e262..22a5f514e63 100644
--- a/sys/dev/ic/tropic.c
+++ b/sys/dev/ic/tropic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tropic.c,v 1.50 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: tropic.c,v 1.51 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Ported to NetBSD by Onno van der Linden
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tropic.c,v 1.50 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tropic.c,v 1.51 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_inet.h"
@@ -1465,7 +1465,7 @@ tr_get(struct tr_softc *sc, int totlen, struct ifnet *ifp)
len -= newdata - m->m_data;
m->m_data = newdata;
}
- m->m_len = len = min(totlen, len);
+ m->m_len = len = uimin(totlen, len);
tr_bcopy(sc, mtod(m, char *), len);
totlen -= len;
if (totlen > 0) {
diff --git a/sys/dev/ic/wi.c b/sys/dev/ic/wi.c
index 77cd9176c73..866e575861c 100644
--- a/sys/dev/ic/wi.c
+++ b/sys/dev/ic/wi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wi.c,v 1.247 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: wi.c,v 1.248 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.247 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.248 2018/09/03 16:29:31 riastradh Exp $");
#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */
#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */
@@ -2078,7 +2078,7 @@ wi_info_intr(struct wi_softc *sc)
case WI_INFO_COUNTERS:
/* some card versions have a larger stats structure */
- len = min(le16toh(ltbuf[0]) - 1, sizeof(sc->sc_stats) / 4);
+ len = uimin(le16toh(ltbuf[0]) - 1, sizeof(sc->sc_stats) / 4);
ptr = (u_int32_t *)&sc->sc_stats;
off = sizeof(ltbuf);
for (i = 0; i < len; i++, off += 2, ptr++) {
@@ -3045,7 +3045,7 @@ wi_mwrite_bap(struct wi_softc *sc, int id, int off, struct mbuf *m0, int totlen)
if (m->m_len == 0)
continue;
- len = min(m->m_len, totlen);
+ len = uimin(m->m_len, totlen);
if (((u_long)m->m_data) % 2 != 0 || len % 2 != 0) {
m_copydata(m, 0, totlen, (void *)&sc->sc_txbuf);
diff --git a/sys/dev/ieee1394/firewire.c b/sys/dev/ieee1394/firewire.c
index 7683e72247c..ed952e7bee2 100644
--- a/sys/dev/ieee1394/firewire.c
+++ b/sys/dev/ieee1394/firewire.c
@@ -1,4 +1,4 @@
-/* $NetBSD: firewire.c,v 1.47 2016/11/20 22:47:39 riastradh Exp $ */
+/* $NetBSD: firewire.c,v 1.48 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2003 Hidetoshi Shimokawa
* Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.47 2016/11/20 22:47:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.48 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -1016,7 +1016,7 @@ fw_sidrcv(struct firewire_comm* fc, uint32_t *sid, u_int len)
for (j = 0; j < node; j++)
fc->speed_map->speed[j][node] =
fc->speed_map->speed[node][j] =
- min(fc->speed_map->speed[j][j],
+ uimin(fc->speed_map->speed[j][j],
self_id->p0.phy_speed);
if ((fc->irm == -1 || self_id->p0.phy_id > fc->irm) &&
(self_id->p0.link_active && self_id->p0.contender))
diff --git a/sys/dev/ieee1394/fwmem.c b/sys/dev/ieee1394/fwmem.c
index 5985a9ddb54..ac6f3f7aba4 100644
--- a/sys/dev/ieee1394/fwmem.c
+++ b/sys/dev/ieee1394/fwmem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fwmem.c,v 1.18 2014/02/25 18:30:09 pooka Exp $ */
+/* $NetBSD: fwmem.c,v 1.19 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2002-2003
* Hidetoshi Shimokawa. All rights reserved.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fwmem.c,v 1.18 2014/02/25 18:30:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwmem.c,v 1.19 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -458,7 +458,7 @@ fwmem_xfer_req(struct fw_device *fwdev, void *sc, int spd, int slen, int rlen,
if (spd < 0)
xfer->send.spd = fwdev->speed;
else
- xfer->send.spd = min(spd, fwdev->speed);
+ xfer->send.spd = uimin(spd, fwdev->speed);
xfer->hand = hand;
xfer->sc = sc;
xfer->send.pay_len = slen;
diff --git a/sys/dev/ieee1394/if_fwip.c b/sys/dev/ieee1394/if_fwip.c
index 81bb034e53b..7e43e48027d 100644
--- a/sys/dev/ieee1394/if_fwip.c
+++ b/sys/dev/ieee1394/if_fwip.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_fwip.c,v 1.27 2016/06/10 13:27:14 ozaki-r Exp $ */
+/* $NetBSD: if_fwip.c,v 1.28 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2004
* Doug Rabson
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_fwip.c,v 1.27 2016/06/10 13:27:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_fwip.c,v 1.28 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -648,7 +648,7 @@ fwip_async_output(struct fwip_softc *sc, struct ifnet *ifp)
fp->mode.wreqb = sc->sc_last_hdr.mode.wreqb;
fp->mode.wreqb.len = m->m_pkthdr.len;
- xfer->send.spd = min(destfw->sspd, fc->speed);
+ xfer->send.spd = uimin(destfw->sspd, fc->speed);
}
xfer->send.pay_len = m->m_pkthdr.len;
diff --git a/sys/dev/ieee1394/sbp.c b/sys/dev/ieee1394/sbp.c
index 2dd8321435c..edfea990479 100644
--- a/sys/dev/ieee1394/sbp.c
+++ b/sys/dev/ieee1394/sbp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sbp.c,v 1.36 2014/02/25 18:30:09 pooka Exp $ */
+/* $NetBSD: sbp.c,v 1.37 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 2003 Hidetoshi Shimokawa
* Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbp.c,v 1.36 2014/02/25 18:30:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbp.c,v 1.37 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
@@ -1432,7 +1432,7 @@ END_DEBUG
if (new) {
xfer->recv.pay_len = 0;
- xfer->send.spd = min(target->fwdev->speed, max_speed);
+ xfer->send.spd = uimin(target->fwdev->speed, max_speed);
xfer->fc = target->sbp->sc_fd.fc;
}
@@ -1989,7 +1989,7 @@ done0:
sfp = (struct fw_pkt *)xfer->send.buf;
sfp->mode.wres.dst = rfp->mode.wreqb.src;
xfer->dst = sfp->mode.wres.dst;
- xfer->spd = min(sdev->target->fwdev->speed, max_speed);
+ xfer->spd = uimin(sdev->target->fwdev->speed, max_speed);
xfer->hand = sbp_loginres_callback;
sfp->mode.wres.tlrt = rfp->mode.wreqb.tlrt;
@@ -2293,7 +2293,7 @@ END_DEBUG
ocb->orb[1] = 0;
ocb->orb[2] = htonl(((sc->sc_fd.fc->nodeid | FWLOCALBUS) << 16));
ocb->orb[3] = htonl(ocb->bus_addr + IND_PTR_OFFSET);
- speed = min(target->fwdev->speed, max_speed);
+ speed = uimin(target->fwdev->speed, max_speed);
ocb->orb[4] =
htonl(ORB_NOTIFY | ORB_CMD_SPD(speed) | ORB_CMD_MAXP(speed + 7));
if ((xs->xs_control & (XS_CTL_DATA_IN | XS_CTL_DATA_OUT)) ==
diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c
index 47e890f0ab6..ae0a527887c 100644
--- a/sys/dev/isa/fd.c
+++ b/sys/dev/isa/fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.111 2018/01/20 18:18:02 tsutsui Exp $ */
+/* $NetBSD: fd.c,v 1.112 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.111 2018/01/20 18:18:02 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.112 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_ddb.h"
@@ -1145,8 +1145,8 @@ loop:
(char *)finfo;
sec = fd->sc_blkno % type->seccyl;
nblks = type->seccyl - sec;
- nblks = min(nblks, fd->sc_bcount / FDC_BSIZE);
- nblks = min(nblks, fdc->sc_maxiosize / FDC_BSIZE);
+ nblks = uimin(nblks, fd->sc_bcount / FDC_BSIZE);
+ nblks = uimin(nblks, fdc->sc_maxiosize / FDC_BSIZE);
fd->sc_nblks = nblks;
fd->sc_nbytes = finfo ? bp->b_bcount : nblks * FDC_BSIZE;
head = sec / type->sectrac;
diff --git a/sys/dev/isa/if_eg.c b/sys/dev/isa/if_eg.c
index a8ec92604b9..201255ad33a 100644
--- a/sys/dev/isa/if_eg.c
+++ b/sys/dev/isa/if_eg.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_eg.c,v 1.94 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_eg.c,v 1.95 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 1993 Dean Huxley <dean@fsa.ca>
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.94 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.95 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_inet.h"
@@ -574,7 +574,7 @@ loop:
aprint_error_dev(sc->sc_dev, "no header mbuf\n");
panic("egstart");
}
- len = max(m0->m_pkthdr.len, ETHER_MIN_LEN - ETHER_CRC_LEN);
+ len = uimax(m0->m_pkthdr.len, ETHER_MIN_LEN - ETHER_CRC_LEN);
bpf_mtap(ifp, m0, BPF_D_OUT);
@@ -752,7 +752,7 @@ egget(struct eg_softc *sc, void *buf, int totlen)
len = MCLBYTES;
}
- m->m_len = len = min(totlen, len);
+ m->m_len = len = uimin(totlen, len);
memcpy(mtod(m, void *), buf, len);
buf = (char *)buf + len;
diff --git a/sys/dev/isa/if_el.c b/sys/dev/isa/if_el.c
index f994233b204..4cb19adb8c1 100644
--- a/sys/dev/isa/if_el.c
+++ b/sys/dev/isa/if_el.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_el.c,v 1.96 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_el.c,v 1.97 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 1994, Matthew E. Kimmel. Permission is hereby granted
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.96 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.97 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_inet.h"
@@ -389,7 +389,7 @@ elstart(struct ifnet *ifp)
/* Transfer datagram to board. */
DPRINTF(("el: xfr pkt length=%d...\n", m0->m_pkthdr.len));
- off = EL_BUFSIZ - max(m0->m_pkthdr.len,
+ off = EL_BUFSIZ - uimax(m0->m_pkthdr.len,
ETHER_MIN_LEN - ETHER_CRC_LEN);
#ifdef DIAGNOSTIC
if ((off & 0xffff) != off)
@@ -616,7 +616,7 @@ elget(struct el_softc *sc, int totlen)
len = MCLBYTES;
}
- m->m_len = len = min(totlen, len);
+ m->m_len = len = uimin(totlen, len);
bus_space_read_multi_1(iot, ioh, EL_BUF, mtod(m, u_int8_t *), len);
totlen -= len;
diff --git a/sys/dev/isa/if_iy.c b/sys/dev/isa/if_iy.c
index a3e66330dbf..be1c2b0dd23 100644
--- a/sys/dev/isa/if_iy.c
+++ b/sys/dev/isa/if_iy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iy.c,v 1.102 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_iy.c,v 1.103 2018/09/03 16:29:31 riastradh Exp $ */
/* #define IYDEBUG */
/* #define IYMEMDEBUG */
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.102 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.103 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_inet.h"
@@ -1018,7 +1018,7 @@ iyget(struct iy_softc *sc, bus_space_tag_t iot, bus_space_handle_t ioh,
}
len = MCLBYTES;
}
- len = min(rxlen, len);
+ len = uimin(rxlen, len);
/*
* XXX ALIGNMENT LOSSAGE HERE.
*/
diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c
index 436bfde1f52..9c474fcd0d0 100644
--- a/sys/dev/isa/mcd.c
+++ b/sys/dev/isa/mcd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mcd.c,v 1.116 2016/07/14 10:19:06 msaitoh Exp $ */
+/* $NetBSD: mcd.c,v 1.117 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
@@ -56,7 +56,7 @@
/*static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.116 2016/07/14 10:19:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.117 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -669,7 +669,7 @@ mcdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
error = mcd_toc_entries(sc, te, entries, &count);
if (error == 0)
/* Copy the data back. */
- error = copyout(entries, te->data, min(te->data_len,
+ error = copyout(entries, te->data, uimin(te->data_len,
count * sizeof(struct cd_toc_entry)));
return error;
}
diff --git a/sys/dev/isa/sbdsp.c b/sys/dev/isa/sbdsp.c
index 8f02f6ff271..46cd22fea46 100644
--- a/sys/dev/isa/sbdsp.c
+++ b/sys/dev/isa/sbdsp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sbdsp.c,v 1.137 2017/11/04 01:46:56 nat Exp $ */
+/* $NetBSD: sbdsp.c,v 1.138 2018/09/03 16:29:31 riastradh Exp $ */
/*-
* Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.137 2017/11/04 01:46:56 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.138 2018/09/03 16:29:31 riastradh Exp $");
#include "midi.h"
#include "mpu.h"
@@ -588,7 +588,7 @@ sbdsp_set_params(
return EBUSY;
/* Later models work like SB16. */
- model = min(sc->sc_model, SB_16);
+ model = uimin(sc->sc_model, SB_16);
/*
* Prior to the SB16, we have only one clock, so make the sample
diff --git a/sys/dev/kttcp.c b/sys/dev/kttcp.c
index 3bf801019e0..7a979f83a07 100644
--- a/sys/dev/kttcp.c
+++ b/sys/dev/kttcp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: kttcp.c,v 1.40 2016/10/02 14:16:02 christos Exp $ */
+/* $NetBSD: kttcp.c,v 1.41 2018/09/03 16:29:30 riastradh Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.40 2016/10/02 14:16:02 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.41 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -376,7 +376,7 @@ kttcp_soreceive(struct socket *so, unsigned long long slen,
if (error)
goto bad;
do {
- resid -= min(resid, m->m_len);
+ resid -= uimin(resid, m->m_len);
m = m_free(m);
} while (resid && error == 0 && m);
bad:
diff --git a/sys/dev/marvell/gtidmac.c b/sys/dev/marvell/gtidmac.c
index e674823fc6a..cc15bc77097 100644
--- a/sys/dev/marvell/gtidmac.c
+++ b/sys/dev/marvell/gtidmac.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gtidmac.c,v 1.15 2017/06/01 02:45:10 chs Exp $ */
+/* $NetBSD: gtidmac.c,v 1.16 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 2008, 2012, 2016 KIYOHARA Takashi
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.15 2017/06/01 02:45:10 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.16 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -1061,7 +1061,7 @@ gtidmac_setup(void *tag, int chan, int ninputs, bus_dmamap_t *dmamap_in,
} else if (ccl & GTIDMAC_CCLR_DESTHOLD)
bcnt = (*dmamap_in)->dm_segs[iidx].ds_len;
else
- bcnt = min((*dmamap_in)->dm_segs[iidx].ds_len - ires,
+ bcnt = uimin((*dmamap_in)->dm_segs[iidx].ds_len - ires,
(*dmamap_out)->dm_segs[oidx].ds_len - ores);
desc = dd->dd_idmac_vaddr;
@@ -1357,7 +1357,7 @@ mvxore_setup(void *tag, int chan, int ninputs, bus_dmamap_t *dmamap_in,
for (i = 0; i < ninputs; i++) {
desc->srcaddr[i] =
(*dmamap_in[i]).dm_segs[iidx[i]].ds_addr + ires[i];
- bcnt = min(bcnt,
+ bcnt = uimin(bcnt,
(*dmamap_in[i]).dm_segs[iidx[i]].ds_len - ires[i]);
}
desc->bcnt = bcnt;
diff --git a/sys/dev/marvell/gtmpsc.c b/sys/dev/marvell/gtmpsc.c
index 3c7270f5e72..3f9252f3cbb 100644
--- a/sys/dev/marvell/gtmpsc.c
+++ b/sys/dev/marvell/gtmpsc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmpsc.c,v 1.46 2014/11/15 19:18:18 christos Exp $ */
+/* $NetBSD: gtmpsc.c,v 1.47 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 2009 KIYOHARA Takashi
* All rights reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gtmpsc.c,v 1.46 2014/11/15 19:18:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmpsc.c,v 1.47 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_kgdb.h"
@@ -1005,7 +1005,7 @@ gtmpsc_write(struct gtmpsc_softc *sc)
kick = 0;
while (sc->sc_tbc > 0 && sc->sc_nexttx != sc->sc_lasttx) {
- n = min(sc->sc_tbc, GTMPSC_TXBUFSZ);
+ n = uimin(sc->sc_tbc, GTMPSC_TXBUFSZ);
ix = sc->sc_nexttx;
sc->sc_nexttx = (ix + 1) % GTMPSC_NTXDESC;
diff --git a/sys/dev/marvell/if_mvgbe.c b/sys/dev/marvell/if_mvgbe.c
index 0f2a75991c9..5a4b8e9e078 100644
--- a/sys/dev/marvell/if_mvgbe.c
+++ b/sys/dev/marvell/if_mvgbe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mvgbe.c,v 1.50 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_mvgbe.c,v 1.51 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi
* All rights reserved.
@@ -25,7 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.50 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.51 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_multiprocessor.h"
@@ -875,7 +875,7 @@ mvgbe_attach(device_t parent, device_t self, void *aux)
* But, IPv6 packets in the stream can cause incorrect TCPv4 Tx sums.
*/
sc->sc_ethercom.ec_if.if_capabilities &= ~IFCAP_CSUM_TCPv4_Tx;
- IFQ_SET_MAXLEN(&ifp->if_snd, max(MVGBE_TX_RING_CNT - 1, IFQ_MAXLEN));
+ IFQ_SET_MAXLEN(&ifp->if_snd, uimax(MVGBE_TX_RING_CNT - 1, IFQ_MAXLEN));
IFQ_SET_READY(&ifp->if_snd);
strcpy(ifp->if_xname, device_xname(sc->sc_dev));
diff --git a/sys/dev/marvell/if_mvxpe.c b/sys/dev/marvell/if_mvxpe.c
index 04c10e12d56..9b198d9396a 100644
--- a/sys/dev/marvell/if_mvxpe.c
+++ b/sys/dev/marvell/if_mvxpe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mvxpe.c,v 1.19 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_mvxpe.c,v 1.20 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 2015 Internet Initiative Japan Inc.
* All rights reserved.
@@ -25,7 +25,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.19 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.20 2018/09/03 16:29:31 riastradh Exp $");
#include "opt_multiprocessor.h"
@@ -445,7 +445,7 @@ mvxpe_attach(device_t parent, device_t self, void *aux)
/*
* Initialize struct ifnet
*/
- IFQ_SET_MAXLEN(&ifp->if_snd, max(MVXPE_TX_RING_CNT - 1, IFQ_MAXLEN));
+ IFQ_SET_MAXLEN(&ifp->if_snd, uimax(MVXPE_TX_RING_CNT - 1, IFQ_MAXLEN));
IFQ_SET_READY(&ifp->if_snd);
strlcpy(ifp->if_xname, device_xname(sc->sc_dev), sizeof(ifp->if_xname));
diff --git a/sys/dev/marvell/mvcesa.c b/sys/dev/marvell/mvcesa.c
index b44a12512cb..9f3cb0aa8a4 100644
--- a/sys/dev/marvell/mvcesa.c
+++ b/sys/dev/marvell/mvcesa.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mvcesa.c,v 1.1 2012/07/27 03:00:01 kiyohara Exp $ */
+/* $NetBSD: mvcesa.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $ */
/*
* Copyright (c) 2008 KIYOHARA Takashi
* All rights reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.1 2012/07/27 03:00:01 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -544,7 +544,7 @@ mvcesa_authentication(struct mvcesa_softc *sc, struct mvcesa_session *ses,
data = 0;
if (buf != NULL)
for (i = 0; i < 512 / 8 && off + i < len; i += s) {
- s = min(sizeof(data), len - off - i);
+ s = uimin(sizeof(data), len - off - i);
memcpy(&data, buf + skip + off + i, s);
if (s == sizeof(data))
bus_space_write_4(sc->sc_iot,
@@ -553,7 +553,7 @@ mvcesa_authentication(struct mvcesa_softc *sc, struct mvcesa_session *ses,
}
else if (m != NULL)
for (i = 0; i < 512 / 8 && off + i < len; i += s) {
- s = min(sizeof(data), len - off - i);
+ s = uimin(sizeof(data), len - off - i);
m_copydata(m, skip + off + i, s, &data);
if (s == sizeof(data))
bus_space_write_4(sc->sc_iot,
@@ -562,7 +562,7 @@ mvcesa_authentication(struct mvcesa_softc *sc, struct mvcesa_session *ses,
}
else if (uio != NULL)
for (i = 0; i < 512 / 8 && off + i < len; i += s) {
- s = min(sizeof(data), len - off - i);
+ s = uimin(sizeof(data), len - off - i);
cuio_copydata(uio, skip + off + i, s, &data);
if (s == sizeof(data))
bus_space_write_4(sc->sc_iot,
@@ -674,7 +674,7 @@ mvcesa_des_encdec(struct mvcesa_softc *sc, struct mvcesa_session *ses,
i = o = 0;
while (i < len) {
- s = min(sizeof(iblk), len - i);
+ s = uimin(sizeof(iblk), len - i);
iblk = 0;
if (buf != NULL)
diff --git a/sys/dev/mca/ed_mca.c b/sys/dev/mca/ed_mca.c
index 34477ad3930..e67d6b28d0c 100644
--- a/sys/dev/mca/ed_mca.c
+++ b/sys/dev/mca/ed_mca.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ed_mca.c,v 1.66 2016/07/14 04:00:45 msaitoh Exp $ */
+/* $NetBSD: ed_mca.c,v 1.67 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.66 2016/07/14 04:00:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.67 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -659,14 +659,14 @@ edmcadump(dev_t dev, daddr_t blkno, void *va, size_t size)
while (nblks > 0) {
error = edc_bio(ed->edc_softc, ed, va, blkno,
- min(nblks, eddumpmulti) * lp->d_secsize, 0, 1);
+ uimin(nblks, eddumpmulti) * lp->d_secsize, 0, 1);
if (error)
return (error);
/* update block count */
- nblks -= min(nblks, eddumpmulti);
- blkno += min(nblks, eddumpmulti);
- va = (char *)va + min(nblks, eddumpmulti) * lp->d_secsize;
+ nblks -= uimin(nblks, eddumpmulti);
+ blkno += uimin(nblks, eddumpmulti);
+ va = (char *)va + uimin(nblks, eddumpmulti) * lp->d_secsize;
}
eddoingadump = 0;
diff --git a/sys/dev/mulaw.c b/sys/dev/mulaw.c
index ee7f58a4bda..f0acc9abfb3 100644
--- a/sys/dev/mulaw.c
+++ b/sys/dev/mulaw.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mulaw.c,v 1.33 2017/12/27 00:12:06 nat Exp $ */
+/* $NetBSD: mulaw.c,v 1.34 2018/09/03 16:29:30 riastradh Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.33 2017/12/27 00:12:06 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mulaw.c,v 1.34 2018/09/03 16:29:30 riastradh Exp $");
#include <sys/types.h>
#include <sys/systm.h>
@@ -282,7 +282,7 @@ DEFINE_FILTER(mulaw_to_linear8)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = dst->end - dst->start;
- m = min(m, max_used);
+ m = uimin(m, max_used);
if (dst->param.encoding == AUDIO_ENCODING_ULINEAR_LE) {
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 1, m) {
*d = mulawtolin16[*s][0];
@@ -306,7 +306,7 @@ DEFINE_FILTER(mulaw_to_linear16)
this->src, max_used / 2)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
switch (dst->param.encoding) {
case AUDIO_ENCODING_ULINEAR_LE:
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 2, m) {
@@ -352,7 +352,7 @@ DEFINE_FILTER(mulaw_to_linear24)
this->src, max_used / 3)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
switch (dst->param.encoding) {
case AUDIO_ENCODING_ULINEAR_LE:
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 3, m) {
@@ -402,7 +402,7 @@ DEFINE_FILTER(mulaw_to_linear32)
this->src, max_used / 4)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
switch (dst->param.encoding) {
case AUDIO_ENCODING_ULINEAR_LE:
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 4, m) {
@@ -456,7 +456,7 @@ DEFINE_FILTER(linearN_to_mulaw)
max_used * hw)))
return err;
m = dst->end - dst->start;
- m = min(m, max_used);
+ m = uimin(m, max_used);
switch (this->src->param.encoding) {
case AUDIO_ENCODING_SLINEAR_LE:
FILTER_LOOP_PROLOGUE(this->src, hw, dst, 1, m) {
@@ -496,7 +496,7 @@ DEFINE_FILTER(alaw_to_linear8)
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used)))
return err;
m = dst->end - dst->start;
- m = min(m, max_used);
+ m = uimin(m, max_used);
if (dst->param.encoding == AUDIO_ENCODING_ULINEAR_LE) {
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 1, m) {
*d = alawtolin16[*s][0];
@@ -520,7 +520,7 @@ DEFINE_FILTER(alaw_to_linear16)
max_used / 2)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
switch (dst->param.encoding) {
case AUDIO_ENCODING_ULINEAR_LE:
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 2, m) {
@@ -566,7 +566,7 @@ DEFINE_FILTER(alaw_to_linear24)
max_used / 3)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
switch (dst->param.encoding) {
case AUDIO_ENCODING_ULINEAR_LE:
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 3, m) {
@@ -616,7 +616,7 @@ DEFINE_FILTER(alaw_to_linear32)
max_used / 4)))
return err;
m = (dst->end - dst->start) & ~1;
- m = min(m, max_used);
+ m = uimin(m, max_used);
switch (dst->param.encoding) {
case AUDIO_ENCODING_ULINEAR_LE:
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 4, m) {
@@ -670,7 +670,7 @@ DEFINE_FILTER(linearN_to_alaw)
max_used * hw)))
return err;
m = dst->end - dst->start;
- m = min(m, max_used);
+ m = uimin(m, max_used);
switch (this->src->param.encoding) {
case AUDIO_ENCODING_SLINEAR_LE:
FILTER_LOOP_PROLOGUE(this->src, hw, dst, 1, m) {
diff --git a/sys/dev/mvme/lpt_mvme.c b/sys/dev/mvme/lpt_mvme.c
index 47b82f07693..c6c7a90c5d1 100644
--- a/sys/dev/mvme/lpt_mvme.c
+++ b/sys/dev/mvme/lpt_mvme.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lpt_mvme.c,v 1.18 2014/07/25 08:10:37 dholland Exp $ */
+/* $NetBSD: lpt_mvme.c,v 1.19 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -84,7 +84,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lpt_mvme.c,v 1.18 2014/07/25 08:10:37 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lpt_mvme.c,v 1.19 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -327,7 +327,7 @@ lptwrite(dev_t dev, struct uio *uio, int flags)
sc = device_lookup_private(&lpt_cd, LPTUNIT(dev));
error = 0;
- while ((n = min(LPT_BSIZE, uio->uio_resid)) != 0) {
+ while ((n = uimin(LPT_BSIZE, uio->uio_resid)) != 0) {
uiomove(sc->sc_cp = sc->sc_inbuf->b_data, n, uio);
sc->sc_count = n;
error = pushbytes(sc);
diff --git a/sys/dev/mvme/mvmebus.c b/sys/dev/mvme/mvmebus.c
index e59a9d8a9ae..b1f33476892 100644
--- a/sys/dev/mvme/mvmebus.c
+++ b/sys/dev/mvme/mvmebus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mvmebus.c,v 1.19 2012/10/27 17:18:27 chs Exp $ */
+/* $NetBSD: mvmebus.c,v 1.20 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* Copyright (c) 2000, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvmebus.c,v 1.19 2012/10/27 17:18:27 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvmebus.c,v 1.20 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -736,7 +736,7 @@ mvmebus_dmamem_alloc(void *vsc, vme_size_t len, vme_am_t am, vme_datasize_t data
* Set up the constraints so we can allocate physical memory which
* is visible in the requested address space
*/
- low = max(vr->vr_locstart, avail_start);
+ low = uimax(vr->vr_locstart, avail_start);
high = vr->vr_locstart + (vr->vr_vmeend - vr->vr_vmestart) + 1;
bound = (bus_size_t) vr->vr_mask + 1;
diff --git a/sys/dev/ofisa/ofisa.c b/sys/dev/ofisa/ofisa.c
index 34e913091ec..8e2489cf728 100644
--- a/sys/dev/ofisa/ofisa.c
+++ b/sys/dev/ofisa/ofisa.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ofisa.c,v 1.25 2016/12/09 17:18:35 christos Exp $ */
+/* $NetBSD: ofisa.c,v 1.26 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright 1997, 1998
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofisa.c,v 1.25 2016/12/09 17:18:35 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofisa.c,v 1.26 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -156,7 +156,7 @@ ofisa_reg_get(int phandle, struct ofisa_reg_desc *descp, int ndescs)
if (i < 0)
return (-1);
proplen = i * 12;
- ndescs = min(ndescs, i);
+ ndescs = uimin(ndescs, i);
i = ndescs * 12;
if (i > OFW_MAX_STACK_BUF_SIZE) {
@@ -226,7 +226,7 @@ ofisa_intr_get(int phandle, struct ofisa_intr_desc *descp, int ndescs)
if (i < 0)
return (-1);
proplen = i * 8;
- ndescs = min(ndescs, i);
+ ndescs = uimin(ndescs, i);
i = ndescs * 8;
if (i > OFW_MAX_STACK_BUF_SIZE) {
@@ -308,7 +308,7 @@ ofisa_dma_get(int phandle, struct ofisa_dma_desc *descp, int ndescs)
if (i < 0)
return (-1);
proplen = i * 20;
- ndescs = min(ndescs, i);
+ ndescs = uimin(ndescs, i);
i = ndescs * 20;
if (i > OFW_MAX_STACK_BUF_SIZE) {
diff --git a/sys/dev/ofw/ofnet.c b/sys/dev/ofw/ofnet.c
index 022215ed6ec..06402dccc30 100644
--- a/sys/dev/ofw/ofnet.c
+++ b/sys/dev/ofw/ofnet.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ofnet.c,v 1.60 2018/07/15 05:16:45 maxv Exp $ */
+/* $NetBSD: ofnet.c,v 1.61 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofnet.c,v 1.60 2018/07/15 05:16:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofnet.c,v 1.61 2018/09/03 16:29:32 riastradh Exp $");
#include "ofnet.h"
#include "opt_inet.h"
@@ -223,7 +223,7 @@ ofnet_read(struct ofnet_softc *of)
m->m_data = newdata;
}
- m->m_len = l = min(len, l);
+ m->m_len = l = uimin(len, l);
memcpy(mtod(m, char *), bufp, l);
bufp += l;
len -= l;
diff --git a/sys/dev/pad/pad.c b/sys/dev/pad/pad.c
index 19669c81d23..36067c7dd7e 100644
--- a/sys/dev/pad/pad.c
+++ b/sys/dev/pad/pad.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.52 2018/01/26 23:36:01 pgoyette Exp $ */
+/* $NetBSD: pad.c,v 1.53 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.52 2018/01/26 23:36:01 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.53 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -589,7 +589,7 @@ pad_read(struct pad_softc *sc, off_t *offp, struct uio *uio, kauth_cred_t cred,
if (sc->sc_bytes_count >= BYTESTOSLEEP)
sc->sc_bytes_count -= BYTESTOSLEEP;
- err = pad_get_block(sc, &pb, min(uio->uio_resid, PAD_BLKSIZE));
+ err = pad_get_block(sc, &pb, uimin(uio->uio_resid, PAD_BLKSIZE));
if (!err) {
getmicrotime(&sc->sc_last);
sc->sc_bytes_count += pb.pb_len;
diff --git a/sys/dev/pci/amr.c b/sys/dev/pci/amr.c
index d4a54d21d89..57074a40edf 100644
--- a/sys/dev/pci/amr.c
+++ b/sys/dev/pci/amr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: amr.c,v 1.62 2016/09/27 03:33:32 pgoyette Exp $ */
+/* $NetBSD: amr.c,v 1.63 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.62 2016/09/27 03:33:32 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.63 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -418,7 +418,7 @@ amr_attach(device_t parent, device_t self, void *aux)
amr->amr_flags |= AMRF_CCBS;
if (amr_max_xfer == 0) {
- amr_max_xfer = min(((AMR_MAX_SEGS - 1) * PAGE_SIZE), MAXPHYS);
+ amr_max_xfer = uimin(((AMR_MAX_SEGS - 1) * PAGE_SIZE), MAXPHYS);
amr_max_segs = (amr_max_xfer + (PAGE_SIZE * 2) - 1) / PAGE_SIZE;
}
@@ -477,7 +477,7 @@ amr_attach(device_t parent, device_t self, void *aux)
* driver doesn't trust the controller's reported value, and lockups
* have been seen when we do.
*/
- amr->amr_maxqueuecnt = min(amr->amr_maxqueuecnt, AMR_MAX_CMDS);
+ amr->amr_maxqueuecnt = uimin(amr->amr_maxqueuecnt, AMR_MAX_CMDS);
if (amr->amr_maxqueuecnt > i)
amr->amr_maxqueuecnt = i;
diff --git a/sys/dev/pci/arcmsr.c b/sys/dev/pci/arcmsr.c
index d4217d0770d..7d01cd467b0 100644
--- a/sys/dev/pci/arcmsr.c
+++ b/sys/dev/pci/arcmsr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: arcmsr.c,v 1.37 2017/08/12 11:03:47 mlelstv Exp $ */
+/* $NetBSD: arcmsr.c,v 1.38 2018/09/03 16:29:32 riastradh Exp $ */
/* $OpenBSD: arc.c,v 1.68 2007/10/27 03:28:27 dlg Exp $ */
/*
@@ -21,7 +21,7 @@
#include "bio.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.37 2017/08/12 11:03:47 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.38 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -545,7 +545,7 @@ arc_scsi_cmd_done(struct arc_softc *sc, struct arc_ccb *ccb, uint32_t reg)
case SCSI_CHECK:
memset(&xs->sense, 0, sizeof(xs->sense));
memcpy(&xs->sense, cmd->sense_data,
- min(ARC_MSG_SENSELEN, sizeof(xs->sense)));
+ uimin(ARC_MSG_SENSELEN, sizeof(xs->sense)));
xs->sense.scsi_sense.response_code =
SSD_RCODE_VALID | 0x70;
xs->status = SCSI_CHECK;
diff --git a/sys/dev/pci/auvia.c b/sys/dev/pci/auvia.c
index 752e40fd662..2c79d29f54c 100644
--- a/sys/dev/pci/auvia.c
+++ b/sys/dev/pci/auvia.c
@@ -1,4 +1,4 @@
-/* $NetBSD: auvia.c,v 1.78 2017/06/01 02:45:11 chs Exp $ */
+/* $NetBSD: auvia.c,v 1.79 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.78 2017/06/01 02:45:11 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.79 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -798,7 +798,7 @@ auvia_round_blocksize(void *addr, int blk,
blk = 288;
/* Avoid too many dma_ops. */
- return min((blk & -32), AUVIA_MINBLKSZ);
+ return uimin((blk & -32), AUVIA_MINBLKSZ);
}
static int
diff --git a/sys/dev/pci/bktr/bktr_core.c b/sys/dev/pci/bktr/bktr_core.c
index ca789c77c76..598a3c00dcc 100644
--- a/sys/dev/pci/bktr/bktr_core.c
+++ b/sys/dev/pci/bktr/bktr_core.c
@@ -1,6 +1,6 @@
/* $SourceForge: bktr_core.c,v 1.6 2003/03/11 23:11:22 thomasklausner Exp $ */
-/* $NetBSD: bktr_core.c,v 1.54 2012/12/14 19:38:36 joerg Exp $ */
+/* $NetBSD: bktr_core.c,v 1.55 2018/09/03 16:29:32 riastradh Exp $ */
/* $FreeBSD: src/sys/dev/bktr/bktr_core.c,v 1.114 2000/10/31 13:09:56 roger Exp$ */
/*
@@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bktr_core.c,v 1.54 2012/12/14 19:38:36 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bktr_core.c,v 1.55 2018/09/03 16:29:32 riastradh Exp $");
#include "opt_bktr.h" /* Include any kernel config options */
@@ -2620,7 +2620,7 @@ static bool_t getline(bktr_reg_t *bktr, int x) {
if (bktr->line_length == 0 ||
bktr->current_col >= bktr->line_length) return FALSE;
- bktr->y = min(bktr->last_y, bktr->line_length);
+ bktr->y = uimin(bktr->last_y, bktr->line_length);
bktr->y2 = bktr->line_length;
bktr->yclip = bktr->yclip2 = -1;
@@ -2628,10 +2628,10 @@ static bool_t getline(bktr_reg_t *bktr, int x) {
clip_node = (bktr_clip_t *) &bktr->clip_list[i];
if (x >= clip_node->x_min && x <= clip_node->x_max) {
if (bktr->last_y <= clip_node->y_min) {
- bktr->y = min(bktr->last_y, bktr->line_length);
- bktr->y2 = min(clip_node->y_min, bktr->line_length);
- bktr->yclip = min(clip_node->y_min, bktr->line_length);
- bktr->yclip2 = min(clip_node->y_max, bktr->line_length);
+ bktr->y = uimin(bktr->last_y, bktr->line_length);
+ bktr->y2 = uimin(clip_node->y_min, bktr->line_length);
+ bktr->yclip = uimin(clip_node->y_min, bktr->line_length);
+ bktr->yclip2 = uimin(clip_node->y_max, bktr->line_length);
bktr->last_y = bktr->yclip2;
bktr->clip_start = i;
@@ -2639,7 +2639,7 @@ static bool_t getline(bktr_reg_t *bktr, int x) {
clip_node = (bktr_clip_t *) &bktr->clip_list[j];
if (x >= clip_node->x_min && x <= clip_node->x_max) {
if (bktr->last_y >= clip_node->y_min) {
- bktr->yclip2 = min(clip_node->y_max, bktr->line_length);
+ bktr->yclip2 = uimin(clip_node->y_max, bktr->line_length);
bktr->last_y = bktr->yclip2;
bktr->clip_start = j;
}
diff --git a/sys/dev/pci/cxgb/cxgb_main.c b/sys/dev/pci/cxgb/cxgb_main.c
index 40fd641976b..b59eb004bec 100644
--- a/sys/dev/pci/cxgb/cxgb_main.c
+++ b/sys/dev/pci/cxgb/cxgb_main.c
@@ -28,7 +28,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cxgb_main.c,v 1.5 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cxgb_main.c,v 1.6 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1009,8 +1009,8 @@ setup_rss(adapter_t *adap)
nq[pi->tx_chan] += pi->nqsets;
}
- nq[0] = max(nq[0], 1U);
- nq[1] = max(nq[1], 1U);
+ nq[0] = uimax(nq[0], 1U);
+ nq[1] = uimax(nq[1], 1U);
for (i = 0; i < RSS_TABLE_SIZE / 2; ++i) {
rspq_map[i] = i % nq[0];
rspq_map[i + RSS_TABLE_SIZE / 2] = (i % nq[1]) + nq[0];
diff --git a/sys/dev/pci/cxgb/cxgb_offload.c b/sys/dev/pci/cxgb/cxgb_offload.c
index bbeaed240d8..4f8a2117866 100644
--- a/sys/dev/pci/cxgb/cxgb_offload.c
+++ b/sys/dev/pci/cxgb/cxgb_offload.c
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cxgb_offload.c,v 1.4 2014/09/21 17:05:02 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cxgb_offload.c,v 1.5 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -247,12 +247,12 @@ cxgb_ulp_iscsi_ctl(adapter_t *adapter, unsigned int req, void *data)
* On tx, the iscsi pdu has to be <= tx page size and has to
* fit into the Tx PM FIFO.
*/
- uiip->max_txsz = min(adapter->params.tp.tx_pg_size,
+ uiip->max_txsz = uimin(adapter->params.tp.tx_pg_size,
t3_read_reg(adapter, A_PM1_TX_CFG) >> 17);
/* on rx, the iscsi pdu has to be < rx page size and the
whole pdu + cpl headers has to fit into one sge buffer */
uiip->max_rxsz =
- (unsigned int)min(adapter->params.tp.rx_pg_size,
+ (unsigned int)uimin(adapter->params.tp.rx_pg_size,
(adapter->sge.qs[0].fl[1].buf_size -
sizeof(struct cpl_rx_data) * 2 -
sizeof(struct cpl_rx_data_ddp)) );
@@ -1381,7 +1381,7 @@ cxgb_offload_activate(struct adapter *adapter)
if (!L2DATA(dev))
goto out_free;
- natids = min(tid_range.num / 2, MAX_ATIDS);
+ natids = uimin(tid_range.num / 2, MAX_ATIDS);
err = init_tid_tabs(&t->tid_maps, tid_range.num, natids,
stid_range.num, ATID_BASE, stid_range.base);
if (err)
diff --git a/sys/dev/pci/cxgb/cxgb_osdep.h b/sys/dev/pci/cxgb/cxgb_osdep.h
index 31d962d54ba..7b698b10fba 100644
--- a/sys/dev/pci/cxgb/cxgb_osdep.h
+++ b/sys/dev/pci/cxgb/cxgb_osdep.h
@@ -272,7 +272,7 @@ static const int debug_flags = DBG_RX;
#define test_and_clear_bit(bit, p) atomic_cmpset_int((p), ((*(p)) | bit), ((*(p)) & ~bit))
-#define max_t(type, a, b) (type)max((a), (b))
+#define max_t(type, a, b) (type)uimax((a), (b))
#define net_device ifnet
#define cpu_to_be32 htobe32
diff --git a/sys/dev/pci/cxgb/cxgb_sge.c b/sys/dev/pci/cxgb/cxgb_sge.c
index 576468f19f1..2a8e4625c16 100644
--- a/sys/dev/pci/cxgb/cxgb_sge.c
+++ b/sys/dev/pci/cxgb/cxgb_sge.c
@@ -28,7 +28,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cxgb_sge.c,v 1.5 2017/09/26 07:42:06 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cxgb_sge.c,v 1.6 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -190,8 +190,8 @@ reclaim_completed_tx(struct sge_txq *q, int nbufs, struct mbuf **mvec)
mtx_assert(&q->lock, MA_OWNED);
if (reclaim > 0) {
- n = free_tx_desc(q, min(reclaim, nbufs), mvec);
- reclaimed = min(reclaim, nbufs);
+ n = free_tx_desc(q, uimin(reclaim, nbufs), mvec);
+ reclaimed = uimin(reclaim, nbufs);
q->cleaned += reclaimed;
q->in_use -= reclaimed;
}
@@ -443,7 +443,7 @@ void
t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p)
{
- qs->rspq.holdoff_tmr = max(p->coalesce_nsecs/100, 1U);
+ qs->rspq.holdoff_tmr = uimax(p->coalesce_nsecs/100, 1U);
qs->rspq.polling = 0 /* p->polling */;
}
@@ -549,7 +549,7 @@ free_rx_bufs(adapter_t *sc, struct sge_fl *q)
static __inline void
__refill_fl(adapter_t *adap, struct sge_fl *fl)
{
- refill_fl(adap, fl, min(16U, fl->size - fl->credits));
+ refill_fl(adap, fl, uimin(16U, fl->size - fl->credits));
}
#ifndef DISABLE_MBUF_IOVEC
@@ -1133,7 +1133,7 @@ write_wr_hdr_sgl(unsigned int ndesc, struct tx_desc *txd, struct txq_state *txqs
wrp = (struct work_request_hdr *)txd;
wrp->wr_hi = htonl(V_WR_DATATYPE(1) |
V_WR_SGLSFLT(1)) | wr_hi;
- wrp->wr_lo = htonl(V_WR_LEN(min(WR_FLITS,
+ wrp->wr_lo = htonl(V_WR_LEN(uimin(WR_FLITS,
sgl_flits + 1)) |
V_WR_GEN(txqs->gen)) | wr_lo;
wr_gen2(txd, txqs->gen);
diff --git a/sys/dev/pci/cxgb/cxgb_t3_hw.c b/sys/dev/pci/cxgb/cxgb_t3_hw.c
index 6dc6d01933a..721e2a153c1 100644
--- a/sys/dev/pci/cxgb/cxgb_t3_hw.c
+++ b/sys/dev/pci/cxgb/cxgb_t3_hw.c
@@ -28,7 +28,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cxgb_t3_hw.c,v 1.2 2018/02/08 09:05:19 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cxgb_t3_hw.c,v 1.3 2018/09/03 16:29:32 riastradh Exp $");
#ifdef CONFIG_DEFINED
@@ -838,7 +838,7 @@ static int t3_write_flash(adapter_t *adapter, unsigned int addr,
return ret;
for (left = n; left; left -= c) {
- c = min(left, 4U);
+ c = uimin(left, 4U);
for (val = 0, i = 0; i < c; ++i)
val = (val << 8) + *data++;
@@ -1050,7 +1050,7 @@ int t3_load_fw(adapter_t *adapter, const u8 *fw_data, unsigned int size)
size -= 8; /* trim off version and checksum */
for (addr = FW_FLASH_BOOT_ADDR; size; ) {
- unsigned int chunk_size = min(size, 256U);
+ unsigned int chunk_size = uimin(size, 256U);
ret = t3_write_flash(adapter, addr, chunk_size, fw_data);
if (ret)
@@ -2658,7 +2658,7 @@ int t3_tp_set_coalescing_size(adapter_t *adap, unsigned int size, int psh)
val |= F_RXCOALESCEENABLE;
if (psh)
val |= F_RXCOALESCEPSHEN;
- size = min(MAX_RX_COALESCING_LEN, size);
+ size = uimin(MAX_RX_COALESCING_LEN, size);
t3_write_reg(adap, A_TP_PARA_REG2, V_RXCOALESCESIZE(size) |
V_MAXRXDATA(MAX_RX_COALESCING_LEN));
}
@@ -2776,7 +2776,7 @@ void t3_load_mtus(adapter_t *adap, unsigned short mtus[NMTUS],
unsigned int i, w;
for (i = 0; i < NMTUS; ++i) {
- unsigned int mtu = min(mtus[i], mtu_cap);
+ unsigned int mtu = uimin(mtus[i], mtu_cap);
unsigned int log2 = fls(mtu);
if (!(mtu & ((1 << log2) >> 2))) /* round */
@@ -2787,7 +2787,7 @@ void t3_load_mtus(adapter_t *adap, unsigned short mtus[NMTUS],
for (w = 0; w < NCCTRL_WIN; ++w) {
unsigned int inc;
- inc = max(((mtu - 40) * alpha[w]) / avg_pkts[w],
+ inc = uimax(((mtu - 40) * alpha[w]) / avg_pkts[w],
CC_MIN_INCR);
t3_write_reg(adap, A_TP_CCTRL_TABLE, (i << 21) |
@@ -3461,10 +3461,10 @@ int t3_init_hw(adapter_t *adapter, u32 fw_params)
#ifdef CONFIG_CHELSIO_T3_CORE
t3_tp_set_coalescing_size(adapter,
- min(adapter->params.sge.max_pkt_size,
+ uimin(adapter->params.sge.max_pkt_size,
MAX_RX_COALESCING_LEN), 1);
t3_tp_set_max_rxsize(adapter,
- min(adapter->params.sge.max_pkt_size, 16384U));
+ uimin(adapter->params.sge.max_pkt_size, 16384U));
ulp_config(adapter, &adapter->params.tp);
#endif
if (is_pcie(adapter))
diff --git a/sys/dev/pci/cxgb/cxgb_xgmac.c b/sys/dev/pci/cxgb/cxgb_xgmac.c
index 2afd0123c7d..62f1e11a2e9 100644
--- a/sys/dev/pci/cxgb/cxgb_xgmac.c
+++ b/sys/dev/pci/cxgb/cxgb_xgmac.c
@@ -29,7 +29,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cxgb_xgmac.c,v 1.1 2010/03/21 21:11:13 jklos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cxgb_xgmac.c,v 1.2 2018/09/03 16:29:32 riastradh Exp $");
#ifdef CONFIG_DEFINED
#include <cxgb_include.h>
@@ -340,8 +340,8 @@ static int rx_fifo_hwm(int mtu)
{
int hwm;
- hwm = max(MAC_RXFIFO_SIZE - 3 * mtu, (MAC_RXFIFO_SIZE * 38) / 100);
- return min(hwm, MAC_RXFIFO_SIZE - 8192);
+ hwm = uimax(MAC_RXFIFO_SIZE - 3 * mtu, (MAC_RXFIFO_SIZE * 38) / 100);
+ return uimin(hwm, MAC_RXFIFO_SIZE - 8192);
}
int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
@@ -388,7 +388,7 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
* HWM only if flow-control is enabled.
*/
hwm = rx_fifo_hwm(mtu);
- lwm = min(3 * (int) mtu, MAC_RXFIFO_SIZE /4);
+ lwm = uimin(3 * (int) mtu, MAC_RXFIFO_SIZE /4);
v = t3_read_reg(adap, A_XGM_RXFIFO_CFG + mac->offset);
v &= ~V_RXFIFOPAUSELWM(M_RXFIFOPAUSELWM);
v |= V_RXFIFOPAUSELWM(lwm / 8);
@@ -404,7 +404,7 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu)
if (is_10G(adap))
thres /= 10;
thres = mtu > thres ? (mtu - thres + 7) / 8 : 0;
- thres = max(thres, 8U); /* need at least 8 */
+ thres = uimax(thres, 8U); /* need at least 8 */
t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset,
V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG),
V_TXFIFOTHRESH(thres) | V_TXIPG(1));
diff --git a/sys/dev/pci/cz.c b/sys/dev/pci/cz.c
index c3916f67560..41f4f385081 100644
--- a/sys/dev/pci/cz.c
+++ b/sys/dev/pci/cz.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cz.c,v 1.62 2016/07/07 06:55:41 msaitoh Exp $ */
+/* $NetBSD: cz.c,v 1.63 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* Copyright (c) 2000 Zembu Labs, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cz.c,v 1.62 2016/07/07 06:55:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cz.c,v 1.63 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -360,7 +360,7 @@ cz_attach(device_t parent, device_t self, void *aux)
if (cz->cz_ih == NULL) {
callout_init(&cz->cz_callout, 0);
if (cz_timeout_ticks == 0)
- cz_timeout_ticks = max(1, hz * CZ_POLL_MS / 1000);
+ cz_timeout_ticks = uimax(1, hz * CZ_POLL_MS / 1000);
aprint_normal_dev(cz->cz_dev,
"polling mode, %d ms interval (%d tick%s)\n", CZ_POLL_MS,
cz_timeout_ticks, cz_timeout_ticks == 1 ? "" : "s");
@@ -834,7 +834,7 @@ cz_wait_pci_doorbell(struct cz_softc *cz, const char *wstring)
int error;
while (CZ_PLX_READ(cz, PLX_PCI_LOCAL_DOORBELL)) {
- error = tsleep(cz, TTIPRI | PCATCH, wstring, max(1, hz/100));
+ error = tsleep(cz, TTIPRI | PCATCH, wstring, uimax(1, hz/100));
if ((error != 0) && (error != EWOULDBLOCK))
return (error);
}
@@ -1588,7 +1588,7 @@ cztty_transmit(struct cztty_softc *sc, struct tty *tp)
while ((tp->t_outq.c_cc > 0) && ((move = TX_MOVEABLE(get, put, size)))){
#ifdef HOSTRAMCODE
if (0) {
- move = min(tp->t_outq.c_cc, move);
+ move = uimin(tp->t_outq.c_cc, move);
error = q_to_b(&tp->t_outq, 0, move);
if (error != move) {
printf("%s: channel %d: error moving to "
@@ -1598,7 +1598,7 @@ cztty_transmit(struct cztty_softc *sc, struct tty *tp)
}
} else {
#endif
- move = min(ndqb(&tp->t_outq, 0), move);
+ move = uimin(ndqb(&tp->t_outq, 0), move);
bus_space_write_region_1(cz->cz_win_st, cz->cz_win_sh,
address + put, tp->t_outq.c_cf, move);
ndflush(&tp->t_outq, move);
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index e4dd6fcdc08..ff8dca5aa37 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bge.c,v 1.314 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_bge.c,v 1.315 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.314 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.315 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -3967,7 +3967,7 @@ alloc_retry:
ifp->if_start = bge_start;
ifp->if_init = bge_init;
ifp->if_watchdog = bge_watchdog;
- IFQ_SET_MAXLEN(&ifp->if_snd, max(BGE_TX_RING_CNT - 1, IFQ_MAXLEN));
+ IFQ_SET_MAXLEN(&ifp->if_snd, uimax(BGE_TX_RING_CNT - 1, IFQ_MAXLEN));
IFQ_SET_READY(&ifp->if_snd);
DPRINTFN(5, ("strcpy if_xname\n"));
strcpy(ifp->if_xname, device_xname(sc->bge_dev));
diff --git a/sys/dev/pci/if_bwfm_pci.c b/sys/dev/pci/if_bwfm_pci.c
index 31ebfb75ab2..b405cb4fbba 100644
--- a/sys/dev/pci/if_bwfm_pci.c
+++ b/sys/dev/pci/if_bwfm_pci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_pci.c,v 1.2 2018/09/01 22:01:03 riastradh Exp $ */
+/* $NetBSD: if_bwfm_pci.c,v 1.3 2018/09/03 16:29:32 riastradh Exp $ */
/* $OpenBSD: if_bwfm_pci.c,v 1.18 2018/02/08 05:00:38 patrick Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
@@ -1260,7 +1260,7 @@ bwfm_pci_ring_write_reserve_multi(struct bwfm_pci_softc *sc,
return NULL;
ret = BWFM_PCI_DMA_KVA(ring->ring) + (ring->w_ptr * ring->itemsz);
- *avail = min(count, available - 1);
+ *avail = uimin(count, available - 1);
if (*avail + ring->w_ptr > ring->nitem)
*avail = ring->nitem - ring->w_ptr;
ring->w_ptr += *avail;
@@ -2038,7 +2038,7 @@ bwfm_pci_msgbuf_query_dcmd(struct bwfm_softc *bwfm, int ifidx,
req->output_buf_len = htole16(*len);
req->trans_id = htole16(sc->sc_ioctl_reqid++);
- buflen = min(*len, BWFM_DMA_H2D_IOCTL_BUF_LEN);
+ buflen = uimin(*len, BWFM_DMA_H2D_IOCTL_BUF_LEN);
req->input_buf_len = htole16(buflen);
req->req_buf_addr.high_addr =
htole32((uint64_t)BWFM_PCI_DMA_DVA(sc->sc_ioctl_buf) >> 32);
@@ -2062,7 +2062,7 @@ bwfm_pci_msgbuf_query_dcmd(struct bwfm_softc *bwfm, int ifidx,
if (m == NULL)
return 1;
- *len = min(buflen, sc->sc_ioctl_resp_ret_len);
+ *len = uimin(buflen, sc->sc_ioctl_resp_ret_len);
if (buf)
memcpy(buf, mtod(m, char *), *len);
m_freem(m);
diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c
index defbc75ac88..67ea9b66d8e 100644
--- a/sys/dev/pci/if_de.c
+++ b/sys/dev/pci/if_de.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_de.c,v 1.154 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_de.c,v 1.155 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com)
@@ -37,7 +37,7 @@
* board which support 21040, 21041, or 21140 (mostly).
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.154 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.155 2018/09/03 16:29:32 riastradh Exp $");
#define TULIP_HDR_DATA
@@ -4476,7 +4476,7 @@ tulip_txput(
unsigned clsize = PAGE_SIZE - (((u_long) addr) & PAGE_MASK);
while (len > 0) {
- unsigned slen = min(len, clsize);
+ unsigned slen = uimin(len, clsize);
#ifdef BIG_PACKET
int partial = 0;
if (slen >= 2048)
diff --git a/sys/dev/pci/if_dge.c b/sys/dev/pci/if_dge.c
index 5baac035782..e64c3c0ade6 100644
--- a/sys/dev/pci/if_dge.c
+++ b/sys/dev/pci/if_dge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_dge.c,v 1.48 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_dge.c,v 1.49 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright (c) 2004, SUNET, Swedish University Computer Network.
@@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.48 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.49 2018/09/03 16:29:32 riastradh Exp $");
@@ -925,7 +925,7 @@ dge_attach(device_t parent, device_t self, void *aux)
ifp->if_watchdog = dge_watchdog;
ifp->if_init = dge_init;
ifp->if_stop = dge_stop;
- IFQ_SET_MAXLEN(&ifp->if_snd, max(DGE_IFQUEUELEN, IFQ_MAXLEN));
+ IFQ_SET_MAXLEN(&ifp->if_snd, uimax(DGE_IFQUEUELEN, IFQ_MAXLEN));
IFQ_SET_READY(&ifp->if_snd);
sc->sc_ethercom.ec_capabilities |=
diff --git a/sys/dev/pci/if_enavar.h b/sys/dev/pci/if_enavar.h
index cec6b71a2be..6e5433f8fe6 100644
--- a/sys/dev/pci/if_enavar.h
+++ b/sys/dev/pci/if_enavar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_enavar.h,v 1.3 2018/06/16 15:00:35 jdolecek Exp $ */
+/* $NetBSD: if_enavar.h,v 1.4 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* BSD LICENSE
@@ -427,7 +427,7 @@ static inline int ena_mbuf_count(struct mbuf *mbuf)
#define if_settransmitfn(ifp, txfn) (ifp)->if_transmit = (txfn)
#define if_setioctlfn(ifp, ioctlfn) (ifp)->if_ioctl = (ioctlfn)
#define if_setsendqlen(ifp, sqlen) \
- IFQ_SET_MAXLEN(&(ifp)->if_snd, max(sqlen, IFQ_MAXLEN))
+ IFQ_SET_MAXLEN(&(ifp)->if_snd, uimax(sqlen, IFQ_MAXLEN))
#define if_setsendqready(ifp) IFQ_SET_READY(&(ifp)->if_snd)
#define if_setifheaderlen(ifp, len) (ifp)->if_hdrlen = (len)
diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c
index 7221e805de4..9c759723b4c 100644
--- a/sys/dev/pci/if_iwi.c
+++ b/sys/dev/pci/if_iwi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_iwi.c,v 1.107 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_iwi.c,v 1.108 2018/09/03 16:29:32 riastradh Exp $ */
/* $OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $ */
/*-
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.107 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.108 2018/09/03 16:29:32 riastradh Exp $");
/*-
* Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -1879,7 +1879,7 @@ iwi_get_table0(struct iwi_softc *sc, uint32_t *tbl)
return copyout(buf, tbl, sizeof buf);
}
- size = min(CSR_READ_4(sc, IWI_CSR_TABLE0_SIZE), 128 - 1);
+ size = uimin(CSR_READ_4(sc, IWI_CSR_TABLE0_SIZE), 128 - 1);
CSR_READ_REGION_4(sc, IWI_CSR_TABLE0_BASE, &buf[1], size);
return copyout(buf, tbl, sizeof buf);
@@ -2146,14 +2146,14 @@ iwi_load_firmware(struct iwi_softc *sc, void *fw, int size)
cl = GETLE32(p); p += 4; cs += 4; sl -= 4;
}
while (sl > 0 && cl > 0) {
- int len = min(cl, sl);
+ int len = uimin(cl, sl);
sl -= len;
cl -= len;
p += len;
while (len > 0) {
- int mlen = min(len, IWI_CB_MAXDATALEN);
+ int mlen = uimin(len, IWI_CB_MAXDATALEN);
ctl = IWI_CB_DEFAULT_CTL | mlen;
sum = ctl ^ cs ^ cd;
diff --git a/sys/dev/pci/if_lmc.c b/sys/dev/pci/if_lmc.c
index cea5176ef5b..109b79b3dd2 100644
--- a/sys/dev/pci/if_lmc.c
+++ b/sys/dev/pci/if_lmc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lmc.c,v 1.66 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_lmc.c,v 1.67 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* Copyright (c) 2002-2006 David Boggs. <boggs@boggs.palo-alto.ca.us>
@@ -74,7 +74,7 @@
*/
# include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_lmc.c,v 1.66 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lmc.c,v 1.67 2018/09/03 16:29:32 riastradh Exp $");
# include <sys/param.h> /* OS version */
# include "opt_inet.h" /* INET6, INET */
# include "opt_altq_enabled.h" /* ALTQ */
@@ -3727,7 +3727,7 @@ netdev_poll(struct net_device *netdev, int *budget)
/* Allow processing up to netdev->quota incoming packets. */
/* This is the ONLY time lmc_interrupt() may process rx pkts. */
/* Otherwise (sc->quota == 0) and rxintr_cleanup() is a NOOP. */
- lmc_interrupt(sc, min(netdev->quota, *budget), 0);
+ lmc_interrupt(sc, uimin(netdev->quota, *budget), 0);
/* Report number of rx packets processed. */
received = netdev->quota - sc->quota;
diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c
index 894d78b6573..402a951c245 100644
--- a/sys/dev/pci/if_vge.c
+++ b/sys/dev/pci/if_vge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vge.c,v 1.64 2018/07/18 23:10:28 sevan Exp $ */
+/* $NetBSD: if_vge.c,v 1.65 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* Copyright (c) 2004
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.64 2018/07/18 23:10:28 sevan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.65 2018/09/03 16:29:32 riastradh Exp $");
/*
* VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver.
@@ -983,7 +983,7 @@ vge_attach(device_t parent, device_t self, void *aux)
#endif
#endif
ifp->if_watchdog = vge_watchdog;
- IFQ_SET_MAXLEN(&ifp->if_snd, max(VGE_IFQ_MAXLEN, IFQ_MAXLEN));
+ IFQ_SET_MAXLEN(&ifp->if_snd, uimax(VGE_IFQ_MAXLEN, IFQ_MAXLEN));
IFQ_SET_READY(&ifp->if_snd);
/*
diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c
index 0265c6b7307..4762a8f3dd4 100644
--- a/sys/dev/pci/if_wm.c
+++ b/sys/dev/pci/if_wm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.584 2018/08/09 16:27:23 msaitoh Exp $ */
+/* $NetBSD: if_wm.c,v 1.585 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.584 2018/08/09 16:27:23 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.585 2018/09/03 16:29:32 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -2722,7 +2722,7 @@ alloc_retry:
/* wm(4) doest not use ifp->if_watchdog, use wm_tick as watchdog. */
ifp->if_init = wm_init;
ifp->if_stop = wm_stop;
- IFQ_SET_MAXLEN(&ifp->if_snd, max(WM_IFQUEUELEN, IFQ_MAXLEN));
+ IFQ_SET_MAXLEN(&ifp->if_snd, uimax(WM_IFQUEUELEN, IFQ_MAXLEN));
IFQ_SET_READY(&ifp->if_snd);
/* Check for jumbo frame */
@@ -5012,7 +5012,7 @@ wm_adjust_qnum(struct wm_softc *sc, int nvectors)
break;
}
- hw_nqueues = min(hw_ntxqueues, hw_nrxqueues);
+ hw_nqueues = uimin(hw_ntxqueues, hw_nrxqueues);
/*
* As queues more than MSI-X vectors cannot improve scaling, we limit
@@ -5339,7 +5339,7 @@ wm_itrs_calculate(struct wm_softc *sc, struct wm_queue *wmq)
if (rxq->rxq_packets)
avg_size = rxq->rxq_bytes / rxq->rxq_packets;
if (txq->txq_packets)
- avg_size = max(avg_size, txq->txq_bytes / txq->txq_packets);
+ avg_size = uimax(avg_size, txq->txq_bytes / txq->txq_packets);
if (avg_size == 0) {
new_itr = 450; /* restore default value */
@@ -5350,7 +5350,7 @@ wm_itrs_calculate(struct wm_softc *sc, struct wm_queue *wmq)
avg_size += 24;
/* Don't starve jumbo frames */
- avg_size = min(avg_size, 3000);
+ avg_size = uimin(avg_size, 3000);
/* Give a little boost to mid-size frames */
if ((avg_size > 300) && (avg_size < 1200))
diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c
index a0fdaf2a059..759e00d4d85 100644
--- a/sys/dev/pci/if_wpi.c
+++ b/sys/dev/pci/if_wpi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wpi.c,v 1.82 2018/08/20 04:50:56 riastradh Exp $ */
+/* $NetBSD: if_wpi.c,v 1.83 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* Copyright (c) 2006, 2007
@@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.82 2018/08/20 04:50:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.83 2018/09/03 16:29:32 riastradh Exp $");
/*
* Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -2634,7 +2634,7 @@ wpi_get_power_index(struct wpi_softc *sc, struct wpi_power_group *group,
}
/* never exceed channel's maximum allowed Tx power */
- pwr = min(pwr, sc->maxpwr[chan]);
+ pwr = uimin(pwr, sc->maxpwr[chan]);
/* retrieve power index into gain tables from samples */
for (sample = group->samples; sample < &group->samples[3]; sample++)
diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c
index 104bb7dd65b..16501637bdd 100644
--- a/sys/dev/pci/if_xge.c
+++ b/sys/dev/pci/if_xge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xge.c,v 1.26 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_xge.c,v 1.27 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright (c) 2004, SUNET, Swedish University Computer Network.
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.26 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.27 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
@@ -536,7 +536,7 @@ xge_attach(device_t parent, device_t self, void *aux)
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_ioctl = xge_ioctl;
ifp->if_start = xge_start;
- IFQ_SET_MAXLEN(&ifp->if_snd, max(NTXDESCS - 1, IFQ_MAXLEN));
+ IFQ_SET_MAXLEN(&ifp->if_snd, uimax(NTXDESCS - 1, IFQ_MAXLEN));
IFQ_SET_READY(&ifp->if_snd);
/*
diff --git a/sys/dev/pci/iwic_bchan.c b/sys/dev/pci/iwic_bchan.c
index 3a7a4553ffb..a2184985c7b 100644
--- a/sys/dev/pci/iwic_bchan.c
+++ b/sys/dev/pci/iwic_bchan.c
@@ -1,4 +1,4 @@
-/* $NetBSD: iwic_bchan.c,v 1.9 2014/03/23 02:53:12 christos Exp $ */
+/* $NetBSD: iwic_bchan.c,v 1.10 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright (c) 1999, 2000 Dave Boyce. All rights reserved.
@@ -38,7 +38,7 @@
*---------------------------------------------------------------------------*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iwic_bchan.c,v 1.9 2014/03/23 02:53:12 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iwic_bchan.c,v 1.10 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -348,7 +348,7 @@ iwic_bchan_xirq(struct iwic_softc *sc, int chan_no)
while(chan->out_mbuf_cur && len != IWIC_BCHAN_FIFO_LEN)
{
- nextlen = min(chan->out_mbuf_cur_len, IWIC_BCHAN_FIFO_LEN - len);
+ nextlen = uimin(chan->out_mbuf_cur_len, IWIC_BCHAN_FIFO_LEN - len);
NDBGL1(L1_H_IRQ, "B_EXIR_XFR, wr fifo, len = %d", nextlen);
diff --git a/sys/dev/pci/iwic_dchan.c b/sys/dev/pci/iwic_dchan.c
index 046c4760e69..16d9e71b26a 100644
--- a/sys/dev/pci/iwic_dchan.c
+++ b/sys/dev/pci/iwic_dchan.c
@@ -1,4 +1,4 @@
-/* $NetBSD: iwic_dchan.c,v 1.9 2014/03/23 02:54:12 christos Exp $ */
+/* $NetBSD: iwic_dchan.c,v 1.10 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright (c) 1999, 2000 Dave Boyce. All rights reserved.
@@ -36,7 +36,7 @@
*---------------------------------------------------------------------------*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iwic_dchan.c,v 1.9 2014/03/23 02:54:12 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iwic_dchan.c,v 1.10 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -412,7 +412,7 @@ iwic_dchan_transmit(struct iwic_softc *sc)
return;
ptr = sc->sc_dchan.obuf_ptr;
- len = min(sc->sc_dchan.obuf_len, IWIC_DCHAN_FIFO_LEN);
+ len = uimin(sc->sc_dchan.obuf_len, IWIC_DCHAN_FIFO_LEN);
if(sc->sc_trace & TRACE_D_TX)
{
diff --git a/sys/dev/pci/ixgbe/if_sriov.c b/sys/dev/pci/ixgbe/if_sriov.c
index d1c62f7eb63..86697495539 100644
--- a/sys/dev/pci/ixgbe/if_sriov.c
+++ b/sys/dev/pci/ixgbe/if_sriov.c
@@ -412,7 +412,7 @@ ixgbe_vf_set_mc_addr(struct adapter *adapter, struct ixgbe_vf *vf, u32 *msg)
u32 vmolr, vec_bit, vec_reg, mta_reg;
entries = (msg[0] & IXGBE_VT_MSGINFO_MASK) >> IXGBE_VT_MSGINFO_SHIFT;
- entries = min(entries, IXGBE_MAX_VF_MC);
+ entries = uimin(entries, IXGBE_MAX_VF_MC);
vmolr = IXGBE_READ_REG(&adapter->hw, IXGBE_VMOLR(vf->pool));
diff --git a/sys/dev/pci/ixgbe/ixgbe.c b/sys/dev/pci/ixgbe/ixgbe.c
index fb1c766bb61..2e5717bffd5 100644
--- a/sys/dev/pci/ixgbe/ixgbe.c
+++ b/sys/dev/pci/ixgbe/ixgbe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.164 2018/08/29 09:03:14 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.165 2018/09/03 16:29:33 riastradh Exp $ */
/******************************************************************************
@@ -2620,11 +2620,11 @@ ixgbe_msix_que(void *arg)
if ((txr->bytes) && (txr->packets))
newitr = txr->bytes/txr->packets;
if ((rxr->bytes) && (rxr->packets))
- newitr = max(newitr, (rxr->bytes / rxr->packets));
+ newitr = uimax(newitr, (rxr->bytes / rxr->packets));
newitr += 24; /* account for hardware frame, crc */
/* set an upper boundary */
- newitr = min(newitr, 3000);
+ newitr = uimin(newitr, 3000);
/* Be nice to the mid range */
if ((newitr > 300) && (newitr < 1200))
@@ -6549,7 +6549,7 @@ ixgbe_configure_interrupts(struct adapter *adapter)
#ifdef RSS
/* If we're doing RSS, clamp at the number of RSS buckets */
if (adapter->feat_en & IXGBE_FEATURE_RSS)
- queues = min(queues, rss_getnumbuckets());
+ queues = uimin(queues, rss_getnumbuckets());
#endif
if (ixgbe_num_queues > queues) {
aprint_error_dev(adapter->dev, "ixgbe_num_queues (%d) is too large, using reduced amount (%d).\n", ixgbe_num_queues, queues);
@@ -6559,8 +6559,8 @@ ixgbe_configure_interrupts(struct adapter *adapter)
if (ixgbe_num_queues != 0)
queues = ixgbe_num_queues;
else
- queues = min(queues,
- min(mac->max_tx_queues, mac->max_rx_queues));
+ queues = uimin(queues,
+ uimin(mac->max_tx_queues, mac->max_rx_queues));
/* reflect correct sysctl value */
ixgbe_num_queues = queues;
diff --git a/sys/dev/pci/ixgbe/ixgbe_dcb.c b/sys/dev/pci/ixgbe/ixgbe_dcb.c
index cde64945e78..632a3829fc5 100644
--- a/sys/dev/pci/ixgbe/ixgbe_dcb.c
+++ b/sys/dev/pci/ixgbe/ixgbe_dcb.c
@@ -69,7 +69,7 @@ s32 ixgbe_dcb_calculate_tc_credits(u8 *bw, u16 *refill, u16 *max,
/* Find out the hw credits for each TC */
for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
- int val = min(bw[i] * multiplier, IXGBE_DCB_MAX_CREDIT_REFILL);
+ int val = uimin(bw[i] * multiplier, IXGBE_DCB_MAX_CREDIT_REFILL);
if (val < min_credit)
val = min_credit;
@@ -153,7 +153,7 @@ s32 ixgbe_dcb_calculate_tc_credits_cee(struct ixgbe_hw *hw,
p->link_percent = (u8)link_percentage;
/* Calculate credit refill ratio using multiplier */
- credit_refill = min(link_percentage * min_multiplier,
+ credit_refill = uimin(link_percentage * min_multiplier,
(u32)IXGBE_DCB_MAX_CREDIT_REFILL);
/* Refill at least minimum credit */
diff --git a/sys/dev/pci/ixgbe/ixv.c b/sys/dev/pci/ixgbe/ixv.c
index 553be85daa9..0cd5be8aa85 100644
--- a/sys/dev/pci/ixgbe/ixv.c
+++ b/sys/dev/pci/ixgbe/ixv.c
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.105 2018/06/06 20:02:31 kamil Exp $*/
+/*$NetBSD: ixv.c,v 1.106 2018/09/03 16:29:33 riastradh Exp $*/
/******************************************************************************
@@ -932,11 +932,11 @@ ixv_msix_que(void *arg)
if ((txr->bytes) && (txr->packets))
newitr = txr->bytes/txr->packets;
if ((rxr->bytes) && (rxr->packets))
- newitr = max(newitr, (rxr->bytes / rxr->packets));
+ newitr = uimax(newitr, (rxr->bytes / rxr->packets));
newitr += 24; /* account for hardware frame, crc */
/* set an upper boundary */
- newitr = min(newitr, 3000);
+ newitr = uimin(newitr, 3000);
/* Be nice to the mid range */
if ((newitr > 300) && (newitr < 1200))
diff --git a/sys/dev/pci/machfb.c b/sys/dev/pci/machfb.c
index d7894ecac47..32d006858dd 100644
--- a/sys/dev/pci/machfb.c
+++ b/sys/dev/pci/machfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: machfb.c,v 1.94 2017/06/02 19:35:54 macallan Exp $ */
+/* $NetBSD: machfb.c,v 1.95 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright (c) 2002 Bang Jun-Young
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0,
- "$NetBSD: machfb.c,v 1.94 2017/06/02 19:35:54 macallan Exp $");
+ "$NetBSD: machfb.c,v 1.95 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -502,7 +502,7 @@ mach64_attach(device_t parent, device_t self, void *aux)
if ((edid_data = prop_dictionary_get(device_properties(self), "EDID"))
!= NULL) {
- sc->sc_edid_size = min(1024, prop_data_size(edid_data));
+ sc->sc_edid_size = uimin(1024, prop_data_size(edid_data));
memset(sc->sc_edid_data, 0, sizeof(sc->sc_edid_data));
memcpy(sc->sc_edid_data, prop_data_data_nocopy(edid_data),
sc->sc_edid_size);
diff --git a/sys/dev/pci/mly.c b/sys/dev/pci/mly.c
index f17d56bd164..4d26439cab2 100644
--- a/sys/dev/pci/mly.c
+++ b/sys/dev/pci/mly.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mly.c,v 1.50 2016/07/07 06:55:41 msaitoh Exp $ */
+/* $NetBSD: mly.c,v 1.51 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mly.c,v 1.50 2016/07/07 06:55:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mly.c,v 1.51 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1616,7 +1616,7 @@ mly_alloc_ccbs(struct mly_softc *mly)
mly->mly_ncmds = MLY_CCBS_RESV;
else {
i = le16toh(mly->mly_controllerinfo->maximum_parallel_commands);
- mly->mly_ncmds = min(MLY_MAX_CCBS, i);
+ mly->mly_ncmds = uimin(MLY_MAX_CCBS, i);
}
/*
@@ -2382,14 +2382,14 @@ mly_user_command(struct mly_softc *mly, struct mly_user_command *uc)
/* Return the sense buffer to userspace. */
if (uc->RequestSenseLength > 0 && mc->mc_sense > 0) {
rv = copyout(mc->mc_packet, uc->RequestSenseBuffer,
- min(uc->RequestSenseLength, mc->mc_sense));
+ uimin(uc->RequestSenseLength, mc->mc_sense));
if (rv != 0)
goto out;
}
/* Return command results to userspace (caller will copy out). */
uc->DataTransferLength = mc->mc_resid;
- uc->RequestSenseLength = min(uc->RequestSenseLength, mc->mc_sense);
+ uc->RequestSenseLength = uimin(uc->RequestSenseLength, mc->mc_sense);
uc->CommandStatus = mc->mc_status;
rv = 0;
diff --git a/sys/dev/pci/nvme_pci.c b/sys/dev/pci/nvme_pci.c
index 29d9c4d999b..ee0c182febd 100644
--- a/sys/dev/pci/nvme_pci.c
+++ b/sys/dev/pci/nvme_pci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: nvme_pci.c,v 1.20 2018/04/18 10:05:59 nonaka Exp $ */
+/* $NetBSD: nvme_pci.c,v 1.21 2018/09/03 16:29:32 riastradh Exp $ */
/* $OpenBSD: nvme_pci.c,v 1.3 2016/04/14 11:18:32 dlg Exp $ */
/*
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvme_pci.c,v 1.20 2018/04/18 10:05:59 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme_pci.c,v 1.21 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -397,7 +397,7 @@ nvme_pci_setup_intr(struct pci_attach_args *pa, struct nvme_pci_softc *psc)
/* MSI-X */
max_type = PCI_INTR_TYPE_MSIX;
- counts[PCI_INTR_TYPE_MSIX] = min(pci_msix_count(pa->pa_pc, pa->pa_tag),
+ counts[PCI_INTR_TYPE_MSIX] = uimin(pci_msix_count(pa->pa_pc, pa->pa_tag),
ncpu + 1);
if (counts[PCI_INTR_TYPE_MSIX] > 0) {
memset(alloced_counts, 0, sizeof(alloced_counts));
diff --git a/sys/dev/pci/pccbb.c b/sys/dev/pci/pccbb.c
index eaf8d163276..73ed85435a5 100644
--- a/sys/dev/pci/pccbb.c
+++ b/sys/dev/pci/pccbb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pccbb.c,v 1.211 2017/05/10 02:46:33 msaitoh Exp $ */
+/* $NetBSD: pccbb.c,v 1.212 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright (c) 1998, 1999 and 2000
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.211 2017/05/10 02:46:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.212 2018/09/03 16:29:32 riastradh Exp $");
/*
#define CBB_DEBUG
@@ -2266,7 +2266,7 @@ pccbb_pcmcia_delay(struct pccbb_softc *sc, int timo, const char *wmesg)
panic("pccbb_pcmcia_delay: called in interrupt context");
#endif
DPRINTF(("pccbb_pcmcia_delay: \"%s\", sleep %d ms\n", wmesg, timo));
- kpause(wmesg, false, max(mstohz(timo), 1), NULL);
+ kpause(wmesg, false, uimax(mstohz(timo), 1), NULL);
}
/*
diff --git a/sys/dev/pci/pciide_common.c b/sys/dev/pci/pciide_common.c
index 665d6ae238b..84ce131e8e8 100644
--- a/sys/dev/pci/pciide_common.c
+++ b/sys/dev/pci/pciide_common.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pciide_common.c,v 1.65 2017/10/20 07:06:08 jdolecek Exp $ */
+/* $NetBSD: pciide_common.c,v 1.66 2018/09/03 16:29:32 riastradh Exp $ */
/*
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.65 2017/10/20 07:06:08 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.66 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
@@ -601,7 +601,7 @@ pciide_channel_dma_setup(struct pciide_channel *cp)
}
#define NIDEDMA_TABLES(sc) \
- (MAXPHYS/(min((sc)->sc_dma_maxsegsz, PAGE_SIZE)) + 1)
+ (MAXPHYS/(uimin((sc)->sc_dma_maxsegsz, PAGE_SIZE)) + 1)
int
pciide_dma_table_setup(struct pciide_softc *sc, int channel, int drive)
diff --git a/sys/dev/pci/piixide.c b/sys/dev/pci/piixide.c
index 0dda8791b09..c0fa2fe1332 100644
--- a/sys/dev/pci/piixide.c
+++ b/sys/dev/pci/piixide.c
@@ -1,4 +1,4 @@
-/* $NetBSD: piixide.c,v 1.66 2018/05/26 13:33:44 jakllsch Exp $ */
+/* $NetBSD: piixide.c,v 1.67 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.66 2018/05/26 13:33:44 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.67 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -620,7 +620,7 @@ piix_setup_channel(struct ata_channel *chp)
if ((drvp[0].drive_flags & ATA_DRIVE_DMA) &&
(drvp[1].drive_flags & ATA_DRIVE_DMA)) {
mode[0] = mode[1] =
- min(drvp[0].DMA_mode, drvp[1].DMA_mode);
+ uimin(drvp[0].DMA_mode, drvp[1].DMA_mode);
drvp[0].DMA_mode = mode[0];
drvp[1].DMA_mode = mode[1];
goto ok;
@@ -657,7 +657,7 @@ piix_setup_channel(struct ata_channel *chp)
mode[0] = drvp[0].PIO_mode;
} else {
mode[0] = mode[1] =
- min(drvp[1].PIO_mode, drvp[0].PIO_mode);
+ uimin(drvp[1].PIO_mode, drvp[0].PIO_mode);
drvp[0].PIO_mode = mode[0];
drvp[1].PIO_mode = mode[1];
}
diff --git a/sys/dev/pci/pm2fb.c b/sys/dev/pci/pm2fb.c
index 37abde27d23..102949e7e04 100644
--- a/sys/dev/pci/pm2fb.c
+++ b/sys/dev/pci/pm2fb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pm2fb.c,v 1.29 2016/12/16 23:34:46 macallan Exp $ */
+/* $NetBSD: pm2fb.c,v 1.30 2018/09/03 16:29:32 riastradh Exp $ */
/*
* Copyright (c) 2009, 2012 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.29 2016/12/16 23:34:46 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.30 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -429,7 +429,7 @@ pm2fb_attach(device_t parent, device_t self, void *aux)
sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
glyphcache_init(&sc->sc_gc, sc->sc_height + 5,
- min(2047, (sc->sc_fbsize / sc->sc_stride))
+ uimin(2047, (sc->sc_fbsize / sc->sc_stride))
- sc->sc_height - 5,
sc->sc_width,
ri->ri_font->fontwidth,
@@ -446,7 +446,7 @@ pm2fb_attach(device_t parent, device_t self, void *aux)
} else
(*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr);
glyphcache_init(&sc->sc_gc, sc->sc_height + 5,
- min(2047, (sc->sc_fbsize / sc->sc_stride))
+ uimin(2047, (sc->sc_fbsize / sc->sc_stride))
- sc->sc_height - 5,
sc->sc_width,
ri->ri_font->fontwidth,
@@ -1217,7 +1217,7 @@ pm2fb_putchar_aa(void *cookie, int row, int col, u_int c, long attr)
PM2RE_RECTANGLE | PM2RE_SYNC_ON_HOST |
PM2RE_INC_X | PM2RE_INC_Y);
- pm2fb_wait(sc, min(200, ri->ri_fontscale));
+ pm2fb_wait(sc, uimin(200, ri->ri_fontscale));
/*
* and now we just hammer the forground colour and alpha values into
diff --git a/sys/dev/pci/radeonfb.c b/sys/dev/pci/radeonfb.c
index 7272ae9b12a..afffd185590 100644
--- a/sys/dev/pci/radeonfb.c
+++ b/sys/dev/pci/radeonfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: radeonfb.c,v 1.99 2018/06/28 17:22:09 macallan Exp $ */
+/* $NetBSD: radeonfb.c,v 1.100 2018/09/03 16:29:32 riastradh Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.99 2018/06/28 17:22:09 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.100 2018/09/03 16:29:32 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -966,7 +966,7 @@ radeonfb_attach(device_t parent, device_t dev, void *aux)
* cache, cap at 4096 lines
*/
glyphcache_init(&dp->rd_gc, dp->rd_virty + 4,
- min(4096,
+ uimin(4096,
(dp->rd_curoff / dp->rd_stride) - (dp->rd_virty + 4)),
dp->rd_virtx,
ri->ri_font->fontwidth,
@@ -1809,7 +1809,7 @@ radeonfb_getconnectors(struct radeonfb_softc *sc)
ddc > RADEON_DDC_CRT2 ? RADEON_DDC_NONE : ddc;
sc->sc_ports[port].rp_dac_type = dac;
sc->sc_ports[port].rp_conn_type =
- min(conn, RADEON_CONN_UNSUPPORTED) ;
+ uimin(conn, RADEON_CONN_UNSUPPORTED) ;
sc->sc_ports[port].rp_tmds_type = tmds;
@@ -1973,7 +1973,7 @@ radeonfb_gettmds(struct radeonfb_softc *sc)
if (GETBIOS8(sc, ptr) == 3) {
/* revision three table */
n = GETBIOS8(sc, ptr + 5) + 1;
- n = min(n, 4);
+ n = uimin(n, 4);
memset(sc->sc_tmds_pll, 0, sizeof (sc->sc_tmds_pll));
for (i = 0; i < n; i++) {
@@ -4333,7 +4333,7 @@ radeonfb_brightness_up(device_t dev)
/* make sure pushing the hotkeys always has an effect */
dp->rd_bl_on = 1;
level = dp->rd_bl_level;
- level = min(RADEONFB_BACKLIGHT_MAX, level + 5);
+ level = uimin(RADEONFB_BACKLIGHT_MAX, level + 5);
radeonfb_set_backlight(dp, level);
}
@@ -4349,6 +4349,6 @@ radeonfb_brightness_down(device_t dev)
/* make sure pushing the hotkeys always has an effect */
dp->rd_bl_on = 1;
level = dp->rd_bl_level;
- level = max(0, level - 5);
+ level = uimax(0, level - 5);
radeonfb_set_backlight(dp, level);
}
diff --git a/sys/dev/pci/twa.c b/sys/dev/pci/twa.c
index 1725b7a60dd..6829629921a 100644
--- a/sys/dev/pci/twa.c
+++ b/sys/dev/pci/twa.c
@@ -1,4 +1,4 @@
-/* $NetBSD: twa.c,v 1.55 2016/09/27 12:04:16 pgoyette Exp $ */
+/* $NetBSD: twa.c,v 1.56 2018/09/03 16:29:32 riastradh Exp $ */
/* $wasabi: twa.c,v 1.27 2006/07/28 18:17:21 wrstuden Exp $ */
/*-
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.55 2016/09/27 12:04:16 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.56 2018/09/03 16:29:32 riastradh Exp $");
//#define TWA_DEBUG
@@ -2255,7 +2255,7 @@ fw_passthru_done:
/* Copy compatibility information to user space. */
copyout(&comp_pkt, user_buf->pdata,
- min(sizeof(struct tw_cl_compatibility_packet),
+ uimin(sizeof(struct tw_cl_compatibility_packet),
user_buf->twa_drvr_pkt.buffer_length));
break;
}
diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c
index 64185b35122..1a3feab64fa 100644
--- a/sys/dev/pci/ubsec.c
+++ b/sys/dev/pci/ubsec.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ubsec.c,v 1.43 2016/07/07 06:55:41 msaitoh Exp $ */
+/* $NetBSD: ubsec.c,v 1.44 2018/09/03 16:29:32 riastradh Exp $ */
/* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
/* $OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$ */
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.43 2016/07/07 06:55:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.44 2018/09/03 16:29:32 riastradh Exp $");
#undef UBSEC_DEBUG
@@ -1626,7 +1626,7 @@ ubsec_process(void *arg, struct cryptop *crp, int hint)
}
len = MCLBYTES;
}
- m->m_len = len = min(totlen, len);
+ m->m_len = len = uimin(totlen, len);
totlen -= len;
*mp = m;
mp = &m->m_next;
@@ -1931,7 +1931,7 @@ ubsec_mcopy(struct mbuf *srcm, struct mbuf *dstm, int hoffset, int toffset)
dlen = dstm->m_len;
while (1) {
- for (i = 0; i < min(slen, dlen); i++) {
+ for (i = 0; i < uimin(slen, dlen); i++) {
if (j < hoffset || j >= toffset)
*dptr++ = *sptr++;
slen--;
diff --git a/sys/dev/pcmcia/if_cnw.c b/sys/dev/pcmcia/if_cnw.c
index c80ef7b5795..c072ae08758 100644
--- a/sys/dev/pcmcia/if_cnw.c
+++ b/sys/dev/pcmcia/if_cnw.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cnw.c,v 1.63 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_cnw.c,v 1.64 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -105,7 +105,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cnw.c,v 1.63 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnw.c,v 1.64 2018/09/03 16:29:33 riastradh Exp $");
#include "opt_inet.h"
@@ -789,7 +789,7 @@ cnw_read(struct cnw_softc *sc)
mbytes -= pad;
}
mptr = mtod(m, u_int8_t *);
- mbytes = m->m_len = min(totbytes, mbytes);
+ mbytes = m->m_len = uimin(totbytes, mbytes);
totbytes -= mbytes;
while (mbytes > 0) {
if (bufbytes == 0) {
diff --git a/sys/dev/pcmcia/if_xi.c b/sys/dev/pcmcia/if_xi.c
index 8b20914a922..f4792bed123 100644
--- a/sys/dev/pcmcia/if_xi.c
+++ b/sys/dev/pcmcia/if_xi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_xi.c,v 1.82 2018/06/26 06:48:01 msaitoh Exp $ */
+/* $NetBSD: if_xi.c,v 1.83 2018/09/03 16:29:33 riastradh Exp $ */
/* OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp */
/*
@@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.82 2018/06/26 06:48:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.83 2018/09/03 16:29:33 riastradh Exp $");
#include "opt_inet.h"
@@ -446,7 +446,7 @@ xi_get(struct xi_softc *sc)
len -= newdata - m->m_data;
m->m_data = newdata;
}
- len = min(pktlen, len);
+ len = uimin(pktlen, len);
data = mtod(m, u_int8_t *);
if (len > 1) {
len &= ~1;
diff --git a/sys/dev/pcmcia/wdc_pcmcia.c b/sys/dev/pcmcia/wdc_pcmcia.c
index 6ae327e2f1f..d18513c50d1 100644
--- a/sys/dev/pcmcia/wdc_pcmcia.c
+++ b/sys/dev/pcmcia/wdc_pcmcia.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wdc_pcmcia.c,v 1.126 2017/10/20 07:06:08 jdolecek Exp $ */
+/* $NetBSD: wdc_pcmcia.c,v 1.127 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.126 2017/10/20 07:06:08 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.127 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -402,7 +402,7 @@ wdc_pcmcia_datain_memory(struct ata_channel *chp, int flags, void *buf,
while (len > 0) {
size_t n;
- n = min(len, 1024);
+ n = uimin(len, 1024);
if ((flags & ATA_DRIVE_CAP32) && (n & 3) == 0)
bus_space_read_region_stream_4(wdr->data32iot,
wdr->data32ioh, 0, buf, n >> 2);
@@ -423,7 +423,7 @@ wdc_pcmcia_dataout_memory(struct ata_channel *chp, int flags, void *buf,
while (len > 0) {
size_t n;
- n = min(len, 1024);
+ n = uimin(len, 1024);
if ((flags & ATA_DRIVE_CAP32) && (n & 3) == 0)
bus_space_write_region_stream_4(wdr->data32iot,
wdr->data32ioh, 0, buf, n >> 2);
diff --git a/sys/dev/podulebus/hcsc.c b/sys/dev/podulebus/hcsc.c
index 37c88be83b6..b41854edbc6 100644
--- a/sys/dev/podulebus/hcsc.c
+++ b/sys/dev/podulebus/hcsc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hcsc.c,v 1.21 2012/10/27 17:18:37 chs Exp $ */
+/* $NetBSD: hcsc.c,v 1.22 2018/09/03 16:29:33 riastradh Exp $ */
/*
* Copyright (c) 2001 Ben Harris
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hcsc.c,v 1.21 2012/10/27 17:18:37 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hcsc.c,v 1.22 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
@@ -278,7 +278,7 @@ hcsc_pdma_in(struct ncr5380_softc *ncr_sc, int phase, int datalen,
resid = datalen;
while (resid > 0) {
- len = min(resid, HCSC_TSIZE_IN);
+ len = uimin(resid, HCSC_TSIZE_IN);
if (hcsc_ready(ncr_sc) == 0)
goto interrupt;
bus_space_read_multi_1(pdmat, pdmah, 0, data, len);
diff --git a/sys/dev/podulebus/oak.c b/sys/dev/podulebus/oak.c
index ff12c7bdc3a..3653a5341e9 100644
--- a/sys/dev/podulebus/oak.c
+++ b/sys/dev/podulebus/oak.c
@@ -1,4 +1,4 @@
-/* $NetBSD: oak.c,v 1.20 2012/10/27 17:18:37 chs Exp $ */
+/* $NetBSD: oak.c,v 1.21 2018/09/03 16:29:33 riastradh Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: oak.c,v 1.20 2012/10/27 17:18:37 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oak.c,v 1.21 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
@@ -293,7 +293,7 @@ oak_pdma_in(struct ncr5380_softc *ncr_sc, int phase, int datalen,
resid = datalen;
while (resid > 0) {
- len = min(resid, OAK_TSIZE_IN);
+ len = uimin(resid, OAK_TSIZE_IN);
if (oak_ready(ncr_sc) == 0)
goto interrupt;
KASSERT(BUS_SPACE_ALIGNED_POINTER(data, uint16_t));
diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c
index bf42718f08e..6f17d5b34b5 100644
--- a/sys/dev/ppbus/lpt.c
+++ b/sys/dev/ppbus/lpt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: lpt.c,v 1.30 2014/07/25 08:10:38 dholland Exp $ */
+/* $NetBSD: lpt.c,v 1.31 2018/09/03 16:29:33 riastradh Exp $ */
/*
* Copyright (c) 1990 William F. Jolitz, TeleMuse
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lpt.c,v 1.30 2014/07/25 08:10:38 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lpt.c,v 1.31 2018/09/03 16:29:33 riastradh Exp $");
#include "opt_ppbus_lpt.h"
@@ -551,7 +551,7 @@ lptread(dev_t dev_id, struct uio *uio, int ioflag)
sc->sc_state &= ~INTERRUPTED;
while (uio->uio_resid) {
error = ppbus_read(device_parent(dev), sc->sc_outbuf,
- min(BUFSIZE, uio->uio_resid), 0, &len);
+ uimin(BUFSIZE, uio->uio_resid), 0, &len);
/* If error or no more data, stop */
if (error) {
diff --git a/sys/dev/rndpseudo.c b/sys/dev/rndpseudo.c
index fbd6be42499..30f0d499a5a 100644
--- a/sys/dev/rndpseudo.c
+++ b/sys/dev/rndpseudo.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rndpseudo.c,v 1.36 2017/11/30 20:25:54 christos Exp $ */
+/* $NetBSD: rndpseudo.c,v 1.37 2018/09/03 16:29:30 riastradh Exp $ */
/*-
* Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rndpseudo.c,v 1.36 2017/11/30 20:25:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rndpseudo.c,v 1.37 2018/09/03 16:29:30 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -459,7 +459,7 @@ rnd_write(struct file *fp, off_t *offp, struct uio *uio,
#endif
break;
}
- n = min(RND_TEMP_BUFFER_SIZE, uio->uio_resid);
+ n = uimin(RND_TEMP_BUFFER_SIZE, uio->uio_resid);
ret = uiomove((void *)bf, n, uio);
if (ret != 0)
diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c
index 10c94eb8f87..6caca2ef327 100644
--- a/sys/dev/sbus/be.c
+++ b/sys/dev/sbus/be.c
@@ -1,4 +1,4 @@
-/* $NetBSD: be.c,v 1.88 2018/06/26 06:48:02 msaitoh Exp $ */
+/* $NetBSD: be.c,v 1.89 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.88 2018/06/26 06:48:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.89 2018/09/03 16:29:33 riastradh Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@@ -524,7 +524,7 @@ be_get(struct be_softc *sc, int idx, int totlen)
if (m->m_flags & M_EXT)
len = MCLBYTES;
}
- m->m_len = len = min(totlen, len);
+ m->m_len = len = uimin(totlen, len);
memcpy(mtod(m, void *), bp + boff, len);
boff += len;
totlen -= len;
diff --git a/sys/dev/sbus/bpp.c b/sys/dev/sbus/bpp.c
index 31b72f13055..52c6e2092a9 100644
--- a/sys/dev/sbus/bpp.c
+++ b/sys/dev/sbus/bpp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bpp.c,v 1.42 2017/10/25 08:12:38 maya Exp $ */
+/* $NetBSD: bpp.c,v 1.43 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpp.c,v 1.42 2017/10/25 08:12:38 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpp.c,v 1.43 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
#include <sys/ioctl.h>
@@ -345,7 +345,7 @@ bppwrite(dev_t dev, struct uio *uio, int flags)
*/
while (uio->uio_resid > 0) {
uint8_t *bp = sc->sc_buf;
- size_t len = min(sc->sc_bufsz, uio->uio_resid);
+ size_t len = uimin(sc->sc_bufsz, uio->uio_resid);
if ((error = uiomove(bp, len, uio)) != 0)
break;
diff --git a/sys/dev/sbus/dbri.c b/sys/dev/sbus/dbri.c
index eb8d5860973..49ef7f7b106 100644
--- a/sys/dev/sbus/dbri.c
+++ b/sys/dev/sbus/dbri.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dbri.c,v 1.38 2018/01/12 05:59:20 mrg Exp $ */
+/* $NetBSD: dbri.c,v 1.39 2018/09/03 16:29:33 riastradh Exp $ */
/*
* Copyright (C) 1997 Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de)
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.38 2018/01/12 05:59:20 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.39 2018/09/03 16:29:33 riastradh Exp $");
#include "audio.h"
#if NAUDIO > 0
@@ -1815,9 +1815,9 @@ dbri_set_port(void *hdl, mixer_ctrl_t *mc)
switch (mc->dev) {
case DBRI_VOL_OUTPUT: /* master volume */
latt = (latt & 0xc0) | (63 -
- min(mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] >> 2, 63));
+ uimin(mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] >> 2, 63));
ratt = (ratt & 0xc0) | (63 -
- min(mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] >> 2, 63));
+ uimin(mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] >> 2, 63));
break;
case DBRI_ENABLE_MONO: /* built-in speaker */
if (mc->un.ord == 1) {
diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c
index bd0e3a5e88d..4068838949b 100644
--- a/sys/dev/sbus/magma.c
+++ b/sys/dev/sbus/magma.c
@@ -1,4 +1,4 @@
-/* $NetBSD: magma.c,v 1.59 2014/07/25 08:10:38 dholland Exp $ */
+/* $NetBSD: magma.c,v 1.60 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 1998 Iain Hibbert
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.59 2014/07/25 08:10:38 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.60 2018/09/03 16:29:33 riastradh Exp $");
#if 0
#define MAGMA_DEBUG
@@ -1564,7 +1564,7 @@ mbpp_rw(dev_t dev, struct uio *uio, int flag)
if( uio->uio_resid == 0 )
return(0);
- buflen = min(uio->uio_resid, mp->mp_burst);
+ buflen = uimin(uio->uio_resid, mp->mp_burst);
buffer = malloc(buflen, M_DEVBUF, M_WAITOK);
if( buffer == NULL )
return(ENOMEM);
@@ -1582,7 +1582,7 @@ mbpp_rw(dev_t dev, struct uio *uio, int flag)
len = cnt = 0;
while( uio->uio_resid > 0 ) {
- len = min(buflen, uio->uio_resid);
+ len = uimin(buflen, uio->uio_resid);
ptr = buffer;
if( uio->uio_rw == UIO_WRITE ) {
diff --git a/sys/dev/sbus/mgx.c b/sys/dev/sbus/mgx.c
index 25449ad9e19..c82dde2d444 100644
--- a/sys/dev/sbus/mgx.c
+++ b/sys/dev/sbus/mgx.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mgx.c,v 1.13 2018/03/28 15:33:44 macallan Exp $ */
+/* $NetBSD: mgx.c,v 1.14 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
/* a console driver for the SSB 4096V-MGX graphics card */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.13 2018/03/28 15:33:44 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.14 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1164,7 +1164,7 @@ mgx_do_cursor(struct mgx_softc *sc, struct wsdisplay_cursor *cur)
mgx_set_cursor(sc);
}
if (cur->which & WSDISPLAY_CURSOR_DOCMAP) {
- int cnt = min(2, cur->cmap.count);
+ int cnt = uimin(2, cur->cmap.count);
uint8_t c;
uint8_t r[2], g[2], b[2];
diff --git a/sys/dev/sbus/qe.c b/sys/dev/sbus/qe.c
index 7d3fc0494b5..fc1322edbe8 100644
--- a/sys/dev/sbus/qe.c
+++ b/sys/dev/sbus/qe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: qe.c,v 1.69 2018/06/26 06:48:02 msaitoh Exp $ */
+/* $NetBSD: qe.c,v 1.70 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.69 2018/06/26 06:48:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.70 2018/09/03 16:29:33 riastradh Exp $");
#define QEDEBUG
@@ -353,7 +353,7 @@ qe_get(struct qe_softc *sc, int idx, int totlen)
if (m->m_flags & M_EXT)
len = MCLBYTES;
}
- m->m_len = len = min(totlen, len);
+ m->m_len = len = uimin(totlen, len);
memcpy(mtod(m, void *), bp + boff, len);
boff += len;
totlen -= len;
diff --git a/sys/dev/sbus/zx.c b/sys/dev/sbus/zx.c
index d442289ef36..2b04204af62 100644
--- a/sys/dev/sbus/zx.c
+++ b/sys/dev/sbus/zx.c
@@ -1,4 +1,4 @@
-/* $NetBSD: zx.c,v 1.41 2016/04/21 18:10:57 macallan Exp $ */
+/* $NetBSD: zx.c,v 1.42 2018/09/03 16:29:33 riastradh Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.41 2016/04/21 18:10:57 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.42 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -678,13 +678,13 @@ zx_cursor_move(struct zx_softc *sc)
y = sc->sc_curpos.y - sc->sc_curhot.y;
if (x < 0) {
- sx = min(-x, 32);
+ sx = uimin(-x, 32);
x = 0;
} else
sx = 0;
if (y < 0) {
- sy = min(-y, 32);
+ sy = uimin(-y, 32);
y = 0;
} else
sy = 0;
diff --git a/sys/dev/scsipi/cd.c b/sys/dev/scsipi/cd.c
index 2f40dacec98..f84325ad658 100644
--- a/sys/dev/scsipi/cd.c
+++ b/sys/dev/scsipi/cd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cd.c,v 1.341 2017/06/17 22:35:50 mlelstv Exp $ */
+/* $NetBSD: cd.c,v 1.342 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.341 2017/06/17 22:35:50 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.342 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1252,7 +1252,7 @@ cdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
args->data_format, args->track, &data, len, 0);
if (error)
return (error);
- len = min(len, _2btol(data.header.data_len) +
+ len = uimin(len, _2btol(data.header.data_len) +
sizeof(struct cd_sub_channel_header));
return (copyout(&data, args->data, len));
}
@@ -1282,7 +1282,7 @@ cdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
error = do_cdioreadentries(cd, te, &toc);
if (error != 0)
return error;
- return copyout(toc.entries, te->data, min(te->data_len,
+ return copyout(toc.entries, te->data, uimin(te->data_len,
toc.header.len - (sizeof(toc.header.starting_track)
+ sizeof(toc.header.ending_track))));
}
@@ -1291,7 +1291,7 @@ cdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
error = do_cdioreadentries(cd, &te->req, &toc);
if (error != 0)
return error;
- memcpy(te->entry, toc.entries, min(te->req.data_len,
+ memcpy(te->entry, toc.entries, uimin(te->req.data_len,
toc.header.len - (sizeof(toc.header.starting_track)
+ sizeof(toc.header.ending_track))));
return 0;
diff --git a/sys/dev/scsipi/if_se.c b/sys/dev/scsipi/if_se.c
index c07aac446a8..a52a2163dcb 100644
--- a/sys/dev/scsipi/if_se.c
+++ b/sys/dev/scsipi/if_se.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_se.c,v 1.97 2018/06/26 06:48:02 msaitoh Exp $ */
+/* $NetBSD: if_se.c,v 1.98 2018/09/03 16:29:33 riastradh Exp $ */
/*
* Copyright (c) 1997 Ian W. Dall <ian.dall@dsto.defence.gov.au>
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.97 2018/06/26 06:48:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_se.c,v 1.98 2018/09/03 16:29:33 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -604,7 +604,7 @@ se_get(struct se_softc *sc, char *data, int totlen)
m->m_data = newdata;
}
- m->m_len = len = min(totlen, len);
+ m->m_len = len = uimin(totlen, len);
memcpy(mtod(m, void *), data, len);
data += len;
diff --git a/sys/dev/scsipi/scsipi_base.c b/sys/dev/scsipi/scsipi_base.c
index cebb4de8282..f4825dc2355 100644
--- a/sys/dev/scsipi/scsipi_base.c
+++ b/sys/dev/scsipi/scsipi_base.c
@@ -1,4 +1,4 @@
-/* $NetBSD: scsipi_base.c,v 1.178 2017/07/14 17:50:11 christos Exp $ */
+/* $NetBSD: scsipi_base.c,v 1.179 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.178 2017/07/14 17:50:11 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.179 2018/09/03 16:29:33 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_scsi.h"
@@ -2657,7 +2657,7 @@ show_scsipi_cmd(struct scsipi_xfer *xs)
}
printf("-[%d bytes]\n", xs->datalen);
if (xs->datalen)
- show_mem(xs->data, min(64, xs->datalen));
+ show_mem(xs->data, uimin(64, xs->datalen));
} else
printf("-RESET-\n");
}
diff --git a/sys/dev/scsipi/scsipi_ioctl.c b/sys/dev/scsipi/scsipi_ioctl.c
index 39e0643a823..e15b5776ef3 100644
--- a/sys/dev/scsipi/scsipi_ioctl.c
+++ b/sys/dev/scsipi/scsipi_ioctl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: scsipi_ioctl.c,v 1.69 2016/11/20 15:37:19 mlelstv Exp $ */
+/* $NetBSD: scsipi_ioctl.c,v 1.70 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.69 2016/11/20 15:37:19 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_ioctl.c,v 1.70 2018/09/03 16:29:33 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_freebsd.h"
@@ -166,14 +166,14 @@ scsipi_user_done(struct scsipi_xfer *xs)
break;
case XS_SENSE:
SC_DEBUG(periph, SCSIPI_DB3, ("have sense\n"));
- screq->senselen_used = min(sizeof(xs->sense.scsi_sense),
+ screq->senselen_used = uimin(sizeof(xs->sense.scsi_sense),
SENSEBUFLEN);
memcpy(screq->sense, &xs->sense.scsi_sense, screq->senselen);
screq->retsts = SCCMD_SENSE;
break;
case XS_SHORTSENSE:
SC_DEBUG(periph, SCSIPI_DB3, ("have short sense\n"));
- screq->senselen_used = min(sizeof(xs->sense.atapi_sense),
+ screq->senselen_used = uimin(sizeof(xs->sense.atapi_sense),
SENSEBUFLEN);
memcpy(screq->sense, &xs->sense.scsi_sense, screq->senselen);
screq->retsts = SCCMD_UNKNOWN; /* XXX need a shortsense here */
diff --git a/sys/dev/sdmmc/sdmmc_mem.c b/sys/dev/sdmmc/sdmmc_mem.c
index 171cf6a5169..c30fa9abf5f 100644
--- a/sys/dev/sdmmc/sdmmc_mem.c
+++ b/sys/dev/sdmmc/sdmmc_mem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sdmmc_mem.c,v 1.64 2018/02/07 14:42:07 bouyer Exp $ */
+/* $NetBSD: sdmmc_mem.c,v 1.65 2018/09/03 16:29:33 riastradh Exp $ */
/* $OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $ */
/*
@@ -45,7 +45,7 @@
/* Routines for SD/MMC memory cards. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.64 2018/02/07 14:42:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.65 2018/09/03 16:29:33 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -790,7 +790,7 @@ sdmmc_mem_sd_init(struct sdmmc_softc *sc, struct sdmmc_function *sf)
bool ddr = false;
/* change bus clock */
- bus_clock = min(sc->sc_busclk, sf->csd.tran_speed);
+ bus_clock = uimin(sc->sc_busclk, sf->csd.tran_speed);
error = sdmmc_chip_bus_clock(sc->sc_sct, sc->sc_sch, bus_clock, false);
if (error) {
aprint_error_dev(sc->sc_dev, "can't change bus clock\n");
@@ -926,7 +926,7 @@ sdmmc_mem_mmc_init(struct sdmmc_softc *sc, struct sdmmc_function *sf)
sc->sc_transfer_mode = NULL;
/* change bus clock */
- bus_clock = min(sc->sc_busclk, sf->csd.tran_speed);
+ bus_clock = uimin(sc->sc_busclk, sf->csd.tran_speed);
error = sdmmc_chip_bus_clock(sc->sc_sct, sc->sc_sch, bus_clock, false);
if (error) {
aprint_error_dev(sc->sc_dev, "can't change bus clock\n");
diff --git a/sys/dev/spi/spi.c b/sys/dev/spi/spi.c
index 9cfdd8291cd..a87ae16f956 100644
--- a/sys/dev/spi/spi.c
+++ b/sys/dev/spi/spi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: spi.c,v 1.8 2013/02/15 17:44:40 rkujawa Exp $ */
+/* $NetBSD: spi.c,v 1.9 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.8 2013/02/15 17:44:40 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spi.c,v 1.9 2018/09/03 16:29:33 riastradh Exp $");
#include "locators.h"
@@ -194,7 +194,7 @@ spi_configure(struct spi_handle *sh, int mode, int speed)
if (speed == 0)
speed = sc->sc_speed;
if (sc->sc_speed)
- speed = min(sc->sc_speed, speed);
+ speed = uimin(sc->sc_speed, speed);
rv = (*tag->sct_configure)(tag->sct_cookie, sh->sh_slave,
mode, speed);
diff --git a/sys/dev/spi/spiflash.c b/sys/dev/spi/spiflash.c
index 852077ee489..40f24715e25 100644
--- a/sys/dev/spi/spiflash.c
+++ b/sys/dev/spi/spiflash.c
@@ -1,4 +1,4 @@
-/* $NetBSD: spiflash.c,v 1.20 2018/01/12 19:38:52 jakllsch Exp $ */
+/* $NetBSD: spiflash.c,v 1.21 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spiflash.c,v 1.20 2018/01/12 19:38:52 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spiflash.c,v 1.21 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -635,7 +635,7 @@ spiflash_common_write(spiflash_handle_t sc, size_t start, size_t size,
return rv;
}
- cnt = min(size, sc->sc_write_size);
+ cnt = uimin(size, sc->sc_write_size);
if ((rv = spiflash_cmd(sc, SPIFLASH_CMD_PROGRAM, 3, start,
cnt, data, NULL)) != 0) {
spiflash_write_disable(sc);
@@ -672,7 +672,7 @@ spiflash_common_read(spiflash_handle_t sc, size_t start, size_t size,
int cnt;
if (sc->sc_read_size > 0)
- cnt = min(size, sc->sc_read_size);
+ cnt = uimin(size, sc->sc_read_size);
else
cnt = size;
diff --git a/sys/dev/spkr.c b/sys/dev/spkr.c
index b0b57fbe456..131f43e8ab7 100644
--- a/sys/dev/spkr.c
+++ b/sys/dev/spkr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: spkr.c,v 1.15 2017/10/28 03:47:24 riastradh Exp $ */
+/* $NetBSD: spkr.c,v 1.16 2018/09/03 16:29:30 riastradh Exp $ */
/*
* Copyright (c) 1990 Eric S. Raymond (esr@snark.thyrsus.com)
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.15 2017/10/28 03:47:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spkr.c,v 1.16 2018/09/03 16:29:30 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "wsmux.h"
@@ -460,7 +460,7 @@ spkrwrite(dev_t dev, struct uio *uio, int flags)
if (sc->sc_inbuf == NULL)
return EINVAL;
- size_t n = min(DEV_BSIZE, uio->uio_resid);
+ size_t n = uimin(DEV_BSIZE, uio->uio_resid);
int error = uiomove(sc->sc_inbuf, n, uio);
if (error)
return error;
diff --git a/sys/dev/tc/asc_tcds.c b/sys/dev/tc/asc_tcds.c
index ebc45829eb0..66c18b945f3 100644
--- a/sys/dev/tc/asc_tcds.c
+++ b/sys/dev/tc/asc_tcds.c
@@ -1,4 +1,4 @@
-/* $NetBSD: asc_tcds.c,v 1.25 2010/11/13 13:52:11 uebayasi Exp $ */
+/* $NetBSD: asc_tcds.c,v 1.26 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: asc_tcds.c,v 1.25 2010/11/13 13:52:11 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: asc_tcds.c,v 1.26 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -260,7 +260,7 @@ tcds_dma_setup(struct ncr53c9x_softc *sc, uint8_t **addr, size_t *len,
* the rules say we cannot transfer more than the limit
* of this DMA chip (64k) and we cannot cross a 8k boundary.
*/
- size = min(*dmasize, DMAMAX((size_t)*addr));
+ size = uimin(*dmasize, DMAMAX((size_t)*addr));
asc->sc_dmaaddr = addr;
asc->sc_dmalen = len;
asc->sc_flags = (ispullup) ? ASC_ISPULLUP : 0;
diff --git a/sys/dev/tc/bba.c b/sys/dev/tc/bba.c
index 33eb8bed703..c302e294cf8 100644
--- a/sys/dev/tc/bba.c
+++ b/sys/dev/tc/bba.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bba.c,v 1.40 2017/06/01 02:45:11 chs Exp $ */
+/* $NetBSD: bba.c,v 1.41 2018/09/03 16:29:33 riastradh Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
/* maxine/alpha baseboard audio (bba) */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bba.c,v 1.40 2017/06/01 02:45:11 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bba.c,v 1.41 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -667,7 +667,7 @@ bba_input_conv_fetch_to(struct audio_softc *sc, stream_fetcher_t *self,
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used * 4)))
return err;
m = dst->end - dst->start;
- m = min(m, max_used);
+ m = uimin(m, max_used);
FILTER_LOOP_PROLOGUE(this->src, 4, dst, 1, m) {
*d = ((*(const uint32_t *)s) >> 16) & 0xff;
} FILTER_LOOP_EPILOGUE(this->src, dst);
@@ -693,7 +693,7 @@ bba_output_conv_fetch_to(struct audio_softc *sc, stream_fetcher_t *self,
if ((err = this->prev->fetch_to(sc, this->prev, this->src, max_used / 4)))
return err;
m = (dst->end - dst->start) & ~3;
- m = min(m, max_used);
+ m = uimin(m, max_used);
FILTER_LOOP_PROLOGUE(this->src, 1, dst, 4, m) {
*(uint32_t *)d = (*s << 16);
} FILTER_LOOP_EPILOGUE(this->src, dst);
diff --git a/sys/dev/tc/if_le_ioasic.c b/sys/dev/tc/if_le_ioasic.c
index e4743ff54fa..cc307e23a5b 100644
--- a/sys/dev/tc/if_le_ioasic.c
+++ b/sys/dev/tc/if_le_ioasic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_le_ioasic.c,v 1.33 2009/04/18 14:58:04 tsutsui Exp $ */
+/* $NetBSD: if_le_ioasic.c,v 1.34 2018/09/03 16:29:33 riastradh Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_le_ioasic.c,v 1.33 2009/04/18 14:58:04 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le_ioasic.c,v 1.34 2018/09/03 16:29:33 riastradh Exp $");
#include "opt_inet.h"
@@ -263,7 +263,7 @@ le_ioasic_copytobuf_gap16(struct lance_softc *sc, void *fromv, int boff,
*/
if (boff) {
int xfer;
- xfer = min(len, 16 - boff);
+ xfer = uimin(len, 16 - boff);
memcpy(bptr + boff, from, xfer);
from += xfer;
bptr += 32;
@@ -342,7 +342,7 @@ le_ioasic_copyfrombuf_gap16(struct lance_softc *sc, void *tov, int boff,
/* Dispose of boff. source of copy is subsequently 16-byte aligned. */
if (boff) {
int xfer;
- xfer = min(len, 16 - boff);
+ xfer = uimin(len, 16 - boff);
memcpy(to, bptr + boff, xfer);
to += xfer;
bptr += 32;
@@ -411,12 +411,12 @@ le_ioasic_zerobuf_gap16(struct lance_softc *sc, int boff, int len)
bptr = buf + ((boff << 1) & ~0x1f);
boff &= 0xf;
- xfer = min(len, 16 - boff);
+ xfer = uimin(len, 16 - boff);
while (len > 0) {
memset(bptr + boff, 0, xfer);
bptr += 32;
boff = 0;
len -= xfer;
- xfer = min(len, 16);
+ xfer = uimin(len, 16);
}
}
diff --git a/sys/dev/usb/aubtfwl.c b/sys/dev/usb/aubtfwl.c
index d8d7ebbf63d..e5549b6c829 100644
--- a/sys/dev/usb/aubtfwl.c
+++ b/sys/dev/usb/aubtfwl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: aubtfwl.c,v 1.6 2016/04/23 10:15:31 skrll Exp $ */
+/* $NetBSD: aubtfwl.c,v 1.7 2018/09/03 16:29:33 riastradh Exp $ */
/*
* Copyright (c) 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aubtfwl.c,v 1.6 2016/04/23 10:15:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aubtfwl.c,v 1.7 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
#include <dev/usb/usb.h>
@@ -179,7 +179,7 @@ aubtfwl_firmware_load(device_t self, const char *name) {
fwo = AR3K_FIRMWARE_HEADER_SIZE;
while (fwo < fws) {
- n = min(AR3K_FIRMWARE_CHUNK_SIZE, fws - fwo);
+ n = uimin(AR3K_FIRMWARE_CHUNK_SIZE, fws - fwo);
error = firmware_read(fwh, fwo, buf, n);
if (error != 0) {
break;
diff --git a/sys/dev/usb/auvitek_video.c b/sys/dev/usb/auvitek_video.c
index 4dbc771d51f..b8bae381e99 100644
--- a/sys/dev/usb/auvitek_video.c
+++ b/sys/dev/usb/auvitek_video.c
@@ -1,4 +1,4 @@
-/* $NetBSD: auvitek_video.c,v 1.7 2016/04/23 10:15:31 skrll Exp $ */
+/* $NetBSD: auvitek_video.c,v 1.8 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 2010 Jared D. McNeill <jmcneill@invisible.ca>
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auvitek_video.c,v 1.7 2016/04/23 10:15:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvitek_video.c,v 1.8 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -787,7 +787,7 @@ auvitek_videobuf_weave(struct auvitek_softc *sc, uint8_t *buf, uint32_t len)
if (*l >= 240) {
break;
}
- wlen = min(resid, av->av_stride - *b);
+ wlen = uimin(resid, av->av_stride - *b);
memcpy(vp + (av->av_stride * 2 * *l) + *b, buf, wlen);
*b += wlen;
buf += wlen;
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c
index 66f7447edd8..e54dbffba25 100644
--- a/sys/dev/usb/ehci.c
+++ b/sys/dev/usb/ehci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.261 2018/08/09 18:17:39 jakllsch Exp $ */
+/* $NetBSD: ehci.c,v 1.262 2018/09/03 16:29:33 riastradh Exp $ */
/*
* Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.261 2018/08/09 18:17:39 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.262 2018/09/03 16:29:33 riastradh Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -782,7 +782,7 @@ ehci_pcd(void *addr)
}
p = xfer->ux_buf;
- m = min(sc->sc_noport, xfer->ux_length * 8 - 1);
+ m = uimin(sc->sc_noport, xfer->ux_length * 8 - 1);
memset(p, 0, xfer->ux_length);
for (i = 1; i <= m; i++) {
/* Pick out CHANGE bits from the status reg. */
@@ -1094,7 +1094,7 @@ ehci_idone(struct ehci_xfer *ex, ex_completeq_t *cq)
#endif
i = xfer->ux_pipe->up_endpoint->ue_edesc->bInterval;
- uframes = min(1 << (i - 1), USB_UFRAMES_PER_FRAME);
+ uframes = uimin(1 << (i - 1), USB_UFRAMES_PER_FRAME);
for (itd = ex->ex_itdstart; itd != NULL; itd = itd->xfer_next) {
usb_syncmem(&itd->dma,
@@ -2417,7 +2417,7 @@ ehci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
if ((value & 0xff) != 0) {
return -1;
}
- totlen = min(buflen, sizeof(hubd));
+ totlen = uimin(buflen, sizeof(hubd));
memcpy(&hubd, buf, totlen);
hubd.bNbrPorts = sc->sc_noport;
v = EOREAD4(sc, EHCI_HCSPARAMS);
@@ -2429,7 +2429,7 @@ ehci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
for (i = 0, l = sc->sc_noport; l > 0; i++, l -= 8, v >>= 8)
hubd.DeviceRemovable[i++] = 0; /* XXX can't find out? */
hubd.bDescLength = USB_HUB_DESCRIPTOR_SIZE + i;
- totlen = min(totlen, hubd.bDescLength);
+ totlen = uimin(totlen, hubd.bDescLength);
memcpy(buf, &hubd, totlen);
break;
case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE):
@@ -2475,7 +2475,7 @@ ehci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
if (v & EHCI_PS_OCC) i |= UPS_C_OVERCURRENT_INDICATOR;
if (sc->sc_isreset[index]) i |= UPS_C_PORT_RESET;
USETW(ps.wPortChange, i);
- totlen = min(len, sizeof(ps));
+ totlen = uimin(len, sizeof(ps));
memcpy(buf, &ps, totlen);
break;
case C(UR_SET_DESCRIPTOR, UT_WRITE_CLASS_DEVICE):
@@ -4549,7 +4549,7 @@ ehci_device_isoc_init(struct usbd_xfer *xfer)
return USBD_INVAL;
}
- ufrperframe = max(1, USB_UFRAMES_PER_FRAME / (1 << (i - 1)));
+ ufrperframe = uimax(1, USB_UFRAMES_PER_FRAME / (1 << (i - 1)));
frames = (xfer->ux_nframes + (ufrperframe - 1)) / ufrperframe;
for (i = 0, prev = NULL; i < frames; i++, prev = itd) {
@@ -4684,7 +4684,7 @@ ehci_device_isoc_transfer(struct usbd_xfer *xfer)
return USBD_INVAL;
}
- ufrperframe = max(1, USB_UFRAMES_PER_FRAME / (1 << (i - 1)));
+ ufrperframe = uimax(1, USB_UFRAMES_PER_FRAME / (1 << (i - 1)));
frames = (xfer->ux_nframes + (ufrperframe - 1)) / ufrperframe;
uframes = USB_UFRAMES_PER_FRAME / ufrperframe;
diff --git a/sys/dev/usb/emdtv.c b/sys/dev/usb/emdtv.c
index b866329703b..6d977643840 100644
--- a/sys/dev/usb/emdtv.c
+++ b/sys/dev/usb/emdtv.c
@@ -1,4 +1,4 @@
-/* $NetBSD: emdtv.c,v 1.12 2016/12/04 10:12:35 skrll Exp $ */
+/* $NetBSD: emdtv.c,v 1.13 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 2008, 2011 Jared D. McNeill <jmcneill@invisible.ca>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: emdtv.c,v 1.12 2016/12/04 10:12:35 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emdtv.c,v 1.13 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -223,7 +223,7 @@ emdtv_read_eeprom(struct emdtv_softc *sc)
NULL, 0, 0))
return false;
while (size > 0) {
- block = min(size, 16);
+ block = uimin(size, 16);
if (iic_exec(&sc->sc_i2c, I2C_OP_READ, ee, NULL, 0,
p, block, 0))
return false;
diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c
index c85440f82b1..3c86b5f528c 100644
--- a/sys/dev/usb/if_ural.c
+++ b/sys/dev/usb/if_ural.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ural.c,v 1.57 2018/08/02 06:09:04 riastradh Exp $ */
+/* $NetBSD: if_ural.c,v 1.58 2018/09/03 16:29:33 riastradh Exp $ */
/* $FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $ */
/*-
@@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.57 2018/08/02 06:09:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.58 2018/09/03 16:29:33 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1695,7 +1695,7 @@ ural_set_chan(struct ural_softc *sc, struct ieee80211_channel *c)
return;
if (IEEE80211_IS_CHAN_2GHZ(c))
- power = min(sc->txpow[chan - 1], 31);
+ power = uimin(sc->txpow[chan - 1], 31);
else
power = 31;
diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c
index 1b383edfca6..0e683202b8d 100644
--- a/sys/dev/usb/if_zyd.c
+++ b/sys/dev/usb/if_zyd.c
@@ -1,5 +1,5 @@
/* $OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $ */
-/* $NetBSD: if_zyd.c,v 1.50 2018/08/02 06:09:04 riastradh Exp $ */
+/* $NetBSD: if_zyd.c,v 1.51 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr>
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.50 2018/08/02 06:09:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.51 2018/09/03 16:29:33 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -2574,14 +2574,14 @@ zyd_loadfirmware(struct zyd_softc *sc, u_char *fw, size_t size)
addr = ZYD_FIRMWARE_START_ADDR;
while (size > 0) {
#if 0
- const int mlen = min(size, 4096);
+ const int mlen = uimin(size, 4096);
#else
/*
* XXXX: When the transfer size is 4096 bytes, it is not
* likely to be able to transfer it.
* The cause is port or machine or chip?
*/
- const int mlen = min(size, 64);
+ const int mlen = uimin(size, 64);
#endif
DPRINTF(("loading firmware block: len=%d, addr=0x%x\n", mlen,
diff --git a/sys/dev/usb/motg.c b/sys/dev/usb/motg.c
index 723cc2bf6f4..1aaaf5af264 100644
--- a/sys/dev/usb/motg.c
+++ b/sys/dev/usb/motg.c
@@ -1,4 +1,4 @@
-/* $NetBSD: motg.c,v 1.22 2018/08/09 06:26:47 mrg Exp $ */
+/* $NetBSD: motg.c,v 1.23 2018/09/03 16:29:33 riastradh Exp $ */
/*
* Copyright (c) 1998, 2004, 2011, 2012, 2014 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.22 2018/08/09 06:26:47 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.23 2018/09/03 16:29:33 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -916,7 +916,7 @@ motg_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
change |= UPS_C_PORT_RESET;
USETW(ps.wPortStatus, status);
USETW(ps.wPortChange, change);
- totlen = min(len, sizeof(ps));
+ totlen = uimin(len, sizeof(ps));
memcpy(buf, &ps, totlen);
break;
case C(UR_SET_DESCRIPTOR, UT_WRITE_CLASS_DEVICE):
@@ -1428,7 +1428,7 @@ motg_device_ctrl_intr_rx(struct motg_softc *sc)
datalen = UREAD2(sc, MUSB2_REG_RXCOUNT);
DPRINTFN(MD_CTRL, "phase %jd datalen %jd", ep->phase, datalen, 0, 0);
KASSERT(UGETW(xfer->ux_pipe->up_endpoint->ue_edesc->wMaxPacketSize) > 0);
- max_datalen = min(UGETW(xfer->ux_pipe->up_endpoint->ue_edesc->wMaxPacketSize),
+ max_datalen = uimin(UGETW(xfer->ux_pipe->up_endpoint->ue_edesc->wMaxPacketSize),
ep->datalen);
if (datalen > max_datalen) {
new_status = USBD_IOERROR;
@@ -1588,7 +1588,7 @@ motg_device_ctrl_intr_tx(struct motg_softc *sc)
return;
}
/* setup a dataout phase */
- datalen = min(ep->datalen,
+ datalen = uimin(ep->datalen,
UGETW(xfer->ux_pipe->up_endpoint->ue_edesc->wMaxPacketSize));
ep->phase = DATA_OUT;
DPRINTFN(MD_CTRL, "xfer %#jx to DATA_OUT, csrh 0x%jx", (uintptr_t)xfer,
@@ -1847,7 +1847,7 @@ motg_device_data_write(struct usbd_xfer *xfer)
KASSERT(xfer!=NULL);
KASSERT(mutex_owned(&sc->sc_lock));
- datalen = min(ep->datalen,
+ datalen = uimin(ep->datalen,
UGETW(xfer->ux_pipe->up_endpoint->ue_edesc->wMaxPacketSize));
ep->phase = DATA_OUT;
DPRINTFN(MD_BULK, "%#jx to DATA_OUT on ep %jd, len %jd csrh 0x%jx",
@@ -1950,7 +1950,7 @@ motg_device_intr_rx(struct motg_softc *sc, int epnumber)
datalen = UREAD2(sc, MUSB2_REG_RXCOUNT);
DPRINTFN(MD_BULK, "phase %jd datalen %jd", ep->phase, datalen ,0 ,0);
KASSERT(UE_GET_SIZE(UGETW(xfer->ux_pipe->up_endpoint->ue_edesc->wMaxPacketSize)) > 0);
- max_datalen = min(
+ max_datalen = uimin(
UE_GET_SIZE(UGETW(xfer->ux_pipe->up_endpoint->ue_edesc->wMaxPacketSize)),
ep->datalen);
if (datalen > max_datalen) {
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index e56fe835bcd..41073c41913 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.284 2018/08/09 21:23:23 prlw1 Exp $ */
+/* $NetBSD: ohci.c,v 1.285 2018/09/03 16:29:33 riastradh Exp $ */
/*
* Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.284 2018/08/09 21:23:23 prlw1 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.285 2018/09/03 16:29:33 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1717,7 +1717,7 @@ ohci_rhsc(ohci_softc_t *sc, struct usbd_xfer *xfer)
}
p = xfer->ux_buf;
- m = min(sc->sc_noport, xfer->ux_length * 8 - 1);
+ m = uimin(sc->sc_noport, xfer->ux_length * 8 - 1);
memset(p, 0, xfer->ux_length);
for (i = 1; i <= m; i++) {
/* Pick out CHANGE bits from the status reg. */
@@ -2484,7 +2484,7 @@ ohci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
}
usb_hub_descriptor_t hubd;
- totlen = min(buflen, sizeof(hubd));
+ totlen = uimin(buflen, sizeof(hubd));
memcpy(&hubd, buf, totlen);
v = OREAD4(sc, OHCI_RH_DESCRIPTOR_A);
@@ -2499,7 +2499,7 @@ ohci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
for (i = 0, l = sc->sc_noport; l > 0; i++, l -= 8, v >>= 8)
hubd.DeviceRemovable[i++] = (uint8_t)v;
hubd.bDescLength = USB_HUB_DESCRIPTOR_SIZE + i;
- totlen = min(totlen, hubd.bDescLength);
+ totlen = uimin(totlen, hubd.bDescLength);
memcpy(buf, &hubd, totlen);
break;
case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE):
@@ -2521,7 +2521,7 @@ ohci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
DPRINTFN(8, "port status=0x%04jx", v, 0, 0, 0);
USETW(ps.wPortStatus, v);
USETW(ps.wPortChange, v >> 16);
- totlen = min(len, sizeof(ps));
+ totlen = uimin(len, sizeof(ps));
memcpy(buf, &ps, totlen);
break;
case C(UR_SET_DESCRIPTOR, UT_WRITE_CLASS_DEVICE):
diff --git a/sys/dev/usb/pseye.c b/sys/dev/usb/pseye.c
index e5ac7a60604..55021549c33 100644
--- a/sys/dev/usb/pseye.c
+++ b/sys/dev/usb/pseye.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pseye.c,v 1.24 2018/01/21 13:57:12 skrll Exp $ */
+/* $NetBSD: pseye.c,v 1.25 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 2008 Jared D. McNeill <jmcneill@invisible.ca>
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pseye.c,v 1.24 2018/01/21 13:57:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pseye.c,v 1.25 2018/09/03 16:29:33 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -669,7 +669,7 @@ pseye_submit_payload(struct pseye_softc *sc, uint32_t tlen)
uint32_t brem = (640*480*2);
while (brem > 0 && tlen > 0) {
- len = min(tlen, PSEYE_BULKIN_BLKLEN);
+ len = uimin(tlen, PSEYE_BULKIN_BLKLEN);
if (len < UVIDEO_PAYLOAD_HEADER_SIZE) {
printf("pseye_submit_payload: len=%u\n", len);
return;
@@ -687,7 +687,7 @@ pseye_submit_payload(struct pseye_softc *sc, uint32_t tlen)
goto next;
payload.data = buf + uvchdr->bHeaderLength;
- payload.size = min(brem, len - uvchdr->bHeaderLength);
+ payload.size = uimin(brem, len - uvchdr->bHeaderLength);
payload.frameno = UGETDW(&buf[2]);
payload.end_of_frame = uvchdr->bmHeaderInfo & UV_END_OF_FRAME;
video_submit_payload(sc->sc_videodev, &payload);
diff --git a/sys/dev/usb/uatp.c b/sys/dev/usb/uatp.c
index ba7aec0f86c..9360ccddeb8 100644
--- a/sys/dev/usb/uatp.c
+++ b/sys/dev/usb/uatp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uatp.c,v 1.17 2018/08/02 06:09:04 riastradh Exp $ */
+/* $NetBSD: uatp.c,v 1.18 2018/09/03 16:29:33 riastradh Exp $ */
/*-
* Copyright (c) 2011-2014 The NetBSD Foundation, Inc.
@@ -146,7 +146,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uatp.c,v 1.17 2018/08/02 06:09:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uatp.c,v 1.18 2018/09/03 16:29:33 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1744,7 +1744,7 @@ interpret_input(struct uatp_softc *sc, int *dx, int *dy, int *dz, int *dw,
("pressure in only one dimension; ignoring\n"));
return true;
} else if ((x_pressure == 1) && (y_pressure == 1)) {
- fingers = max(x_fingers, y_fingers);
+ fingers = uimax(x_fingers, y_fingers);
CHECK((0 < fingers), return false);
if (*buttons == 0)
tap_touched(sc, fingers);
diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c
index f881083aace..60a8f42f750 100644
--- a/sys/dev/usb/uaudio.c
+++ b/sys/dev/usb/uaudio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uaudio.c,v 1.156 2018/06/16 08:24:55 nakayama Exp $ */
+/* $NetBSD: uaudio.c,v 1.157 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 1999, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.156 2018/06/16 08:24:55 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.157 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -2832,7 +2832,7 @@ uaudio_chan_ptransfer(struct chan *ch)
* Transfer data from upper layer buffer to channel buffer, taking
* care of wrapping the upper layer buffer.
*/
- n = min(total, ch->end - ch->cur);
+ n = uimin(total, ch->end - ch->cur);
memcpy(cb->buffer, ch->cur, n);
ch->cur += n;
if (ch->cur >= ch->end)
@@ -2973,7 +2973,7 @@ uaudio_chan_rintr(struct usbd_xfer *xfer, void *priv,
*/
for (i = 0; i < UAUDIO_NFRAMES; i++) {
frsize = cb->sizes[i];
- n = min(frsize, ch->end - ch->cur);
+ n = uimin(frsize, ch->end - ch->cur);
memcpy(ch->cur, cb->buffer + cb->offsets[i], n);
ch->cur += n;
if (ch->cur >= ch->end)
diff --git a/sys/dev/usb/udl.c b/sys/dev/usb/udl.c
index f9b29db6f8d..c7ba7bdd365 100644
--- a/sys/dev/usb/udl.c
+++ b/sys/dev/usb/udl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: udl.c,v 1.21 2018/04/01 04:35:05 ryo Exp $ */
+/* $NetBSD: udl.c,v 1.22 2018/09/03 16:29:34 riastradh Exp $ */
/*-
* Copyright (c) 2009 FUKAUMI Naoki.
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.21 2018/04/01 04:35:05 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udl.c,v 1.22 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1821,7 +1821,7 @@ udl_update_thread(void *v)
mutex_enter(&sc->sc_thread_mtx);
for (;;) {
- stride = min(sc->sc_width, UDL_CMD_WIDTH_MAX - 8);
+ stride = uimin(sc->sc_width, UDL_CMD_WIDTH_MAX - 8);
if (sc->sc_dying == true) {
mutex_exit(&sc->sc_thread_mtx);
kthread_exit(0);
diff --git a/sys/dev/usb/udsir.c b/sys/dev/usb/udsir.c
index b08f419d35b..112452b2d4a 100644
--- a/sys/dev/usb/udsir.c
+++ b/sys/dev/usb/udsir.c
@@ -1,4 +1,4 @@
-/* $NetBSD: udsir.c,v 1.6 2018/01/21 13:57:12 skrll Exp $ */
+/* $NetBSD: udsir.c,v 1.7 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: udsir.c,v 1.6 2018/01/21 13:57:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udsir.c,v 1.7 2018/09/03 16:29:34 riastradh Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -367,7 +367,7 @@ udsir_open(void *h, int flag, int mode, struct lwp *l)
sc->sc_direction = udir_idle;
sc->sc_params.speed = 0;
sc->sc_params.ebofs = 0;
- sc->sc_params.maxsize = min(sc->sc_rd_maxpsz, sc->sc_wr_maxpsz);
+ sc->sc_params.maxsize = uimin(sc->sc_rd_maxpsz, sc->sc_wr_maxpsz);
deframe_init(&sc->sc_framestate, sc->sc_ur_buf, IRDA_MAX_FRAME_SIZE);
@@ -720,7 +720,7 @@ udsir_set_params(void *h, struct irda_params *p)
return EINVAL;
if (p->maxsize != sc->sc_params.maxsize) {
- if (p->maxsize > min(sc->sc_rd_maxpsz, sc->sc_wr_maxpsz))
+ if (p->maxsize > uimin(sc->sc_rd_maxpsz, sc->sc_wr_maxpsz))
return EINVAL;
sc->sc_params.maxsize = p->maxsize;
}
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c
index a044785af06..a97e9b3b690 100644
--- a/sys/dev/usb/ugen.c
+++ b/sys/dev/usb/ugen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ugen.c,v 1.139 2018/03/05 09:35:01 ws Exp $ */
+/* $NetBSD: ugen.c,v 1.140 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.139 2018/03/05 09:35:01 ws Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.140 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -663,7 +663,7 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag)
/* Transfer as many chunks as possible. */
while (sce->q.c_cc > 0 && uio->uio_resid > 0 && !error) {
- n = min(sce->q.c_cc, uio->uio_resid);
+ n = uimin(sce->q.c_cc, uio->uio_resid);
if (n > sizeof(sc->sc_buffer))
n = sizeof(sc->sc_buffer);
@@ -711,9 +711,9 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag)
/* Copy data to the process. */
while (uio->uio_resid > 0
&& sce->ra_wb_used > 0) {
- n = min(uio->uio_resid,
+ n = uimin(uio->uio_resid,
sce->ra_wb_used);
- n = min(n, sce->limit - sce->cur);
+ n = uimin(n, sce->limit - sce->cur);
error = uiomove(sce->cur, n, uio);
if (error)
break;
@@ -732,7 +732,7 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag)
n = (sce->limit - sce->ibuf)
- sce->ra_wb_used;
usbd_setup_xfer(xfer, sce, NULL,
- min(n, sce->ra_wb_xferlen),
+ uimin(n, sce->ra_wb_xferlen),
0, USBD_NO_TIMEOUT,
ugen_bulkra_intr);
sce->state &= ~UGEN_RA_WB_STOP;
@@ -754,7 +754,7 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag)
0, 0, &xfer);
if (error)
return error;
- while ((n = min(UGEN_BBSIZE, uio->uio_resid)) != 0) {
+ while ((n = uimin(UGEN_BBSIZE, uio->uio_resid)) != 0) {
DPRINTFN(1, ("ugenread: start transfer %d bytes\n",n));
tn = n;
err = usbd_bulk_transfer(xfer, sce->pipeh,
@@ -799,9 +799,9 @@ ugen_do_read(struct ugen_softc *sc, int endpt, struct uio *uio, int flag)
while (sce->cur != sce->fill && uio->uio_resid > 0 && !error) {
if(sce->fill > sce->cur)
- n = min(sce->fill - sce->cur, uio->uio_resid);
+ n = uimin(sce->fill - sce->cur, uio->uio_resid);
else
- n = min(sce->limit - sce->cur, uio->uio_resid);
+ n = uimin(sce->limit - sce->cur, uio->uio_resid);
DPRINTFN(5, ("ugenread: isoc got %d chars\n", n));
@@ -913,10 +913,10 @@ ugen_do_write(struct ugen_softc *sc, int endpt, struct uio *uio,
/* Copy data from the process. */
while (uio->uio_resid > 0 &&
sce->ra_wb_used < sce->limit - sce->ibuf) {
- n = min(uio->uio_resid,
+ n = uimin(uio->uio_resid,
(sce->limit - sce->ibuf)
- sce->ra_wb_used);
- n = min(n, sce->limit - sce->fill);
+ n = uimin(n, sce->limit - sce->fill);
error = uiomove(sce->fill, n, uio);
if (error)
break;
@@ -933,9 +933,9 @@ ugen_do_write(struct ugen_softc *sc, int endpt, struct uio *uio,
if (sce->state & UGEN_RA_WB_STOP &&
sce->ra_wb_used > 0) {
dbuf = (char *)usbd_get_buffer(xfer);
- n = min(sce->ra_wb_used,
+ n = uimin(sce->ra_wb_used,
sce->ra_wb_xferlen);
- tn = min(n, sce->limit - sce->cur);
+ tn = uimin(n, sce->limit - sce->cur);
memcpy(dbuf, sce->cur, tn);
dbuf += tn;
if (n - tn > 0)
@@ -963,7 +963,7 @@ ugen_do_write(struct ugen_softc *sc, int endpt, struct uio *uio,
0, 0, &xfer);
if (error)
return error;
- while ((n = min(UGEN_BBSIZE, uio->uio_resid)) != 0) {
+ while ((n = uimin(UGEN_BBSIZE, uio->uio_resid)) != 0) {
error = uiomove(sc->sc_buffer, n, uio);
if (error)
break;
@@ -987,7 +987,7 @@ ugen_do_write(struct ugen_softc *sc, int endpt, struct uio *uio,
UGETW(sce->edesc->wMaxPacketSize), 0, 0, &xfer);
if (error)
return error;
- while ((n = min(UGETW(sce->edesc->wMaxPacketSize),
+ while ((n = uimin(UGETW(sce->edesc->wMaxPacketSize),
uio->uio_resid)) != 0) {
error = uiomove(sc->sc_buffer, n, uio);
if (error)
@@ -1178,7 +1178,7 @@ ugen_isoc_rintr(struct usbd_xfer *xfer, void *addr,
/* copy data to buffer */
while (actlen > 0) {
- n = min(actlen, sce->limit - sce->fill);
+ n = uimin(actlen, sce->limit - sce->fill);
memcpy(sce->fill, tbuf, n);
tbuf += n;
@@ -1235,7 +1235,7 @@ ugen_bulkra_intr(struct usbd_xfer *xfer, void *addr,
/* Copy data to buffer. */
tbuf = (char const *)usbd_get_buffer(sce->ra_wb_xfer);
- n = min(count, sce->limit - sce->fill);
+ n = uimin(count, sce->limit - sce->fill);
memcpy(sce->fill, tbuf, n);
tbuf += n;
count -= n;
@@ -1250,7 +1250,7 @@ ugen_bulkra_intr(struct usbd_xfer *xfer, void *addr,
/* Set up the next request if necessary. */
n = (sce->limit - sce->ibuf) - sce->ra_wb_used;
if (n > 0) {
- usbd_setup_xfer(xfer, sce, NULL, min(n, sce->ra_wb_xferlen), 0,
+ usbd_setup_xfer(xfer, sce, NULL, uimin(n, sce->ra_wb_xferlen), 0,
USBD_NO_TIMEOUT, ugen_bulkra_intr);
err = usbd_transfer(xfer);
if (err != USBD_IN_PROGRESS) {
@@ -1311,8 +1311,8 @@ ugen_bulkwb_intr(struct usbd_xfer *xfer, void *addr,
if (sce->ra_wb_used > 0) {
/* copy data from buffer */
tbuf = (char *)usbd_get_buffer(sce->ra_wb_xfer);
- count = min(sce->ra_wb_used, sce->ra_wb_xferlen);
- n = min(count, sce->limit - sce->cur);
+ count = uimin(sce->ra_wb_used, sce->ra_wb_xferlen);
+ n = uimin(count, sce->limit - sce->cur);
memcpy(tbuf, sce->cur, n);
tbuf += n;
if (count - n > 0)
@@ -1518,7 +1518,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
sce->state &= ~UGEN_RA_WB_STOP;
/* Now start reading. */
usbd_setup_xfer(sce->ra_wb_xfer, sce, NULL,
- min(sce->ra_wb_xferlen, sce->ra_wb_bufsize),
+ uimin(sce->ra_wb_xferlen, sce->ra_wb_bufsize),
0, USBD_NO_TIMEOUT, ugen_bulkra_intr);
err = usbd_transfer(sce->ra_wb_xfer);
if (err != USBD_IN_PROGRESS) {
@@ -1820,7 +1820,7 @@ ugen_do_ioctl(struct ugen_softc *sc, int endpt, u_long cmd,
}
if (len != 0) {
if (uio.uio_rw == UIO_READ) {
- size_t alen = min(len, ur->ucr_actlen);
+ size_t alen = uimin(len, ur->ucr_actlen);
error = uiomove(ptr, alen, &uio);
if (error)
goto ret;
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 1d644a9e23c..8e9af74e956 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.282 2018/08/09 21:16:43 prlw1 Exp $ */
+/* $NetBSD: uhci.c,v 1.283 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.282 2018/08/09 21:16:43 prlw1 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.283 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -3766,7 +3766,7 @@ uhci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
}
usb_hub_descriptor_t hubd;
- totlen = min(buflen, sizeof(hubd));
+ totlen = uimin(buflen, sizeof(hubd));
memcpy(&hubd, buf, totlen);
hubd.bNbrPorts = 2;
memcpy(buf, &hubd, totlen);
@@ -3812,7 +3812,7 @@ uhci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
change |= UPS_C_PORT_RESET;
USETW(ps.wPortStatus, status);
USETW(ps.wPortChange, change);
- totlen = min(len, sizeof(ps));
+ totlen = uimin(len, sizeof(ps));
memcpy(buf, &ps, totlen);
break;
case C(UR_SET_DESCRIPTOR, UT_WRITE_CLASS_DEVICE):
diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c
index fccbc64d419..b8f9923bc37 100644
--- a/sys/dev/usb/uhid.c
+++ b/sys/dev/usb/uhid.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uhid.c,v 1.101 2017/12/10 17:03:07 bouyer Exp $ */
+/* $NetBSD: uhid.c,v 1.102 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 1998, 2004, 2008, 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.101 2017/12/10 17:03:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.102 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -420,7 +420,7 @@ uhid_do_read(struct uhid_softc *sc, struct uio *uio, int flag)
/* Transfer as many chunks as possible. */
while (sc->sc_q.c_cc > 0 && uio->uio_resid > 0 && !error) {
- length = min(sc->sc_q.c_cc, uio->uio_resid);
+ length = uimin(sc->sc_q.c_cc, uio->uio_resid);
if (length > sizeof(buffer))
length = sizeof(buffer);
@@ -576,7 +576,7 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, void *addr,
case USB_GET_REPORT_DESC:
uhidev_get_report_desc(sc->sc_hdev.sc_parent, &desc, &size);
rd = (struct usb_ctl_report_desc *)addr;
- size = min(size, sizeof(rd->ucrd_data));
+ size = uimin(size, sizeof(rd->ucrd_data));
rd->ucrd_size = size;
memcpy(rd->ucrd_data, desc, size);
break;
diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c
index 72c8a29eb44..5bd0d3bf49c 100644
--- a/sys/dev/usb/ulpt.c
+++ b/sys/dev/usb/ulpt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ulpt.c,v 1.99 2018/01/21 13:57:12 skrll Exp $ */
+/* $NetBSD: ulpt.c,v 1.100 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ulpt.c,v 1.99 2018/01/21 13:57:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulpt.c,v 1.100 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -615,7 +615,7 @@ ulpt_do_write(struct ulpt_softc *sc, struct uio *uio, int flags)
DPRINTFN(3, ("ulptwrite\n"));
xfer = sc->sc_out_xfer;
bufp = sc->sc_out_buf;
- while ((n = min(ULPT_BSIZE, uio->uio_resid)) != 0) {
+ while ((n = uimin(ULPT_BSIZE, uio->uio_resid)) != 0) {
ulpt_statusmsg(ulpt_status(sc), sc);
error = uiomove(bufp, n, uio);
if (error)
@@ -696,7 +696,7 @@ ulpt_do_read(struct ulpt_softc *sc, struct uio *uio, int flags)
xfer = sc->sc_in_xfer;
bufp = sc->sc_in_buf;
nread = 0;
- while ((nreq = min(ULPT_BSIZE, uio->uio_resid)) != 0) {
+ while ((nreq = uimin(ULPT_BSIZE, uio->uio_resid)) != 0) {
KASSERT(error == 0);
if (error != 0) {
printf("ulptread: pre-switch error %d != 0", error);
diff --git a/sys/dev/usb/umass_isdata.c b/sys/dev/usb/umass_isdata.c
index 87e729a4dcf..b74664c8d6b 100644
--- a/sys/dev/usb/umass_isdata.c
+++ b/sys/dev/usb/umass_isdata.c
@@ -1,4 +1,4 @@
-/* $NetBSD: umass_isdata.c,v 1.36 2017/10/20 07:06:08 jdolecek Exp $ */
+/* $NetBSD: umass_isdata.c,v 1.37 2018/09/03 16:29:34 riastradh Exp $ */
/*
* TODO:
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umass_isdata.c,v 1.36 2017/10/20 07:06:08 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass_isdata.c,v 1.37 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -334,7 +334,7 @@ uisdata_bio1(struct ata_drive_datas *drv, struct ata_xfer *xfer)
if (ata_bio->flags & ATA_SINGLE)
nblks = 1;
else
- nblks = min(drv->multi, nbytes / drv->lp->d_secsize);
+ nblks = uimin(drv->multi, nbytes / drv->lp->d_secsize);
nbytes = nblks * drv->lp->d_secsize;
ata_bio->nblks = nblks;
ata_bio->nbytes = nbytes;
diff --git a/sys/dev/usb/umidi.c b/sys/dev/usb/umidi.c
index eedfe7e9cab..dfa624c2b71 100644
--- a/sys/dev/usb/umidi.c
+++ b/sys/dev/usb/umidi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: umidi.c,v 1.74 2018/01/21 13:57:12 skrll Exp $ */
+/* $NetBSD: umidi.c,v 1.75 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 2001, 2012, 2014 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umidi.c,v 1.74 2018/01/21 13:57:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umidi.c,v 1.75 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1228,7 +1228,7 @@ assign_all_jacks_automatically(struct umidi_softc *sc)
err =
alloc_all_mididevs(sc,
- max(sc->sc_out_num_jacks, sc->sc_in_num_jacks));
+ uimax(sc->sc_out_num_jacks, sc->sc_in_num_jacks));
if (err!=USBD_NORMAL_COMPLETION)
return err;
diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c
index 37a5fb25ce7..cfb4af824f5 100644
--- a/sys/dev/usb/urio.c
+++ b/sys/dev/usb/urio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: urio.c,v 1.46 2016/12/04 10:12:35 skrll Exp $ */
+/* $NetBSD: urio.c,v 1.47 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: urio.c,v 1.46 2016/12/04 10:12:35 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: urio.c,v 1.47 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -355,7 +355,7 @@ urioread(dev_t dev, struct uio *uio, int flag)
sc->sc_refcnt++;
- while ((n = min(URIO_BSIZE, uio->uio_resid)) != 0) {
+ while ((n = uimin(URIO_BSIZE, uio->uio_resid)) != 0) {
DPRINTFN(1, ("urioread: start transfer %d bytes\n", n));
tn = n;
err = usbd_bulk_transfer(xfer, sc->sc_in_pipe, 0,
@@ -409,7 +409,7 @@ uriowrite(dev_t dev, struct uio *uio, int flag)
bufp = usbd_get_buffer(xfer);
sc->sc_refcnt++;
- while ((n = min(URIO_BSIZE, uio->uio_resid)) != 0) {
+ while ((n = uimin(URIO_BSIZE, uio->uio_resid)) != 0) {
error = uiomove(bufp, n, uio);
if (error)
break;
diff --git a/sys/dev/usb/usbroothub.c b/sys/dev/usb/usbroothub.c
index c26422c8083..5912d713edb 100644
--- a/sys/dev/usb/usbroothub.c
+++ b/sys/dev/usb/usbroothub.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usbroothub.c,v 1.6 2018/08/12 06:02:38 rin Exp $ */
+/* $NetBSD: usbroothub.c,v 1.7 2018/09/03 16:29:34 riastradh Exp $ */
/*-
* Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbroothub.c,v 1.6 2018/08/12 06:02:38 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbroothub.c,v 1.7 2018/09/03 16:29:34 riastradh Exp $");
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@@ -409,25 +409,25 @@ roothub_ctrl_start(struct usbd_xfer *xfer)
switch (value) {
case C(0, UDESC_DEVICE):
if (bus->ub_revision >= USBREV_3_0) {
- buflen = min(len, sizeof(usbroothub_devd3));
+ buflen = uimin(len, sizeof(usbroothub_devd3));
memcpy(buf, &usbroothub_devd3, buflen);
} else if (bus->ub_revision == USBREV_2_0) {
- buflen = min(len, sizeof(usbroothub_devd2));
+ buflen = uimin(len, sizeof(usbroothub_devd2));
memcpy(buf, &usbroothub_devd2, buflen);
} else {
- buflen = min(len, sizeof(usbroothub_devd1));
+ buflen = uimin(len, sizeof(usbroothub_devd1));
memcpy(buf, &usbroothub_devd1, buflen);
}
break;
case C(0, UDESC_CONFIG):
if (bus->ub_revision >= USBREV_3_0) {
- buflen = min(len, sizeof(usbroothub_confd3));
+ buflen = uimin(len, sizeof(usbroothub_confd3));
memcpy(buf, &usbroothub_confd3, buflen);
} else if (bus->ub_revision == USBREV_2_0) {
- buflen = min(len, sizeof(usbroothub_confd2));
+ buflen = uimin(len, sizeof(usbroothub_confd2));
memcpy(buf, &usbroothub_confd2, buflen);
} else {
- buflen = min(len, sizeof(usbroothub_confd1));
+ buflen = uimin(len, sizeof(usbroothub_confd1));
memcpy(buf, &usbroothub_confd1, buflen);
}
break;
@@ -437,7 +437,7 @@ roothub_ctrl_start(struct usbd_xfer *xfer)
* We can't really operate at another speed,
* but the spec says we need this descriptor.
*/
- buflen = min(len, sizeof(usbroothub_odevd2));
+ buflen = uimin(len, sizeof(usbroothub_odevd2));
memcpy(buf, &usbroothub_odevd2, buflen);
} else
goto fail;
@@ -450,7 +450,7 @@ roothub_ctrl_start(struct usbd_xfer *xfer)
* We can't really operate at another speed,
* but the spec says we need this descriptor.
*/
- buflen = min(len, sizeof(usbroothub_confd2));
+ buflen = uimin(len, sizeof(usbroothub_confd2));
memcpy(&confd, &usbroothub_confd2, buflen);
confd.urh_confd.bDescriptorType =
UDESC_OTHER_SPEED_CONFIGURATION;
@@ -460,7 +460,7 @@ roothub_ctrl_start(struct usbd_xfer *xfer)
break;
case C(0, UDESC_BOS):
if (bus->ub_revision >= USBREV_3_0) {
- buflen = min(len, sizeof(usbroothub_bosd3));
+ buflen = uimin(len, sizeof(usbroothub_bosd3));
memcpy(buf, &usbroothub_bosd3, buflen);
} else
goto fail;
@@ -485,7 +485,7 @@ roothub_ctrl_start(struct usbd_xfer *xfer)
}
break;
case C(UR_GET_DESCRIPTOR, UT_READ_CLASS_DEVICE):
- buflen = min(len, sizeof(usbroothub_hubd));
+ buflen = uimin(len, sizeof(usbroothub_hubd));
memcpy(buf, &usbroothub_hubd, buflen);
break;
case C(UR_GET_INTERFACE, UT_READ_INTERFACE):
diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c
index f69309c863c..abc0497224a 100644
--- a/sys/dev/usb/uscanner.c
+++ b/sys/dev/usb/uscanner.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uscanner.c,v 1.82 2018/01/21 13:57:12 skrll Exp $ */
+/* $NetBSD: uscanner.c,v 1.83 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uscanner.c,v 1.82 2018/01/21 13:57:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uscanner.c,v 1.83 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -506,7 +506,7 @@ uscanner_do_read(struct uscanner_softc *sc, struct uio *uio, int flag)
if (sc->sc_dying)
return EIO;
- while ((n = min(sc->sc_bulkin_bufferlen, uio->uio_resid)) != 0) {
+ while ((n = uimin(sc->sc_bulkin_bufferlen, uio->uio_resid)) != 0) {
DPRINTFN(1, ("uscannerread: start transfer %d bytes\n",n));
tn = n;
@@ -559,7 +559,7 @@ uscanner_do_write(struct uscanner_softc *sc, struct uio *uio, int flag)
if (sc->sc_dying)
return EIO;
- while ((n = min(sc->sc_bulkout_bufferlen, uio->uio_resid)) != 0) {
+ while ((n = uimin(sc->sc_bulkout_bufferlen, uio->uio_resid)) != 0) {
error = uiomove(sc->sc_bulkout_buffer, n, uio);
if (error)
break;
diff --git a/sys/dev/usb/utoppy.c b/sys/dev/usb/utoppy.c
index d1ebc24a4ae..0014ea1bef7 100644
--- a/sys/dev/usb/utoppy.c
+++ b/sys/dev/usb/utoppy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: utoppy.c,v 1.30 2018/01/21 13:57:12 skrll Exp $ */
+/* $NetBSD: utoppy.c,v 1.31 2018/09/03 16:29:34 riastradh Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: utoppy.c,v 1.30 2018/01/21 13:57:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: utoppy.c,v 1.31 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -469,7 +469,7 @@ utoppy_dump_packet(const void *b, size_t len)
if (len == 0)
return;
- len = min(len, 256);
+ len = uimin(len, 256);
printf("00: ");
@@ -595,14 +595,14 @@ utoppy_send_packet(struct utoppy_softc *sc, uint16_t cmd, uint32_t timeout)
do {
uint32_t thislen;
- thislen = min(len, UTOPPY_FRAG_SIZE);
+ thislen = uimin(len, UTOPPY_FRAG_SIZE);
memcpy(sc->sc_out_buf, data, thislen);
err = utoppy_bulk_transfer(sc->sc_out_xfer, sc->sc_out_pipe,
0, timeout, sc->sc_out_buf, &thislen);
- if (thislen != min(len, UTOPPY_FRAG_SIZE)) {
+ if (thislen != uimin(len, UTOPPY_FRAG_SIZE)) {
DPRINTF(UTOPPY_DBG_SEND_PACKET, ("%s: "
"utoppy_send_packet: sent %ld, err %d\n",
device_xname(sc->sc_dev), (u_long)thislen, err));
@@ -638,7 +638,7 @@ utoppy_recv_packet(struct utoppy_softc *sc, uint16_t *respp, uint32_t timeout)
device_xname(sc->sc_dev)));
do {
- requested = thislen = min(bytesleft, UTOPPY_FRAG_SIZE);
+ requested = thislen = uimin(bytesleft, UTOPPY_FRAG_SIZE);
err = utoppy_bulk_transfer(sc->sc_in_xfer, sc->sc_in_pipe,
USBD_SHORT_XFER_OK, timeout, sc->sc_in_buf,
@@ -1459,7 +1459,7 @@ utoppyread(dev_t dev, struct uio *uio, int flags)
break;
}
- len = min(uio->uio_resid, sc->sc_in_len);
+ len = uimin(uio->uio_resid, sc->sc_in_len);
if (len) {
err = uiomove(UTOPPY_IN_DATA(sc), len, uio);
if (err == 0) {
@@ -1524,9 +1524,9 @@ utoppywrite(dev_t dev, struct uio *uio, int flags)
(u_long)uio->uio_resid, sc->sc_wr_size, sc->sc_wr_offset));
while (sc->sc_state == UTOPPY_STATE_WRITEFILE &&
- (len = min(uio->uio_resid, sc->sc_wr_size)) != 0) {
+ (len = uimin(uio->uio_resid, sc->sc_wr_size)) != 0) {
- len = min(len, UTOPPY_BSIZE - (UTOPPY_HEADER_SIZE +
+ len = uimin(len, UTOPPY_BSIZE - (UTOPPY_HEADER_SIZE +
sizeof(uint64_t) + 3));
DPRINTF(UTOPPY_DBG_WRITE, ("%s: utoppywrite: uiomove(%ld)\n",
diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c
index e2cb25f681f..e04d35adcef 100644
--- a/sys/dev/usb/xhci.c
+++ b/sys/dev/usb/xhci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.97 2018/08/30 13:13:24 jakllsch Exp $ */
+/* $NetBSD: xhci.c,v 1.98 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.97 2018/08/30 13:13:24 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.98 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1281,7 +1281,7 @@ xhci_intr1(struct xhci_softc * const sc)
if ((usbsts & (XHCI_STS_HSE | XHCI_STS_EINT | XHCI_STS_PCD |
XHCI_STS_HCE)) == 0) {
DPRINTFN(16, "ignored intr not for %s",
- device_xname(sc->sc_dev), 0, 0, 0);
+ (uintptr_t)device_xname(sc->sc_dev), 0, 0, 0);
return 0;
}
@@ -3523,7 +3523,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
}
usb_hub_descriptor_t hubd;
- totlen = min(buflen, sizeof(hubd));
+ totlen = uimin(buflen, sizeof(hubd));
memcpy(&hubd, buf, totlen);
hubd.bNbrPorts = sc->sc_rhportcount[bn];
USETW(hubd.wHubCharacteristics, UHD_PWR_NO_SWITCH);
@@ -3533,7 +3533,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
hubd.DeviceRemovable[i++] = 0;
}
hubd.bDescLength = USB_HUB_DESCRIPTOR_SIZE + i;
- totlen = min(totlen, hubd.bDescLength);
+ totlen = uimin(totlen, hubd.bDescLength);
memcpy(buf, &hubd, totlen);
break;
case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE):
@@ -3583,7 +3583,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
if (v & XHCI_PS_PLC) i |= UPS_C_PORT_LINK_STATE;
if (v & XHCI_PS_CEC) i |= UPS_C_PORT_CONFIG_ERROR;
USETW(ps.wPortChange, i);
- totlen = min(len, sizeof(ps));
+ totlen = uimin(len, sizeof(ps));
memcpy(buf, &ps, totlen);
break;
}
diff --git a/sys/dev/video.c b/sys/dev/video.c
index 34d70d22e9b..e73bcabf46a 100644
--- a/sys/dev/video.c
+++ b/sys/dev/video.c
@@ -1,4 +1,4 @@
-/* $NetBSD: video.c,v 1.34 2017/10/28 03:47:24 riastradh Exp $ */
+/* $NetBSD: video.c,v 1.35 2018/09/03 16:29:30 riastradh Exp $ */
/*
* Copyright (c) 2008 Patrick Mahoney <pat@polycrystal.org>
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: video.c,v 1.34 2017/10/28 03:47:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: video.c,v 1.35 2018/09/03 16:29:30 riastradh Exp $");
#include "video.h"
#if NVIDEO > 0
@@ -1757,7 +1757,7 @@ retry:
mutex_exit(&vs->vs_lock);
- len = min(uio->uio_resid, vb->vb_buf->bytesused - vs->vs_bytesread);
+ len = uimin(uio->uio_resid, vb->vb_buf->bytesused - vs->vs_bytesread);
offset = vb->vb_buf->m.offset + vs->vs_bytesread;
if (scatter_io_init(&vs->vs_data, offset, len, &sio)) {
@@ -2426,7 +2426,7 @@ video_stream_realloc_bufs(struct video_stream *vs, uint8_t nbufs)
vs->vs_buf = NULL;
}
- minnbufs = min(vs->vs_nbufs, oldnbufs);
+ minnbufs = uimin(vs->vs_nbufs, oldnbufs);
/* copy any bufs that will be reused */
for (i = 0; i < minnbufs; ++i)
vs->vs_buf[i] = oldbuf[i];
@@ -2649,7 +2649,7 @@ scatter_buf_set_size(struct scatter_buf *sb, size_t sz)
sb->sb_page_ary = NULL;
}
- minpages = min(npages, oldnpages);
+ minpages = uimin(npages, oldnpages);
/* copy any pages that will be reused */
for (i = 0; i < minpages; ++i)
sb->sb_page_ary[i] = old_ary[i];
@@ -2720,7 +2720,7 @@ scatter_io_next(struct scatter_io *sio, void **p, size_t *sz)
pg = sio->sio_offset >> PAGE_SHIFT;
pgo = sio->sio_offset & PAGE_MASK;
- *sz = min(PAGE_SIZE - pgo, sio->sio_resid);
+ *sz = uimin(PAGE_SIZE - pgo, sio->sio_resid);
*p = sio->sio_buf->sb_page_ary[pg] + pgo;
sio->sio_offset += *sz;
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index f4de74bf2b2..2cd0db8f989 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vnd.c,v 1.263 2017/10/28 03:47:24 riastradh Exp $ */
+/* $NetBSD: vnd.c,v 1.264 2018/09/03 16:29:30 riastradh Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.263 2017/10/28 03:47:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.264 2018/09/03 16:29:30 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vnd.h"
@@ -1646,7 +1646,7 @@ vndsetcred(struct vnd_softc *vnd, kauth_cred_t cred)
/* XXX: Horrible kludge to establish credentials for NFS */
aiov.iov_base = tmpbuf;
- aiov.iov_len = min(DEV_BSIZE, dbtob(vnd->sc_size));
+ aiov.iov_len = uimin(DEV_BSIZE, dbtob(vnd->sc_size));
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
auio.uio_offset = 0;
diff --git a/sys/dev/wscons/wscons_rinit.c b/sys/dev/wscons/wscons_rinit.c
index 4c333a1f2e6..cdbe93190e5 100644
--- a/sys/dev/wscons/wscons_rinit.c
+++ b/sys/dev/wscons/wscons_rinit.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wscons_rinit.c,v 1.7 2013/10/25 20:55:24 martin Exp $ */
+/* $NetBSD: wscons_rinit.c,v 1.8 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wscons_rinit.c,v 1.7 2013/10/25 20:55:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wscons_rinit.c,v 1.8 2018/09/03 16:29:34 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -103,10 +103,10 @@ rcons_init(struct rcons *rc, int mrow, int mcol)
rcons_initfont(rc, &gallant19);
i = rp->height / rc->rc_font->height;
- rc->rc_maxrow = min(i, mrow);
+ rc->rc_maxrow = uimin(i, mrow);
i = rp->width / rc->rc_font->width;
- rc->rc_maxcol = min(i, mcol);
+ rc->rc_maxcol = uimin(i, mcol);
/* Center emulator screen (but align x origin to 32 bits) */
rc->rc_xorigin =
diff --git a/sys/dev/wscons/wsdisplay_glyphcache.c b/sys/dev/wscons/wsdisplay_glyphcache.c
index a85c7243ac9..41401cb65d9 100644
--- a/sys/dev/wscons/wsdisplay_glyphcache.c
+++ b/sys/dev/wscons/wsdisplay_glyphcache.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay_glyphcache.c,v 1.10 2017/11/04 01:52:09 christos Exp $ */
+/* $NetBSD: wsdisplay_glyphcache.c,v 1.11 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 2012 Michael Lorenz
@@ -116,14 +116,14 @@ glyphcache_reconfig(glyphcache *gc, int cellwidth, int cellheight, long attr)
if (buckets < 1)
return ENOMEM;
- buckets = min(buckets, gc->gc_nbuckets);
+ buckets = uimin(buckets, gc->gc_nbuckets);
gc->gc_numbuckets = buckets;
DPRINTF("%s: using %d buckets\n", __func__, buckets);
for (i = 0; i < buckets; i++) {
b = &gc->gc_buckets[i];
b->gb_firstcell = usedcells;
- b->gb_numcells = min(223, gc->gc_numcells - usedcells);
+ b->gb_numcells = uimin(223, gc->gc_numcells - usedcells);
usedcells += 223;
b->gb_usedcells = 0;
b->gb_index = -1;
diff --git a/sys/dev/wscons/wsemul_dumb.c b/sys/dev/wscons/wsemul_dumb.c
index c3dbf93a812..dcac1fdf0b5 100644
--- a/sys/dev/wscons/wsemul_dumb.c
+++ b/sys/dev/wscons/wsemul_dumb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wsemul_dumb.c,v 1.17 2017/11/03 18:42:35 maya Exp $ */
+/* $NetBSD: wsemul_dumb.c,v 1.18 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsemul_dumb.c,v 1.17 2017/11/03 18:42:35 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsemul_dumb.c,v 1.18 2018/09/03 16:29:34 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -149,7 +149,7 @@ wsemul_dumb_output(void *cookie, const u_char *data, u_int count,
break;
case ASCII_HT:
- n = min(8 - (edp->ccol & 7),
+ n = uimin(8 - (edp->ccol & 7),
edp->ncols - edp->ccol - 1);
(*edp->emulops->erasecols)(edp->emulcookie,
edp->crow, edp->ccol, n, edp->defattr);
diff --git a/sys/dev/wscons/wsemul_sun.c b/sys/dev/wscons/wsemul_sun.c
index dd4ea35dec8..3b80da327ae 100644
--- a/sys/dev/wscons/wsemul_sun.c
+++ b/sys/dev/wscons/wsemul_sun.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wsemul_sun.c,v 1.32 2017/11/03 18:42:35 maya Exp $ */
+/* $NetBSD: wsemul_sun.c,v 1.33 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -33,7 +33,7 @@
/* XXX DESCRIPTION/SOURCE OF INFORMATION */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.32 2017/11/03 18:42:35 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsemul_sun.c,v 1.33 2018/09/03 16:29:34 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -236,7 +236,7 @@ wsemul_sun_output_normal(struct wsemul_sun_emuldata *edp, u_char c, int kernel)
break;
case ASCII_HT: /* "Tab (TAB)" */
- n = min(8 - (edp->ccol & 7), COLS_LEFT);
+ n = uimin(8 - (edp->ccol & 7), COLS_LEFT);
(*edp->emulops->erasecols)(edp->emulcookie, edp->crow,
edp->ccol, n,
kernel ? edp->kernattr : edp->curattr);
@@ -342,7 +342,7 @@ wsemul_sun_control(struct wsemul_sun_emuldata *edp, u_char c)
switch (c) {
case '@': /* "Insert Character (ICH)" */
- n = min(NORMALIZE_ARG(0), COLS_LEFT + 1);
+ n = uimin(NORMALIZE_ARG(0), COLS_LEFT + 1);
src = edp->ccol;
dst = edp->ccol + n;
if (dst < edp->ncols) {
@@ -354,28 +354,28 @@ wsemul_sun_control(struct wsemul_sun_emuldata *edp, u_char c)
break;
case 'A': /* "Cursor Up (CUU)" */
- edp->crow -= min(NORMALIZE_ARG(0), edp->crow);
+ edp->crow -= uimin(NORMALIZE_ARG(0), edp->crow);
break;
case 'E': /* "Cursor Next Line (CNL)" */
edp->ccol = 0;
/* FALLTHRU */
case 'B': /* "Cursor Down (CUD)" */
- edp->crow += min(NORMALIZE_ARG(0), ROWS_LEFT);
+ edp->crow += uimin(NORMALIZE_ARG(0), ROWS_LEFT);
break;
case 'C': /* "Cursor Forward (CUF)" */
- edp->ccol += min(NORMALIZE_ARG(0), COLS_LEFT);
+ edp->ccol += uimin(NORMALIZE_ARG(0), COLS_LEFT);
break;
case 'D': /* "Cursor Backward (CUB)" */
- edp->ccol -= min(NORMALIZE_ARG(0), edp->ccol);
+ edp->ccol -= uimin(NORMALIZE_ARG(0), edp->ccol);
break;
case 'f': /* "Horizontal And Vertical Position (HVP)" */
case 'H': /* "Cursor Position (CUP)" */
- edp->crow = min(NORMALIZE_ARG(1), edp->nrows) - 1;
- edp->ccol = min(NORMALIZE_ARG(0), edp->ncols) - 1;
+ edp->crow = uimin(NORMALIZE_ARG(1), edp->nrows) - 1;
+ edp->ccol = uimin(NORMALIZE_ARG(0), edp->ncols) - 1;
break;
case 'J': /* "Erase in Display (ED)" */
@@ -390,7 +390,7 @@ wsemul_sun_control(struct wsemul_sun_emuldata *edp, u_char c)
break;
case 'L': /* "Insert Line (IL)" */
- n = min(NORMALIZE_ARG(0), ROWS_LEFT + 1);
+ n = uimin(NORMALIZE_ARG(0), ROWS_LEFT + 1);
src = edp->crow;
dst = edp->crow + n;
if (dst < edp->nrows) {
@@ -402,7 +402,7 @@ wsemul_sun_control(struct wsemul_sun_emuldata *edp, u_char c)
break;
case 'M': /* "Delete Line (DL)" */
- n = min(NORMALIZE_ARG(0), ROWS_LEFT + 1);
+ n = uimin(NORMALIZE_ARG(0), ROWS_LEFT + 1);
src = edp->crow + n;
dst = edp->crow;
if (src < edp->nrows) {
@@ -414,7 +414,7 @@ wsemul_sun_control(struct wsemul_sun_emuldata *edp, u_char c)
break;
case 'P': /* "Delete Character (DCH)" */
- n = min(NORMALIZE_ARG(0), COLS_LEFT + 1);
+ n = uimin(NORMALIZE_ARG(0), COLS_LEFT + 1);
src = edp->ccol + n;
dst = edp->ccol;
if (src < edp->ncols) {
@@ -441,7 +441,7 @@ wsemul_sun_control(struct wsemul_sun_emuldata *edp, u_char c)
goto setattr;
case 'r': /* "Set Scrolling (SUNSCRL)" */
- edp->scrolldist = min(ARG(0), edp->nrows);
+ edp->scrolldist = uimin(ARG(0), edp->nrows);
break;
case 's': /* "Reset Terminal Emulator (SUNRESET)" */
diff --git a/sys/dev/wscons/wsemul_vt100.c b/sys/dev/wscons/wsemul_vt100.c
index fd3517b306d..0f1734657fe 100644
--- a/sys/dev/wscons/wsemul_vt100.c
+++ b/sys/dev/wscons/wsemul_vt100.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wsemul_vt100.c,v 1.44 2018/01/21 10:30:51 martin Exp $ */
+/* $NetBSD: wsemul_vt100.c,v 1.45 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 1998
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.44 2018/01/21 10:30:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.45 2018/09/03 16:29:34 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_wsmsgattrs.h"
@@ -449,7 +449,7 @@ wsemul_vt100_output_c0c1(struct wsemul_vt100_emuldata *edp, u_char c,
if (vd->tabs[n])
break;
} else {
- n = vd->ccol + min(8 - (vd->ccol & 7), COLS_LEFT(vd));
+ n = vd->ccol + uimin(8 - (vd->ccol & 7), COLS_LEFT(vd));
}
vd->ccol = n;
break;
diff --git a/sys/dev/wscons/wsemul_vt100_subr.c b/sys/dev/wscons/wsemul_vt100_subr.c
index 418f1df17fb..446f9d8101c 100644
--- a/sys/dev/wscons/wsemul_vt100_subr.c
+++ b/sys/dev/wscons/wsemul_vt100_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wsemul_vt100_subr.c,v 1.22 2018/06/05 21:11:50 uwe Exp $ */
+/* $NetBSD: wsemul_vt100_subr.c,v 1.23 2018/09/03 16:29:34 riastradh Exp $ */
/*
* Copyright (c) 1998
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_subr.c,v 1.22 2018/06/05 21:11:50 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100_subr.c,v 1.23 2018/09/03 16:29:34 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -387,41 +387,41 @@ wsemul_vt100_handle_csi(struct vt100base_data *edp, u_char c)
break;
case '@': /* ICH insert character VT300 only */
- n = min(DEF1_ARG(edp, 0), COLS_LEFT(edp) + 1);
+ n = uimin(DEF1_ARG(edp, 0), COLS_LEFT(edp) + 1);
help = NCOLS(edp) - (edp->ccol + n);
if (help > 0)
COPYCOLS(edp, edp->ccol, edp->ccol + n, help);
ERASECOLS(edp, edp->ccol, n, edp->bkgdattr);
break;
case 'A': /* CUU */
- edp->crow -= min(DEF1_ARG(edp, 0), ROWS_ABOVE(edp));
+ edp->crow -= uimin(DEF1_ARG(edp, 0), ROWS_ABOVE(edp));
CHECK_DW(edp);
break;
case 'B': /* CUD */
- edp->crow += min(DEF1_ARG(edp, 0), ROWS_BELOW(edp));
+ edp->crow += uimin(DEF1_ARG(edp, 0), ROWS_BELOW(edp));
CHECK_DW(edp);
break;
case 'C': /* CUF */
- edp->ccol += min(DEF1_ARG(edp, 0), COLS_LEFT(edp));
+ edp->ccol += uimin(DEF1_ARG(edp, 0), COLS_LEFT(edp));
break;
case 'D': /* CUB */
- edp->ccol -= min(DEF1_ARG(edp, 0), edp->ccol);
+ edp->ccol -= uimin(DEF1_ARG(edp, 0), edp->ccol);
edp->flags &= ~VTFL_LASTCHAR;
break;
case 'H': /* CUP */
case 'f': /* HVP */
if (edp->flags & VTFL_DECOM)
edp->crow = edp->scrreg_startrow +
- min(DEF1_ARG(edp, 0), edp->scrreg_nrows) - 1;
+ uimin(DEF1_ARG(edp, 0), edp->scrreg_nrows) - 1;
else
- edp->crow = min(DEF1_ARG(edp, 0), edp->nrows) - 1;
+ edp->crow = uimin(DEF1_ARG(edp, 0), edp->nrows) - 1;
CHECK_DW(edp);
- edp->ccol = min(DEF1_ARG(edp, 1), NCOLS(edp)) - 1;
+ edp->ccol = uimin(DEF1_ARG(edp, 1), NCOLS(edp)) - 1;
edp->flags &= ~VTFL_LASTCHAR;
break;
case 'L': /* IL insert line */
case 'M': /* DL delete line */
- n = min(DEF1_ARG(edp, 0), ROWS_BELOW(edp) + 1);
+ n = uimin(DEF1_ARG(edp, 0), ROWS_BELOW(edp) + 1);
{
int savscrstartrow, savscrnrows;
savscrstartrow = edp->scrreg_startrow;
@@ -437,14 +437,14 @@ wsemul_vt100_handle_csi(struct vt100base_data *edp, u_char c)
}
break;
case 'P': /* DCH delete character */
- n = min(DEF1_ARG(edp, 0), COLS_LEFT(edp) + 1);
+ n = uimin(DEF1_ARG(edp, 0), COLS_LEFT(edp) + 1);
help = NCOLS(edp) - (edp->ccol + n);
if (help > 0)
COPYCOLS(edp, edp->ccol + n, edp->ccol, help);
ERASECOLS(edp, NCOLS(edp) - n, n, edp->bkgdattr);
break;
case 'X': /* ECH erase character */
- n = min(DEF1_ARG(edp, 0), COLS_LEFT(edp) + 1);
+ n = uimin(DEF1_ARG(edp, 0), COLS_LEFT(edp) + 1);
ERASECOLS(edp, edp->ccol, n, edp->bkgdattr);
break;
case 'c': /* DA primary */
@@ -599,8 +599,8 @@ wsemul_vt100_handle_csi(struct vt100base_data *edp, u_char c)
}
break;
case 'r': /* DECSTBM set top/bottom margins */
- help = min(DEF1_ARG(edp, 0), edp->nrows) - 1;
- n = min(DEFx_ARG(edp, 1, edp->nrows), edp->nrows) - help;
+ help = uimin(DEF1_ARG(edp, 0), edp->nrows) - 1;
+ n = uimin(DEFx_ARG(edp, 1, edp->nrows), edp->nrows) - help;
if (n < 2) {
/* minimal scrolling region has 2 lines */
return;
diff --git a/sys/dev/wsfb/genfb.c b/sys/dev/wsfb/genfb.c
index f4830b1f577..0597b2e5c19 100644
--- a/sys/dev/wsfb/genfb.c
+++ b/sys/dev/wsfb/genfb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb.c,v 1.63 2018/03/06 07:49:36 mlelstv Exp $ */
+/* $NetBSD: genfb.c,v 1.64 2018/09/03 16:29:34 riastradh Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.63 2018/03/06 07:49:36 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.64 2018/09/03 16:29:34 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -298,7 +298,7 @@ genfb_attach(struct genfb_softc *sc, struct genfb_ops *ops)
#ifdef SPLASHSCREEN
j = 0;
- for (i = 0; i < min(1 << sc->sc_depth, 256); i++) {
+ for (i = 0; i < uimin(1 << sc->sc_depth, 256); i++) {
if (i >= SPLASH_CMAP_OFFSET &&
i < SPLASH_CMAP_OFFSET + SPLASH_CMAP_SIZE) {
splash_get_cmap(i,
diff --git a/sys/dev/wsfont/wsfont.c b/sys/dev/wsfont/wsfont.c
index 20c04180e75..a9ced1e0b5f 100644
--- a/sys/dev/wsfont/wsfont.c
+++ b/sys/dev/wsfont/wsfont.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wsfont.c,v 1.62 2017/11/04 08:33:28 maya Exp $ */
+/* $NetBSD: wsfont.c,v 1.63 2018/09/03 16:29:34 riastradh Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.62 2017/11/04 08:33:28 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.63 2018/09/03 16:29:34 riastradh Exp $");
#include "opt_wsfont.h"
@@ -587,9 +587,9 @@ wsfont_matches(struct wsdisplay_font *font, const char *name,
return (0);
} else {
if (font->fontwidth > width)
- score -= 10000 + min(font->fontwidth - width, 9999);
+ score -= 10000 + uimin(font->fontwidth - width, 9999);
else
- score -= min(width - font->fontwidth, 9999);
+ score -= uimin(width - font->fontwidth, 9999);
}
}