aboutsummaryrefslogtreecommitdiff
path: root/sound/soc/intel/boards/sof_sdw.c
diff options
context:
space:
mode:
authorGravatar Charles Keepax <ckeepax@opensource.cirrus.com> 2023-09-15 15:56:08 +0800
committerGravatar Mark Brown <broonie@kernel.org> 2023-09-15 13:27:24 +0100
commitfc46ecf34782c0d3ec8224ce6003a2631f8a93f1 (patch)
treee3808f91231e4809abfc5794eae2c8d7f0b7209f /sound/soc/intel/boards/sof_sdw.c
parentASoC: SOF: ipc4-topology: Add deep buffer size to debug prints (diff)
downloadlinux-fc46ecf34782c0d3ec8224ce6003a2631f8a93f1.tar.gz
linux-fc46ecf34782c0d3ec8224ce6003a2631f8a93f1.tar.bz2
linux-fc46ecf34782c0d3ec8224ce6003a2631f8a93f1.zip
ASoC: intel: sof_sdw: Move sdw_pin_index into private struct
Whilst it should not cause any issues as only a single instance of the machine will be instantiated, it is still slightly better practice to keep working data in the private data structure, rather than a global variable. Move sdw_pin_index into the mc_private structure. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230915075611.1619548-2-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/boards/sof_sdw.c')
-rw-r--r--sound/soc/intel/boards/sof_sdw.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index 961241100012..eaecdb75686c 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -22,11 +22,6 @@ MODULE_PARM_DESC(quirk, "Board-specific quirk override");
#define INC_ID(BE, CPU, LINK) do { (BE)++; (CPU)++; (LINK)++; } while (0)
-#define SDW_MAX_LINKS 4
-
-/* To store SDW Pin index for each SoundWire link */
-static unsigned int sdw_pin_index[SDW_MAX_LINKS];
-
static void log_quirks(struct device *dev)
{
if (SOF_JACK_JDSRC(sof_sdw_quirk))
@@ -1331,6 +1326,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index,
int adr_index,
int dai_index)
{
+ struct mc_private *ctx = snd_soc_card_get_drvdata(card);
struct device *dev = card->dev;
const struct snd_soc_acpi_link_adr *adr_link_next;
struct snd_soc_dai_link_component *codecs;
@@ -1452,7 +1448,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index,
for (k = 0; k < cpu_dai_num; k++) {
cpu_name = devm_kasprintf(dev, GFP_KERNEL,
"SDW%d Pin%d", cpu_dai_id[k],
- sdw_pin_index[cpu_dai_id[k]]++);
+ ctx->sdw_pin_index[cpu_dai_id[k]]++);
if (!cpu_name)
return -ENOMEM;
@@ -1600,7 +1596,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
goto SSP;
for (i = 0; i < SDW_MAX_LINKS; i++)
- sdw_pin_index[i] = SDW_INTEL_BIDIR_PDI_BASE;
+ ctx->sdw_pin_index[i] = SDW_INTEL_BIDIR_PDI_BASE;
for (; adr_link->num_adr; adr_link++) {
/*