Re: [PATCH 02/16] ASoC: Intel: avs: Introduce helper functions for SSP and TDM handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/11/2023 2:16 PM, Amadeusz Sławiński wrote:
In quite a few places in code there are checks for number of SSPs
present on system, to reduce maintenance burden introduce helper
functions allowing to get SSP and TDM from machine board configuration.

Additionally in boards we use SSP and TDM to generate quite a few
strings, it could be done like:
if (tdms)
	dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d:%d-Codec",
		ssp_port, tdm_slot);
else
	dl->name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-Codec",
		ssp_port);

but quite quickly code ends up with spaghetti of similar if elses.
Instead introduce macro which can be used to generate correct string,
allowing to minimize code to something like:
dl->name = devm_kasprintf(dev, GFP_KERNEL, AVS_STRING_FMT("SSP", "-Codec",
		ssp_port, tdm_slot));

Reviewed-by: Cezary Rojewski <cezary.rojewski@xxxxxxxxx>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@xxxxxxxxxxxxxxx>

And apparently we didn't catch that functions in header should be static, which leads to linking problems when everything is built-in, I will send v2 tomorrow.



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux