2022-03-09 01:07:40

by CGEL

[permalink] [raw]
Subject: [PATCH] drm/i915/vlv_dsi_pll: use min_t() to make code cleaner

From: Changcheng Deng <[email protected]>

Use min_t() in order to make code cleaner.

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: Changcheng Deng <[email protected]>
---
drivers/gpu/drm/i915/display/vlv_dsi_pll.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/vlv_dsi_pll.c b/drivers/gpu/drm/i915/display/vlv_dsi_pll.c
index df880f44700a..f801f7ec3f9a 100644
--- a/drivers/gpu/drm/i915/display/vlv_dsi_pll.c
+++ b/drivers/gpu/drm/i915/display/vlv_dsi_pll.c
@@ -393,10 +393,7 @@ static void glk_dsi_program_esc_clock(struct drm_device *dev,
/* Calculate TXESC2 divider */
div2_value = DIV_ROUND_UP(div1_value, txesc1_div);

- if (div2_value < 10)
- txesc2_div = div2_value;
- else
- txesc2_div = 10;
+ txesc2_div = min_t(u32, div2_value, 10);

intel_de_write(dev_priv, MIPIO_TXESC_CLK_DIV1,
(1 << (txesc1_div - 1)) & GLK_TX_ESC_CLK_DIV1_MASK);
--
2.25.1


2022-03-09 12:23:38

by Jani Nikula

[permalink] [raw]
Subject: Re: [PATCH] drm/i915/vlv_dsi_pll: use min_t() to make code cleaner

On Tue, 08 Mar 2022, [email protected] wrote:
> From: Changcheng Deng <[email protected]>
>
> Use min_t() in order to make code cleaner.
>
> Reported-by: Zeal Robot <[email protected]>
> Signed-off-by: Changcheng Deng <[email protected]>

Thanks, pushed to drm-intel-next.

BR,
Jani.

> ---
> drivers/gpu/drm/i915/display/vlv_dsi_pll.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/vlv_dsi_pll.c b/drivers/gpu/drm/i915/display/vlv_dsi_pll.c
> index df880f44700a..f801f7ec3f9a 100644
> --- a/drivers/gpu/drm/i915/display/vlv_dsi_pll.c
> +++ b/drivers/gpu/drm/i915/display/vlv_dsi_pll.c
> @@ -393,10 +393,7 @@ static void glk_dsi_program_esc_clock(struct drm_device *dev,
> /* Calculate TXESC2 divider */
> div2_value = DIV_ROUND_UP(div1_value, txesc1_div);
>
> - if (div2_value < 10)
> - txesc2_div = div2_value;
> - else
> - txesc2_div = 10;
> + txesc2_div = min_t(u32, div2_value, 10);
>
> intel_de_write(dev_priv, MIPIO_TXESC_CLK_DIV1,
> (1 << (txesc1_div - 1)) & GLK_TX_ESC_CLK_DIV1_MASK);

--
Jani Nikula, Intel Open Source Graphics Center