diff mbox series

[12/16] iio: max44009: Fix type incompatibility with non-macro find_closest

Message ID 20250515081332.151250-13-asoponar@taladin.ro
State New
Headers show
Series lib: Refactor find_closest() and find_closest_descending() from macros to lib functions | expand

Commit Message

Alexandru Soponar May 15, 2025, 8:13 a.m. UTC
The max44009_int_time_ns_array array was previously declared as u32 but
used with find_closest(). With find_closest() now implemented as a
function taking signed int parameters instead of a macro, passing unsigned
arrays causes type incompatibility errors. This patch changes the arrays
type from u32 to int to ensure compatibility with the function signature
and prevent compilation errors.

Signed-off-by: Alexandru Soponar <asoponar@taladin.ro>
---
 drivers/iio/light/max44009.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron May 15, 2025, 5:14 p.m. UTC | #1
On Thu, 15 May 2025 11:13:28 +0300
Alexandru Soponar <asoponar@taladin.ro> wrote:

> The max44009_int_time_ns_array array was previously declared as u32 but
> used with find_closest(). With find_closest() now implemented as a
> function taking signed int parameters instead of a macro, passing unsigned
> arrays causes type incompatibility errors. This patch changes the arrays
> type from u32 to int to ensure compatibility with the function signature
> and prevent compilation errors.
> 
> Signed-off-by: Alexandru Soponar <asoponar@taladin.ro>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/iio/light/max44009.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/light/max44009.c b/drivers/iio/light/max44009.c
> index 8cd7f5664e5b..d274224fc210 100644
> --- a/drivers/iio/light/max44009.c
> +++ b/drivers/iio/light/max44009.c
> @@ -55,7 +55,7 @@
>  /* The fixed-point fractional multiplier for de-scaling threshold values */
>  #define MAX44009_FRACT_MULT 1000000
>  
> -static const u32 max44009_int_time_ns_array[] = {
> +static const int max44009_int_time_ns_array[] = {
>  	800000000,
>  	400000000,
>  	200000000,
diff mbox series

Patch

diff --git a/drivers/iio/light/max44009.c b/drivers/iio/light/max44009.c
index 8cd7f5664e5b..d274224fc210 100644
--- a/drivers/iio/light/max44009.c
+++ b/drivers/iio/light/max44009.c
@@ -55,7 +55,7 @@ 
 /* The fixed-point fractional multiplier for de-scaling threshold values */
 #define MAX44009_FRACT_MULT 1000000
 
-static const u32 max44009_int_time_ns_array[] = {
+static const int max44009_int_time_ns_array[] = {
 	800000000,
 	400000000,
 	200000000,