mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 07:38:10 +00:00
ASoC: Intel: avs: Use asoc_substream_to_rtd() to obtain rtd
Utilize the helper function instead of casting from ->private_data or snd_pcm_substream_chip() directly. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Link: https://lore.kernel.org/r/20230113191410.1454566-1-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
5eab926575
commit
8f28299f5c
3 changed files with 17 additions and 17 deletions
|
@ -98,7 +98,7 @@ static int avs_rt286_be_fixup(struct snd_soc_pcm_runtime *runtime, struct snd_pc
|
|||
static int
|
||||
avs_rt286_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *runtime = substream->private_data;
|
||||
struct snd_soc_pcm_runtime *runtime = asoc_substream_to_rtd(substream);
|
||||
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(runtime, 0);
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ static int avs_rt298_be_fixup(struct snd_soc_pcm_runtime *runtime, struct snd_pc
|
|||
static int
|
||||
avs_rt298_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
|
||||
unsigned int clk_freq;
|
||||
int ret;
|
||||
|
|
|
@ -60,7 +60,7 @@ avs_dai_find_path_template(struct snd_soc_dai *dai, bool is_fe, int direction)
|
|||
static int avs_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai, bool is_fe,
|
||||
const struct snd_soc_dai_ops *ops)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct avs_dev *adev = to_avs_dev(dai->dev);
|
||||
struct avs_tplg_path_template *template;
|
||||
struct avs_dma_data *data;
|
||||
|
@ -169,7 +169,7 @@ static int avs_dai_nonhda_be_startup(struct snd_pcm_substream *substream, struct
|
|||
|
||||
static void avs_dai_nonhda_be_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct avs_dev *adev = to_avs_dev(dai->dev);
|
||||
struct avs_dma_data *data;
|
||||
|
||||
|
@ -218,7 +218,7 @@ static int avs_dai_nonhda_be_prepare(struct snd_pcm_substream *substream, struct
|
|||
static int avs_dai_nonhda_be_trigger(struct snd_pcm_substream *substream, int cmd,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct avs_dma_data *data;
|
||||
int ret = 0;
|
||||
|
||||
|
@ -305,7 +305,7 @@ static int avs_dai_hda_be_hw_params(struct snd_pcm_substream *substream,
|
|||
static int avs_dai_hda_be_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct avs_dma_data *data;
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct hdac_ext_stream *link_stream;
|
||||
struct hdac_ext_link *link;
|
||||
struct hda_codec *codec;
|
||||
|
@ -335,7 +335,7 @@ static int avs_dai_hda_be_hw_free(struct snd_pcm_substream *substream, struct sn
|
|||
|
||||
static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct hdac_ext_stream *link_stream = runtime->private_data;
|
||||
struct hdac_ext_link *link;
|
||||
|
@ -374,7 +374,7 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn
|
|||
static int avs_dai_hda_be_trigger(struct snd_pcm_substream *substream, int cmd,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct hdac_ext_stream *link_stream;
|
||||
struct avs_dma_data *data;
|
||||
int ret = 0;
|
||||
|
@ -489,7 +489,7 @@ static int avs_dai_fe_startup(struct snd_pcm_substream *substream, struct snd_so
|
|||
|
||||
static void avs_dai_fe_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct avs_dev *adev = to_avs_dev(dai->dev);
|
||||
struct avs_dma_data *data;
|
||||
|
||||
|
@ -628,7 +628,7 @@ static int avs_dai_fe_prepare(struct snd_pcm_substream *substream, struct snd_so
|
|||
|
||||
static int avs_dai_fe_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct avs_dma_data *data;
|
||||
struct hdac_ext_stream *host_stream;
|
||||
struct hdac_bus *bus;
|
||||
|
@ -836,7 +836,7 @@ static int avs_dai_resume_hw_params(struct snd_soc_dai *dai, struct avs_dma_data
|
|||
int ret;
|
||||
|
||||
substream = data->substream;
|
||||
rtd = snd_pcm_substream_chip(substream);
|
||||
rtd = asoc_substream_to_rtd(substream);
|
||||
|
||||
ret = dai->driver->ops->hw_params(substream, &rtd->dpcm[substream->stream].hw_params, dai);
|
||||
if (ret)
|
||||
|
@ -931,7 +931,7 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be,
|
|||
for_each_component_dais(component, dai) {
|
||||
data = dai->playback_dma_data;
|
||||
if (data) {
|
||||
rtd = snd_pcm_substream_chip(data->substream);
|
||||
rtd = asoc_substream_to_rtd(data->substream);
|
||||
if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) {
|
||||
ret = op(dai, data);
|
||||
if (ret < 0) {
|
||||
|
@ -944,7 +944,7 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be,
|
|||
|
||||
data = dai->capture_dma_data;
|
||||
if (data) {
|
||||
rtd = snd_pcm_substream_chip(data->substream);
|
||||
rtd = asoc_substream_to_rtd(data->substream);
|
||||
if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) {
|
||||
ret = op(dai, data);
|
||||
if (ret < 0) {
|
||||
|
@ -1048,7 +1048,7 @@ static const struct snd_pcm_hardware avs_pcm_hardware = {
|
|||
static int avs_component_open(struct snd_soc_component *component,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
|
||||
/* only FE DAI links are handled here */
|
||||
if (rtd->dai_link->no_pcm)
|
||||
|
@ -1066,7 +1066,7 @@ static unsigned int avs_hda_stream_dpib_read(struct hdac_ext_stream *stream)
|
|||
static snd_pcm_uframes_t
|
||||
avs_component_pointer(struct snd_soc_component *component, struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct avs_dma_data *data;
|
||||
struct hdac_ext_stream *host_stream;
|
||||
unsigned int pos;
|
||||
|
@ -1394,7 +1394,7 @@ static void avs_component_hda_remove(struct snd_soc_component *component)
|
|||
static int avs_component_hda_open(struct snd_soc_component *component,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct hdac_ext_stream *link_stream;
|
||||
struct hda_codec *codec;
|
||||
|
||||
|
@ -1441,7 +1441,7 @@ static int avs_component_hda_open(struct snd_soc_component *component,
|
|||
static int avs_component_hda_close(struct snd_soc_component *component,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||
struct hdac_ext_stream *link_stream;
|
||||
|
||||
/* only BE DAI links are handled here */
|
||||
|
|
Loading…
Reference in a new issue