Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Dec 2020 13:20:34 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 20a930e44db4 - stable/12 - MFC r368406: Prefer using the MIN() function macro over the min() inline function in the LinuxKPI. Linux defines min() to be a macro, while in FreeBSD min() is a static inline function clamping its arguments to "unsigned int".
Message-ID:  <202012281320.0BSDKY9u043072@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=20a930e44db4f6e89c6ee950081b8d1d0f39998a

commit 20a930e44db4f6e89c6ee950081b8d1d0f39998a
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2020-12-07 09:48:06 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2020-12-28 13:19:47 +0000

    MFC r368406:
    Prefer using the MIN() function macro over the min() inline function
    in the LinuxKPI. Linux defines min() to be a macro, while in FreeBSD
    min() is a static inline function clamping its arguments to
    "unsigned int".
    
    Sponsored by:   Mellanox Technologies // NVIDIA Networking
---
 sys/compat/linuxkpi/common/include/linux/bitops.h      | 2 +-
 sys/compat/linuxkpi/common/include/linux/scatterlist.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h
index 7e259760f7c3..3bcfd69ba5c5 100644
--- a/sys/compat/linuxkpi/common/include/linux/bitops.h
+++ b/sys/compat/linuxkpi/common/include/linux/bitops.h
@@ -364,7 +364,7 @@ linux_reg_op(unsigned long *bitmap, int pos, int order, int reg_op)
         index = pos / BITS_PER_LONG;
         offset = pos - (index * BITS_PER_LONG);
         nlongs_reg = BITS_TO_LONGS(nbits_reg);
-        nbitsinlong = min(nbits_reg,  BITS_PER_LONG);
+        nbitsinlong = MIN(nbits_reg,  BITS_PER_LONG);
 
         mask = (1UL << (nbitsinlong - 1));
         mask += mask - 1;
diff --git a/sys/compat/linuxkpi/common/include/linux/scatterlist.h b/sys/compat/linuxkpi/common/include/linux/scatterlist.h
index a23edfb0b4de..2d4b05ba5cb1 100644
--- a/sys/compat/linuxkpi/common/include/linux/scatterlist.h
+++ b/sys/compat/linuxkpi/common/include/linux/scatterlist.h
@@ -343,7 +343,7 @@ __sg_alloc_table_from_pages(struct sg_table *sgt,
 		}
 
 		seg_size = ((j - cur) << PAGE_SHIFT) - off;
-		sg_set_page(s, pages[cur], min(size, seg_size), off);
+		sg_set_page(s, pages[cur], MIN(size, seg_size), off);
 		size -= seg_size;
 		off = 0;
 		cur = j;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012281320.0BSDKY9u043072>