[PATCH] drm/amdgpu: cleanup coding style in amdgpu_kms.c
Fix some checkpatch.pl complained about in amdgpu_kms.c Signed-off-by: Jingyu Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 77668c3dae5b..1f90a096232d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -532,6 +532,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) crtc = (struct drm_crtc *)minfo->crtcs[i]; if (crtc && crtc->base.id == info->mode_crtc.id) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); + ui32 = amdgpu_crtc->crtc_id; found = 1; break; @@ -550,7 +551,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) if (ret) return ret; - ret = copy_to_user(out, &ip, min((size_t)size, sizeof(ip))); + ret = copy_to_user(out, &ip, min_t((size_t)size, sizeof(ip))); return ret ? -EFAULT : 0; } case AMDGPU_INFO_HW_IP_COUNT: { @@ -696,17 +697,18 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) ? -EFAULT : 0; } case AMDGPU_INFO_READ_MMR_REG: { - unsigned n, alloc_size; + unsigned int n, alloc_size; uint32_t *regs; - unsigned se_num = (info->read_mmr_reg.instance >> + unsigned int se_num = (info->read_mmr_reg.instance >> AMDGPU_INFO_MMR_SE_INDEX_SHIFT) & AMDGPU_INFO_MMR_SE_INDEX_MASK; - unsigned sh_num = (info->read_mmr_reg.instance >> + unsigned int sh_num = (info->read_mmr_reg.instance >> AMDGPU_INFO_MMR_SH_INDEX_SHIFT) & AMDGPU_INFO_MMR_SH_INDEX_MASK; /* set full masks if the userspace set all bits -* in the bitfields */ +* in the bitfields +*/ if (se_num == AMDGPU_INFO_MMR_SE_INDEX_MASK) se_num = 0x; else if (se_num >= AMDGPU_GFX_MAX_SE) @@ -830,7 +832,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) return ret; } case AMDGPU_INFO_VCE_CLOCK_TABLE: { - unsigned i; + unsigned int i; struct drm_amdgpu_info_vce_clock_table vce_clk_table = {}; struct amd_vce_state *vce_state; @@ -1379,7 +1381,7 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused) int ret, i; static const char *ta_fw_name[TA_FW_TYPE_MAX_INDEX] = { -#define TA_FW_NAME(type) [TA_FW_TYPE_PSP_##type] = #type +#define TA_FW_NAME(type) ([TA_FW_TYPE_PSP_##type] = #type) TA_FW_NAME(XGMI), TA_FW_NAME(RAS), TA_FW_NAME(HDCP), base-commit: e47eb90a0a9ae20b82635b9b99a8d0979b757ad8 -- 2.34.1
Re: [PATCH] drm/amdgpu: cleanup coding style in amdgpu_kms.c
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
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.