Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

firmware: cs_dsp: Store control length as 32-bit

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>

authored by

Richard Fitzgerald and committed by
Mark Brown
7584edf1 172e2218

+3 -3
+1 -1
drivers/firmware/cirrus/cs_dsp.c
··· 477 477 478 478 list_for_each_entry(ctl, &dsp->ctl_list, list) { 479 479 cs_dsp_coeff_base_reg(ctl, &reg, 0); 480 - seq_printf(s, "%22.*s: %#8zx %s:%08x %#8x %s %#8x %#4x %c%c%c%c %s %s\n", 480 + seq_printf(s, "%22.*s: %#8x %s:%08x %#8x %s %#8x %#4x %c%c%c%c %s %s\n", 481 481 ctl->subname_len, ctl->subname, ctl->len, 482 482 cs_dsp_mem_region_name(ctl->alg_region.type), 483 483 ctl->offset, reg, ctl->fw_name, ctl->alg_region.alg, ctl->type,
+1 -1
include/linux/firmware/cirrus/cs_dsp.h
··· 102 102 const char *subname; 103 103 unsigned int subname_len; 104 104 unsigned int offset; 105 - size_t len; 105 + unsigned int len; 106 106 unsigned int type; 107 107 unsigned int flags; 108 108 unsigned int set:1;
+1 -1
sound/soc/codecs/wm_adsp.c
··· 1561 1561 1562 1562 for (i = 0; i < 5; ++i) { 1563 1563 ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, &coeff_v1, 1564 - min(cs_ctl->len, sizeof(coeff_v1))); 1564 + min((size_t)cs_ctl->len, sizeof(coeff_v1))); 1565 1565 if (ret < 0) 1566 1566 return ret; 1567 1567