diff options
| author | Ankit Nautiyal <ankit.k.nautiyal@intel.com> | 2025-06-18 18:39:51 +0530 |
|---|---|---|
| committer | Ankit Nautiyal <ankit.k.nautiyal@intel.com> | 2025-06-19 15:15:22 +0530 |
| commit | 4f9c81d64f030c1f3d96c5fd356cfb6e68ef9fc2 (patch) | |
| tree | c69687cfea596584eb439f6f2e0c71ac1e883403 /drivers/gpu | |
| parent | b300a175a11e6a934d728317dc39787723cc7917 (diff) | |
| download | linux-4f9c81d64f030c1f3d96c5fd356cfb6e68ef9fc2.tar.gz linux-4f9c81d64f030c1f3d96c5fd356cfb6e68ef9fc2.zip | |
drm/i915/snps_hdmi_pll: Use clamp() instead of max(min())
The values of ana_cp_int, and ana_cp_prop are clamped between 1 and 127.
Use the more intuitive and readable clamp() macro instead of using
nested max(min(...)).
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://lore.kernel.org/r/20250618130951.1596587-3-ankit.k.nautiyal@intel.com
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/i915/display/intel_snps_hdmi_pll.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_snps_hdmi_pll.c b/drivers/gpu/drm/i915/display/intel_snps_hdmi_pll.c index 5111bdc3075b..7fe6b4a18213 100644 --- a/drivers/gpu/drm/i915/display/intel_snps_hdmi_pll.c +++ b/drivers/gpu/drm/i915/display/intel_snps_hdmi_pll.c @@ -106,7 +106,7 @@ static void get_ana_cp_int_prop(u64 vco_clk, DIV64_U64_ROUND_CLOSEST(DIV_ROUND_DOWN_ULL(adjusted_vco_clk1, curve_2_scaled1), CURVE2_MULTIPLIER); - *ana_cp_int = max(1, min(ana_cp_int_temp, 127)); + *ana_cp_int = clamp(ana_cp_int_temp, 1, 127); curve_2_scaled_int = curve_2_scaled1 * (*ana_cp_int); @@ -125,7 +125,7 @@ static void get_ana_cp_int_prop(u64 vco_clk, curve_1_interpolated); *ana_cp_prop = DIV64_U64_ROUND_UP(adjusted_vco_clk2, curve_2_scaled2); - *ana_cp_prop = max(1, min(*ana_cp_prop, 127)); + *ana_cp_prop = clamp(*ana_cp_prop, 1, 127); } static void compute_hdmi_tmds_pll(u64 pixel_clock, u32 refclk, |
