Skip to contentSkip to conversation

ASoC: codecs: Use ARRAY_SIZE() to calculate PEB2466_TLV_SIZE

PATCH In review Thorsten Blum 3 participants 3 messages Jan 13, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: codecs: Use ARRAY_SIZE() to calculate PEB2466_TLV_SIZE

Use the ARRAY_SIZE() macro to calculate PEB2466_TLV_SIZE and improve the code's readability.

---
 sound/soc/codecs/peb2466.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/peb2466.c +1 -2
index bb9ca6354ae1..a989cfe058f0 100644
@@ -26,8 +26,7 @@ struct peb2466_lookup {
 	unsigned int count;
 };
 
-#define PEB2466_TLV_SIZE  (sizeof((unsigned int []){TLV_DB_SCALE_ITEM(0, 0, 0)}) / \
-			   sizeof(unsigned int))
+#define PEB2466_TLV_SIZE ARRAY_SIZE(((unsigned int[]){TLV_DB_SCALE_ITEM(0, 0, 0)}))
 
 struct peb2466_lkup_ctrl {
 	int reg;
Signature · 1 line
2.47.1
maintainer Acked-by on v1 1/1
#1 lore raw

Hi Thorsten,

Quoted 13 lines · On Mon, 13 Jan 2025 01:10:01 +0100 Thorsten Blum <[email protected]>…

Use the ARRAY_SIZE() macro to calculate PEB2466_TLV_SIZE and improve the code's readability.

---
 sound/soc/codecs/peb2466.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/peb2466.c +0 -0
index bb9ca6354ae1..a989cfe058f0 100644

sound/soc/codecs/peb2466.c struct peb2466_lookup { · line 32

Quoted 9 lines
sound/soc/codecs/peb2466.c +1 -2
@@ -26,8 +26,7 @@ struct peb2466_lookup {
 	unsigned int count;
 };
 
-#define PEB2466_TLV_SIZE  (sizeof((unsigned int []){TLV_DB_SCALE_ITEM(0, 0, 0)}) / \
-			   sizeof(unsigned int))
+#define PEB2466_TLV_SIZE ARRAY_SIZE(((unsigned int[]){TLV_DB_SCALE_ITEM(0, 0, 0)}))
 
 struct peb2466_lkup_ctrl {
 	int reg;

Best regards,
Hervé

maintainer
#2 lore raw
In reply to Thorsten Blum
Quoted 4 lines · Thorsten Blum

Use the ARRAY_SIZE() macro to calculate PEB2466_TLV_SIZE and improve the code's readability.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codecs: Use ARRAY_SIZE() to calculate PEB2466_TLV_SIZE

      commit: 8eb27b5758e6fb6d1881413e3f1159c579ac48b3

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark