diff options
author | Jia-Ju Bai <baijiaju1990@gmail.com> | 2018-04-09 16:03:38 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-04-16 14:49:09 +0300 |
commit | 1fa350b6e1a14edaeeb4e4f84010f5b0c53d2915 (patch) | |
tree | 3d5e6b14999bcd06be47fac77ab5f45582db3beb /sound | |
parent | 621fdf60ab22dd902d52a670e943371400b4ee20 (diff) | |
download | linux-1fa350b6e1a14edaeeb4e4f84010f5b0c53d2915.tar.xz |
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: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/ad1889.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index d4965ebe967f..d9c54c08e2db 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -258,7 +258,7 @@ snd_ad1889_ac97_ready(struct snd_ad1889 *chip) while (!(ad1889_readw(chip, AD_AC97_ACIC) & AD_AC97_ACIC_ACRDY) && --retry) - mdelay(1); + usleep_range(1000, 2000); if (!retry) { dev_err(chip->card->dev, "[%s] Link is not ready.\n", __func__); |