diff mbox series

[v2,06/10] drm/imx/dcss: Fix 64bit divisions

Message ID 20241003111851.10453-7-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm: Increase COMPILE_TEST=y coverage | expand

Commit Message

Ville Syrjälä Oct. 3, 2024, 11:18 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Use the appropriate 64bit division helpers to make the code
build on 32bit architectures.

Cc: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/imx/dcss/dcss-scaler.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Laurentiu Palcu Oct. 4, 2024, 11:39 a.m. UTC | #1
Hi,

On Thu, Oct 03, 2024 at 02:18:47PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Use the appropriate 64bit division helpers to make the code
> build on 32bit architectures.
> 
> Cc: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>

Thanks,
Laurentiu

> ---
>  drivers/gpu/drm/imx/dcss/dcss-scaler.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/imx/dcss/dcss-scaler.c b/drivers/gpu/drm/imx/dcss/dcss-scaler.c
> index 825728c356ff..32c3f46b21da 100644
> --- a/drivers/gpu/drm/imx/dcss/dcss-scaler.c
> +++ b/drivers/gpu/drm/imx/dcss/dcss-scaler.c
> @@ -136,7 +136,7 @@ static int div_q(int A, int B)
>  	else
>  		temp -= B / 2;
>  
> -	result = (int)(temp / B);
> +	result = div_s64(temp, B);
>  	return result;
>  }
>  
> @@ -239,7 +239,7 @@ static void dcss_scaler_gaussian_filter(int fc_q, bool use_5_taps,
>  			ll_temp = coef[phase][i];
>  			ll_temp <<= PSC_COEFF_PRECISION;
>  			ll_temp += sum >> 1;
> -			ll_temp /= sum;
> +			ll_temp = div_s64(ll_temp, sum);
>  			coef[phase][i] = (int)ll_temp;
>  		}
>  	}
> -- 
> 2.45.2
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/imx/dcss/dcss-scaler.c b/drivers/gpu/drm/imx/dcss/dcss-scaler.c
index 825728c356ff..32c3f46b21da 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-scaler.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-scaler.c
@@ -136,7 +136,7 @@  static int div_q(int A, int B)
 	else
 		temp -= B / 2;
 
-	result = (int)(temp / B);
+	result = div_s64(temp, B);
 	return result;
 }
 
@@ -239,7 +239,7 @@  static void dcss_scaler_gaussian_filter(int fc_q, bool use_5_taps,
 			ll_temp = coef[phase][i];
 			ll_temp <<= PSC_COEFF_PRECISION;
 			ll_temp += sum >> 1;
-			ll_temp /= sum;
+			ll_temp = div_s64(ll_temp, sum);
 			coef[phase][i] = (int)ll_temp;
 		}
 	}