* [PATCH] ASoC: SDCA: fix __leXX types in find_sdca_control_range
@ 2026-06-22 13:42 Ben Dooks
2026-06-22 14:28 ` Charles Keepax
2026-06-22 15:14 ` Charles Keepax
0 siblings, 2 replies; 3+ messages in thread
From: Ben Dooks @ 2026-06-22 13:42 UTC (permalink / raw)
To: Charles Keepax, Maciej Strozek, Bard Liao, Pierre-Louis Bossart,
Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
linux-sound, patches, linux-kernel
Cc: Ben Dooks
The find_sdca_control_range passes u16 and u32 values to the
leXX_to_cpu() functions. Change this type and for the data
loop use the le32_to_cpup() to convert the value using a
pointer.
Fixes the following sparse warnings:
sound/soc/sdca/sdca_functions.c:868:23: warning: cast to restricted __le16
sound/soc/sdca/sdca_functions.c:869:23: warning: cast to restricted __le16
sound/soc/sdca/sdca_functions.c:877:34: warning: cast to restricted __le32
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
sound/soc/sdca/sdca_functions.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c
index 77940bd6b33c..2e0b0ac4fa13 100644
--- a/sound/soc/sdca/sdca_functions.c
+++ b/sound/soc/sdca/sdca_functions.c
@@ -847,7 +847,7 @@ static int find_sdca_control_range(struct device *dev,
{
u8 *range_list;
int num_range;
- u16 *limits;
+ __le16 *limits;
int i;
num_range = fwnode_property_count_u8(control_node, "mipi-sdca-control-range");
@@ -863,7 +863,7 @@ static int find_sdca_control_range(struct device *dev,
fwnode_property_read_u8_array(control_node, "mipi-sdca-control-range",
range_list, num_range);
- limits = (u16 *)range_list;
+ limits = (__le16 *)range_list;
range->cols = le16_to_cpu(limits[0]);
range->rows = le16_to_cpu(limits[1]);
@@ -874,7 +874,7 @@ static int find_sdca_control_range(struct device *dev,
return -EINVAL;
for (i = 0; i < num_range; i++)
- range->data[i] = le32_to_cpu(range->data[i]);
+ le32_to_cpup((__le32 *)&range->data[i]);
return 0;
}
--
2.37.2.352.g3c44437643
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: SDCA: fix __leXX types in find_sdca_control_range
2026-06-22 13:42 [PATCH] ASoC: SDCA: fix __leXX types in find_sdca_control_range Ben Dooks
@ 2026-06-22 14:28 ` Charles Keepax
2026-06-22 15:14 ` Charles Keepax
1 sibling, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2026-06-22 14:28 UTC (permalink / raw)
To: Ben Dooks
Cc: Maciej Strozek, Bard Liao, Pierre-Louis Bossart, Liam Girdwood,
Mark Brown, Jaroslav Kysela, Takashi Iwai, linux-sound, patches,
linux-kernel
On Mon, Jun 22, 2026 at 02:42:47PM +0100, Ben Dooks wrote:
> The find_sdca_control_range passes u16 and u32 values to the
> leXX_to_cpu() functions. Change this type and for the data
> loop use the le32_to_cpup() to convert the value using a
> pointer.
>
> Fixes the following sparse warnings:
> sound/soc/sdca/sdca_functions.c:868:23: warning: cast to restricted __le16
> sound/soc/sdca/sdca_functions.c:869:23: warning: cast to restricted __le16
> sound/soc/sdca/sdca_functions.c:877:34: warning: cast to restricted __le32
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Thanks,
Charles
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: SDCA: fix __leXX types in find_sdca_control_range
2026-06-22 13:42 [PATCH] ASoC: SDCA: fix __leXX types in find_sdca_control_range Ben Dooks
2026-06-22 14:28 ` Charles Keepax
@ 2026-06-22 15:14 ` Charles Keepax
1 sibling, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2026-06-22 15:14 UTC (permalink / raw)
To: Ben Dooks
Cc: Maciej Strozek, Bard Liao, Pierre-Louis Bossart, Liam Girdwood,
Mark Brown, Jaroslav Kysela, Takashi Iwai, linux-sound, patches,
linux-kernel
On Mon, Jun 22, 2026 at 02:42:47PM +0100, Ben Dooks wrote:
> The find_sdca_control_range passes u16 and u32 values to the
> leXX_to_cpu() functions. Change this type and for the data
> loop use the le32_to_cpup() to convert the value using a
> pointer.
>
> Fixes the following sparse warnings:
> sound/soc/sdca/sdca_functions.c:868:23: warning: cast to restricted __le16
> sound/soc/sdca/sdca_functions.c:869:23: warning: cast to restricted __le16
> sound/soc/sdca/sdca_functions.c:877:34: warning: cast to restricted __le32
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> for (i = 0; i < num_range; i++)
> - range->data[i] = le32_to_cpu(range->data[i]);
> + le32_to_cpup((__le32 *)&range->data[i]);
Sorry looking again is this bit right? I think this works because
my system is little endian so this is a no op, but don't you
still need to assign the value here? Or use le32_to_cpus()?
Thanks,
Charles
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-22 15:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-22 13:42 [PATCH] ASoC: SDCA: fix __leXX types in find_sdca_control_range Ben Dooks
2026-06-22 14:28 ` Charles Keepax
2026-06-22 15:14 ` Charles Keepax
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox