Skip to content

Commit

Permalink
ASoC: move setting ac97 platformdata earlier than ac97 read/write
Browse files Browse the repository at this point in the history
While probing, AC97 codec drivers and soc-core generically execute the
following sequence:
snd_soc_new_ac97_codec -> snd_soc_new_pcms -> reset ac-link/read AC97 ID
to detect ->...  -> set platform_data to ac97 by soc-core

commit 474828a adds platform_data to
snd_ac97 instance. But ac97 platform data hasn't given to snd_ac97
before actual ac97 operations. Then while ac97_read access platform_data
of snd_ac97 for detecting, NULL pointer oops will fire. That means old
platform_data patch doesn't work in real-life cases.

This patch moves the operation of setting ac97 platform_data earlier
than ac97 reading/writing operations. Then it makes platform_data of
AC97 become practically useful.

Signed-off-by: Barry Song <21cnbao@gmail.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Barry Song authored and Mark Brown committed Nov 12, 2009
1 parent ba2b87f commit f773205
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,11 +1083,8 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
continue;
}
}
if (card->dai_link[i].codec_dai->ac97_control) {
if (card->dai_link[i].codec_dai->ac97_control)
ac97 = 1;
snd_ac97_dev_add_pdata(codec->ac97,
card->dai_link[i].cpu_dai->ac97_pdata);
}
}

snprintf(codec->card->shortname, sizeof(codec->card->shortname),
Expand Down Expand Up @@ -1510,6 +1507,10 @@ int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid)
mutex_unlock(&codec->mutex);
return ret;
}
if (card->dai_link[i].codec_dai->ac97_control) {
snd_ac97_dev_add_pdata(codec->ac97,
card->dai_link[i].cpu_dai->ac97_pdata);
}
}

mutex_unlock(&codec->mutex);
Expand Down

0 comments on commit f773205

Please sign in to comment.