drm/amdgpu: Fix minmax warning
authorjsg <jsg@openbsd.org>
Wed, 26 Jul 2023 06:19:33 +0000 (06:19 +0000)
committerjsg <jsg@openbsd.org>
Wed, 26 Jul 2023 06:19:33 +0000 (06:19 +0000)
From Luben Tuikov
e8b6b7b8132500ecb241f7f685398028017ec0d3 in linux-6.1.y/6.1.40
abd51738fe754a684ec44b7a9eca1981e1704ad9 in mainline linux

sys/dev/pci/drm/amd/pm/swsmu/smu13/smu_v13_0.c

index a72fa30..1b59063 100644 (file)
@@ -1441,7 +1441,9 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,
                        case 0x8:
                                high = smu->thermal_range.software_shutdown_temp +
                                        smu->thermal_range.software_shutdown_temp_offset;
-                               high = min(SMU_THERMAL_MAXIMUM_ALERT_TEMP, high);
+                               high = min_t(typeof(high),
+                                            SMU_THERMAL_MAXIMUM_ALERT_TEMP,
+                                            high);
                                dev_emerg(adev->dev, "Reduce soft CTF limit to %d (by an offset %d)\n",
                                                        high,
                                                        smu->thermal_range.software_shutdown_temp_offset);
@@ -1454,8 +1456,9 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev,
                                WREG32_SOC15(THM, 0, regTHM_THERMAL_INT_CTRL, data);
                                break;
                        case 0x9:
-                               high = min(SMU_THERMAL_MAXIMUM_ALERT_TEMP,
-                                       smu->thermal_range.software_shutdown_temp);
+                               high = min_t(typeof(high),
+                                            SMU_THERMAL_MAXIMUM_ALERT_TEMP,
+                                            smu->thermal_range.software_shutdown_temp);
                                dev_emerg(adev->dev, "Recover soft CTF limit to %d\n", high);
 
                                data = RREG32_SOC15(THM, 0, regTHM_THERMAL_INT_CTRL);