diff mbox series

[11/16] iio: mcp3564: Fix type incompatibility with non-macro find_closest

Message ID 20250515081332.151250-12-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 mcp3564_oversampling_avail array was previously declared as unsigned
int 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 unsigned int to int to ensure compatibility with the
function signature and prevent compilation errors.

Signed-off-by: Alexandru Soponar <asoponar@taladin.ro>
---
 drivers/iio/adc/mcp3564.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:27 +0300
Alexandru Soponar <asoponar@taladin.ro> wrote:

> The mcp3564_oversampling_avail array was previously declared as unsigned
> int 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 unsigned int 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/adc/mcp3564.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/mcp3564.c b/drivers/iio/adc/mcp3564.c
> index a68f1cd6883e..01efc77f710a 100644
> --- a/drivers/iio/adc/mcp3564.c
> +++ b/drivers/iio/adc/mcp3564.c
> @@ -253,7 +253,7 @@ enum mcp3564_oversampling {
>  	MCP3564_OVERSAMPLING_RATIO_98304
>  };
>  
> -static const unsigned int mcp3564_oversampling_avail[] = {
> +static const int mcp3564_oversampling_avail[] = {
>  	[MCP3564_OVERSAMPLING_RATIO_32] = 32,
>  	[MCP3564_OVERSAMPLING_RATIO_64] = 64,
>  	[MCP3564_OVERSAMPLING_RATIO_128] = 128,
marius.cristea@microchip.com May 19, 2025, 8:09 a.m. UTC | #2
On Thu, 2025-05-15 at 11:13 +0300, Alexandru Soponar wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> The mcp3564_oversampling_avail array was previously declared as
> unsigned
> int 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 unsigned int to int to ensure compatibility with the
> function signature and prevent compilation errors.
> 
> Signed-off-by: Alexandru Soponar <asoponar@taladin.ro>

Hi Alexandru,

	Thank you very much for the patch. The patch is OK.

Reviewed-by: Marius Cristea <marius.cristea@microchip.com>


Thanks,
Marius 


> ---
>  drivers/iio/adc/mcp3564.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/mcp3564.c b/drivers/iio/adc/mcp3564.c
> index a68f1cd6883e..01efc77f710a 100644
> --- a/drivers/iio/adc/mcp3564.c
> +++ b/drivers/iio/adc/mcp3564.c
> @@ -253,7 +253,7 @@ enum mcp3564_oversampling {
>         MCP3564_OVERSAMPLING_RATIO_98304
>  };
> 
> -static const unsigned int mcp3564_oversampling_avail[] = {
> +static const int mcp3564_oversampling_avail[] = {
>         [MCP3564_OVERSAMPLING_RATIO_32] = 32,
>         [MCP3564_OVERSAMPLING_RATIO_64] = 64,
>         [MCP3564_OVERSAMPLING_RATIO_128] = 128,
> --
> 2.49.0
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/mcp3564.c b/drivers/iio/adc/mcp3564.c
index a68f1cd6883e..01efc77f710a 100644
--- a/drivers/iio/adc/mcp3564.c
+++ b/drivers/iio/adc/mcp3564.c
@@ -253,7 +253,7 @@  enum mcp3564_oversampling {
 	MCP3564_OVERSAMPLING_RATIO_98304
 };
 
-static const unsigned int mcp3564_oversampling_avail[] = {
+static const int mcp3564_oversampling_avail[] = {
 	[MCP3564_OVERSAMPLING_RATIO_32] = 32,
 	[MCP3564_OVERSAMPLING_RATIO_64] = 64,
 	[MCP3564_OVERSAMPLING_RATIO_128] = 128,