Re: [PATCH] drm/amdgpu: cleanup coding style in amdgpu_kms.c

2022-09-06 Thread kernel test robot
Hi Jingyu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on e47eb90a0a9ae20b82635b9b99a8d0979b757ad8]

url:
https://github.com/intel-lab-lkp/linux/commits/Jingyu-Wang/drm-amdgpu-cleanup-coding-style-in-amdgpu_kms-c/20220906-104802
base:   e47eb90a0a9ae20b82635b9b99a8d0979b757ad8
config: mips-allyesconfig 
(https://download.01.org/0day-ci/archive/20220906/202209061955.bbpvthp7-...@intel.com/config)
compiler: mips-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://github.com/intel-lab-lkp/linux/commit/778e4a57afd0db6a6a752487e1a1cda253cd9682
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Jingyu-Wang/drm-amdgpu-cleanup-coding-style-in-amdgpu_kms-c/20220906-104802
git checkout 778e4a57afd0db6a6a752487e1a1cda253cd9682
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 
O=build_dir ARCH=mips SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c: In function 'amdgpu_info_ioctl':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:554:76: error: macro "min_t" 
>> requires 3 arguments, but only 2 given
 554 | ret = copy_to_user(out, &ip, min_t((size_t)size, 
sizeof(ip)));
 |  
  ^
   In file included from include/linux/kernel.h:26,
from include/linux/cpumask.h:10,
from include/linux/smp.h:13,
from arch/mips/include/asm/cpu-type.h:12,
from arch/mips/include/asm/timex.h:19,
from include/linux/timex.h:67,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from include/linux/ktime.h:24,
from drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h:26,
from drivers/gpu/drm/amd/amdgpu/amdgpu.h:43,
from drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:29:
   include/linux/minmax.h:104: note: macro "min_t" defined here
 104 | #define min_t(type, x, y)   __careful_cmp((type)(x), (type)(y), 
<)
 | 
>> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:554:46: error: 'min_t' undeclared 
>> (first use in this function)
 554 | ret = copy_to_user(out, &ip, min_t((size_t)size, 
sizeof(ip)));
 |  ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:554:46: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c: In function 
'amdgpu_debugfs_firmware_info_show':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1384:27: error: expected expression 
>> before '[' token
1384 | #define TA_FW_NAME(type) ([TA_FW_TYPE_PSP_##type] = #type)
 |   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1385:17: note: in expansion of macro 
'TA_FW_NAME'
1385 | TA_FW_NAME(XGMI),
 | ^~


vim +/min_t +554 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

   494  
   495  /*
   496   * Userspace get information ioctl
   497   */
   498  /**
   499   * amdgpu_info_ioctl - answer a device specific request.
   500   *
   501   * @dev: drm device pointer
   502   * @data: request object
   503   * @filp: drm filp
   504   *
   505   * This function is used to pass device specific parameters to the 
userspace
   506   * drivers.  Examples include: pci device id, pipeline parms, tiling 
params,
   507   * etc. (all asics).
   508   * Returns 0 on success, -EINVAL on failure.
   509   */
   510  int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct 
