drm/amdgpu: Update min() to min_t() in 'amdgpu_info_ioctl'
authorjsg <jsg@openbsd.org>
Wed, 13 Sep 2023 12:53:38 +0000 (12:53 +0000)
committerjsg <jsg@openbsd.org>
Wed, 13 Sep 2023 12:53:38 +0000 (12:53 +0000)
From Srinivasan Shanmugam
8dcc23191a6d2181855422741d73a96d91526c87 in linux-6.1.y/6.1.53
a0cc8e1512ad72c9f97cdcb76d42715730adaf62 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_kms.c

index e8ae81b..85b69a0 100644 (file)
@@ -558,6 +558,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;
@@ -576,7 +577,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: {
@@ -722,17 +723,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 = 0xffffffff;
                else if (se_num >= AMDGPU_GFX_MAX_SE)
@@ -856,7 +858,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;