Re: [PATCH] drm/vmwgfx: use min_t to replace min

2020-11-18 Thread kernel test robot
Hi Bernard,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.10-rc4 next-20201118]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Bernard-Zhao/drm-vmwgfx-use-min_t-to-replace-min/20201118-191834
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
0fa8ee0d9ab95c9350b8b84574824d9a384a9f7d
config: i386-randconfig-a012-20201118 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# 
https://github.com/0day-ci/linux/commit/7de055295e38f294671f936d65719c02195251ca
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Bernard-Zhao/drm-vmwgfx-use-min_t-to-replace-min/20201118-191834
git checkout 7de055295e38f294671f936d65719c02195251ca
# save the attached .config to linux build tree
make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c: In function 'vmw_gmr2_bind':
   include/linux/minmax.h:110:46: error: expected expression before ')' token
 110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
 |  ^
   include/linux/minmax.h:18:21: note: in definition of macro '__typecheck'
  18 |  (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
 | ^
   include/linux/minmax.h:42:24: note: in expansion of macro '__safe_cmp'
  42 |  __builtin_choose_expr(__safe_cmp(x, y), \
 |^~
   include/linux/minmax.h:110:27: note: in expansion of macro '__careful_cmp'
 110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
 |   ^
   drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c:75:22: note: in expansion of macro 
'min_t'
  75 |   unsigned long nr = min_t((unsigned long), num_pages, 
VMW_PPN_PER_REMAP);
 |  ^
   include/linux/minmax.h:110:46: error: expected expression before ')' token
 110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
 |  ^
   include/linux/minmax.h:26:48: note: in definition of macro '__is_constexpr'
  26 |  (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int 
*)8)))
 |^
   include/linux/minmax.h:32:25: note: in expansion of macro '__no_side_effects'
  32 |   (__typecheck(x, y) && __no_side_effects(x, y))
 | ^
   include/linux/minmax.h:42:24: note: in expansion of macro '__safe_cmp'
  42 |  __builtin_choose_expr(__safe_cmp(x, y), \
 |^~
   include/linux/minmax.h:110:27: note: in expansion of macro '__careful_cmp'
 110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
 |   ^
   drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c:75:22: note: in expansion of macro 
'min_t'
  75 |   unsigned long nr = min_t((unsigned long), num_pages, 
VMW_PPN_PER_REMAP);
 |  ^
   include/linux/minmax.h:110:57: error: expected expression before ')' token
 110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
 | ^
   include/linux/minmax.h:26:48: note: in definition of macro '__is_constexpr'
  26 |  (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int 
*)8)))
 |^
   include/linux/minmax.h:32:25: note: in expansion of macro '__no_side_effects'
  32 |   (__typecheck(x, y) && __no_side_effects(x, y))
 | ^
   include/linux/minmax.h:42:24: note: in expansion of macro '__safe_cmp'
  42 |  __builtin_choose_expr(__safe_cmp(x, y), \
 |^~
   include/linux/minmax.h:110:27: note: in expansion of macro '__careful_cmp'
 110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
 |   ^
   drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c:75:22: note: in expansion of macro 
'min_t'
  75 |   unsigned long nr = min_t((unsigned long), num_pages, 
VMW_PPN_PER_REMAP);
 |  ^
   include/linux/minmax.h:110:46: error: expected expression before ')' token
 110 | #define min_t(type, x, y) __careful_cmp((type)(x), (type)(y), <)
 |  ^
   include/linux/minmax.h:34:27: note: in definition of 

[PATCH] drm/vmwgfx: use min_t to replace min

2020-11-18 Thread Bernard Zhao
Use min_t to replace min, min_t is a bit fast because min use
twice typeof.
This patch also fix check_patch.pl warning:
WARNING: min() should probably be min_t(unsigned long, num_pages,
VMW_PPN_PER_REMAP)
+unsigned long nr = min(num_pages, (unsigned long)
VMW_PPN_PER_REMAP);

Signed-off-by: Bernard Zhao 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c
index 83c0d5a3e4fd..b8f6fe1a71e6 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c
@@ -72,7 +72,7 @@ static int vmw_gmr2_bind(struct vmw_private *dev_priv,
SVGA_REMAP_GMR2_PPN64 : SVGA_REMAP_GMR2_PPN32;
 
while (num_pages > 0) {
-   unsigned long nr = min(num_pages, (unsigned 
long)VMW_PPN_PER_REMAP);
+   unsigned long nr = min_t((unsigned long), num_pages, 
VMW_PPN_PER_REMAP);
 
remap_cmd.offsetPages = remap_pos;
remap_cmd.numPages = nr;
-- 
2.29.0