ASoC: SOF: Intel: hda-dai: start removing the use of runtime->private_data in BE
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Mon, 24 Oct 2022 16:53:00 +0000 (11:53 -0500)
committerMark Brown <broonie@kernel.org>
Wed, 26 Oct 2022 13:17:58 +0000 (14:17 +0100)
commit0351a9b8f8447935e67b98829c1ad287de426f7e
treea38408ba8eff63243a401dc10d1b6dc5eed5918e
parent33ac4ca758b80421640cb5edb08b531f5be3da20
ASoC: SOF: Intel: hda-dai: start removing the use of runtime->private_data in BE

The SOF HDAudio code stores the Host DMA hdac_stream structure in the
FE substream->runtime->private_data. The BE dailink also uses the
substream->runtime->private_data to allocate the link DMA stream tag.

This really works by accident: the DPCM core copies the FE runtime
information in the BE, which has the side-effect of sharing the
FE-specific private_data with the BE.

To avoid more uses of the private_data with potential issues such as
accessing stale information or use-after-free cases, this patch
removes most of the usages of this private_data at the BE level. We
can directly use the existing dma_data to access the relevant
information.

However the hw_params still uses the information, mainly to go back to
the 'bus' structure required for the link dma stream tag
allocation. This is safe in that the 'bus' is not stream or PCM
specific.

The next patch will completely remove this last use of private_data by
using the component_drvdata - which is how SOF passes a global context
around.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/hda-dai.c