drm_file *filp)
   511  {
   512  struct amdgpu_device *adev = drm_to_adev(dev);
   513  struct drm_amdgpu_info *info = data;
   514  struct amdgpu_mode_info *minfo = &adev->mode_info;
   515  void __user *out = (void __user 
*)(uintptr_t)info->return_pointer;
   516  uint32_t size = info->return_size;
   517  struct drm_crtc *crtc;
   518  uint32_t ui32 = 0;
   519  uint64_t ui64 = 0;
   520  int i, found;
   521  int ui32_size = sizeof(ui32);
   522  
   523  if (!info->return_size || !info->return_pointer)
   524  return -EINVAL;
   525  
   526  switch (info->query) {
   527  case AMDGPU_INFO_ACCEL_WORKING:
   528  ui32 = adev->accel_working;
   529  return copy_to_user(out, &ui32, min(size, 4u)) ? 
-EFAULT : 0;
   530  c

Re: [PATCH] drm/amdgpu: cleanup coding style in amdgpu_kms.c

2022-09-06 Thread kernel test robot
Hi Jingyu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on e47eb90a0a9ae20b82635b9b99a8d0979b757ad8]

url:
https://github.com/intel-lab-lkp/linux/commits/Jingyu-Wang/drm-amdgpu-cleanup-coding-style-in-amdgpu_kms-c/20220906-104802
base:   e47eb90a0a9ae20b82635b9b99a8d0979b757ad8
config: arm64-randconfig-r031-20220906 
(https://download.01.org/0day-ci/archive/20220907/202209070101.lerxi9zr-...@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 
c55b41d5199d2394dd6cdb8f52180d8b81d809d4)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# 
https://github.com/intel-lab-lkp/linux/commit/778e4a57afd0db6a6a752487e1a1cda253cd9682
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Jingyu-Wang/drm-amdgpu-cleanup-coding-style-in-amdgpu_kms-c/20220906-104802
git checkout 778e4a57afd0db6a6a752487e1a1cda253cd9682
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=arm64 SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:554:62: error: too few arguments 
>> provided to function-like macro invocation
   ret = copy_to_user(out, &ip, min_t((size_t)size, 
sizeof(ip)));
  ^
   include/linux/minmax.h:104:9: note: macro 'min_t' defined here
   #define min_t(type, x, y)   __careful_cmp((type)(x), (type)(y), <)
   ^
>> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:554:32: error: use of undeclared 
>> identifier 'min_t'; did you mean 'minfo'?
   ret = copy_to_user(out, &ip, min_t((size_t)size, 
sizeof(ip)));
^
minfo
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:514:27: note: 'minfo' declared here
   struct amdgpu_mode_info *minfo = &adev->mode_info;
^
>> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1385:3: error: expected expression
   TA_FW_NAME(XGMI),
   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1384:27: note: expanded from macro 
'TA_FW_NAME'
   #define TA_FW_NAME(type) ([TA_FW_TYPE_PSP_##type] = #type)
 ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1386:3: error: expected expression
   TA_FW_NAME(RAS),
   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1384:27: note: expanded from macro 
'TA_FW_NAME'
   #define TA_FW_NAME(type) ([TA_FW_TYPE_PSP_##type] = #type)
 ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1387:3: error: expected expression
   TA_FW_NAME(HDCP),
   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1384:27: note: expanded from macro 
'TA_FW_NAME'
   #define TA_FW_NAME(type) ([TA_FW_TYPE_PSP_##type] = #type)
 ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1388:3: error: expected expression
   TA_FW_NAME(DTM),
   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1384:27: note: expanded from macro 
'TA_FW_NAME'
   #define TA_FW_NAME(type) ([TA_FW_TYPE_PSP_##type] = #type)
 ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1389:3: error: expected expression
   TA_FW_NAME(RAP),
   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1384:27: note: expanded from macro 
'TA_FW_NAME'
   #define TA_FW_NAME(type) ([TA_FW_TYPE_PSP_##type] = #type)
 ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1390:3: error: expected expression
   TA_FW_NAME(SECUREDISPLAY),
   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c:1384:27: note: expanded from macro 
'TA_FW_NAME'
   #define TA_FW_NAME(type) ([TA_FW_TYPE_PSP_##type] = #type)
 ^
   8 errors generated.


vim +554 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

   494  
   495  /*
   496   * Userspace get information ioctl
   497   */
   498  /**
   499   * amdgpu_info_ioctl - answer a device specific request.
   500   *
   501   * @dev: drm device pointer
   502   * @data: request object
   503   * @filp: drm filp
   504   *
   505   * This function is used to pass device specific parameters to the 
userspace
   506   * drivers.  Examples include: pci device id, pipeline parms, tiling 
params,
   507   * etc. (all asics).
   508   * Returns 0 on success, -EINVAL on failure.