]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
firmware: cs_dsp: Store control length as 32-bit
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Mon, 24 Nov 2025 17:15:35 +0000 (17:15 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 24 Nov 2025 19:15:19 +0000 (19:15 +0000)
The architectures supported by this driver have a maximum of 32-bits
of address, so we don't need more than 32-bits to store the length of
control data. Change the length in struct cs_dsp_coeff_ctl to an
unsigned int instead of a size_t. Also make a corresponding trivial
change to wm_adsp.c to prevent a compiler warning.

Tested on x86_64 builds this saves at least 4 bytes per control
(another 4 bytes might be saved if the compiler was inserting padding
to align the size_t).

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20251124171536.78962-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/firmware/cirrus/cs_dsp.c
include/linux/firmware/cirrus/cs_dsp.h
sound/soc/codecs/wm_adsp.c

index 9acdcd75928a905a3a9ec14a1aac1161f6086ede..36a5aefa16e789f3490191f5b510ccbfdb04f4aa 100644 (file)
@@ -477,7 +477,7 @@ static int cs_dsp_debugfs_read_controls_show(struct seq_file *s, void *ignored)
 
        list_for_each_entry(ctl, &dsp->ctl_list, list) {
                cs_dsp_coeff_base_reg(ctl, &reg, 0);
-               seq_printf(s, "%22.*s: %#8zx %s:%08x %#8x %s %#8x %#4x %c%c%c%c %s %s\n",
+               seq_printf(s, "%22.*s: %#8x %s:%08x %#8x %s %#8x %#4x %c%c%c%c %s %s\n",
                           ctl->subname_len, ctl->subname, ctl->len,
                           cs_dsp_mem_region_name(ctl->alg_region.type),
                           ctl->offset, reg, ctl->fw_name, ctl->alg_region.alg, ctl->type,
index 69959032f8f51e375e87471720d10232b824d187..0ec1cdc5585d25a11ff9c3250b00a710663571d1 100644 (file)
@@ -102,7 +102,7 @@ struct cs_dsp_coeff_ctl {
        const char *subname;
        unsigned int subname_len;
        unsigned int offset;
-       size_t len;
+       unsigned int len;
        unsigned int type;
        unsigned int flags;
        unsigned int set:1;
index 172dcdd7dbca01bc2199aaaa61abce9d855622a9..17cec79245d437927842cf03702649caeed32e83 100644 (file)
@@ -1561,7 +1561,7 @@ static int wm_adsp_buffer_parse_coeff(struct cs_dsp_coeff_ctl *cs_ctl)
 
        for (i = 0; i < 5; ++i) {
                ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, &coeff_v1,
-                                            min(cs_ctl->len, sizeof(coeff_v1)));
+                                            min((size_t)cs_ctl->len, sizeof(coeff_v1)));
                if (ret < 0)
                        return ret;