svn commit: r368406 - head/sys/compat/linuxkpi/common/include/linux

Hans Petter Selasky hselasky at FreeBSD.org
Mon Dec 7 09:48:07 UTC 2020


Author: hselasky
Date: Mon Dec  7 09:48:06 2020
New Revision: 368406
URL: https://svnweb.freebsd.org/changeset/base/368406

Log:
  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".
  
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/compat/linuxkpi/common/include/linux/bitops.h
  head/sys/compat/linuxkpi/common/include/linux/scatterlist.h

Modified: head/sys/compat/linuxkpi/common/include/linux/bitops.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/bitops.h	Mon Dec  7 09:21:06 2020	(r368405)
+++ head/sys/compat/linuxkpi/common/include/linux/bitops.h	Mon Dec  7 09:48:06 2020	(r368406)
@@ -360,7 +360,7 @@ linux_reg_op(unsigned long *bitmap, int pos, int order
         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;

Modified: head/sys/compat/linuxkpi/common/include/linux/scatterlist.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/scatterlist.h	Mon Dec  7 09:21:06 2020	(r368405)
+++ head/sys/compat/linuxkpi/common/include/linux/scatterlist.h	Mon Dec  7 09:48:06 2020	(r368406)
@@ -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;


More information about the svn-src-head mailing list