提交 1fa350b6 编写于 作者: J Jia-Ju Bai 提交者: Takashi Iwai

ALSA: ad1889: Replace mdelay with usleep_range in snd_ad1889_ac97_ready

snd_ad1889_ac97_ready() is never called in atomic context.

The call chain ending up at snd_ad1889_ac97_ready() is:
[1] snd_ad1889_ac97_ready() <- snd_ad1889_ac97_xinit() <-
	snd_ad1889_ac97_init() <- snd_ad1889_probe()

snd_ad1889_probe() is only set as ".probe" in struct pci_driver.
This function is not called in atomic context.

Despite never getting called from atomic context, snd_ad1889_ac97_ready()
calls mdelay for busy wait.
This is not necessary and can be replaced with usleep_range to
avoid busy waiting.

This is found by a static analysis tool named DCNS written by myself.
Signed-off-by: NJia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 621fdf60
...@@ -258,7 +258,7 @@ snd_ad1889_ac97_ready(struct snd_ad1889 *chip) ...@@ -258,7 +258,7 @@ snd_ad1889_ac97_ready(struct snd_ad1889 *chip)
while (!(ad1889_readw(chip, AD_AC97_ACIC) & AD_AC97_ACIC_ACRDY) while (!(ad1889_readw(chip, AD_AC97_ACIC) & AD_AC97_ACIC_ACRDY)
&& --retry) && --retry)
mdelay(1); usleep_range(1000, 2000);
if (!retry) { if (!retry) {
dev_err(chip->card->dev, "[%s] Link is not ready.\n", dev_err(chip->card->dev, "[%s] Link is not ready.\n",
__func__); __func__);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册