summaryrefslogtreecommitdiff
path: root/sound/pci/emu10k1/emu10k1.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2016-11-02 20:38:39 +0300
committerTakashi Iwai <tiwai@suse.de>2016-11-15 10:21:19 +0300
commitaeaa6203b6c41d9add8932dbd95bc741839054d0 (patch)
tree85e5964317663025c33f59b83754dc2958ef35e6 /sound/pci/emu10k1/emu10k1.c
parent4e4dfe4c3fb2888bd96eed629220bd2e7f105f60 (diff)
downloadlinux-aeaa6203b6c41d9add8932dbd95bc741839054d0.tar.xz
ALSA: emu10k1: Use workqueue instead of kthread for emu1010 fw polling
This patch is a cleanup of EMU1010 dock probing code in emu10k1 driver to use work instead of kthread in a loop. The work is lighter and easier to control than kthread, in general. Instead of a loop with the explicit sleep, we do simply delayed-schedule the work. At suspend/resume callbacks, the work is canceled and restarted, respectively. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/emu10k1/emu10k1.c')
-rw-r--r--sound/pci/emu10k1/emu10k1.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index 4733b68c9eb0..6a0e49ac5273 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -194,6 +194,9 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
if ((err = snd_card_register(card)) < 0)
goto error;
+ if (emu->card_capabilities->emu_model)
+ schedule_delayed_work(&emu->emu1010.firmware_work, 0);
+
pci_set_drvdata(pci, card);
dev++;
return 0;
@@ -219,6 +222,8 @@ static int snd_emu10k1_suspend(struct device *dev)
emu->suspend = 1;
+ cancel_delayed_work_sync(&emu->emu1010.firmware_work);
+
snd_pcm_suspend_all(emu->pcm);
snd_pcm_suspend_all(emu->pcm_mic);
snd_pcm_suspend_all(emu->pcm_efx);
@@ -252,6 +257,10 @@ static int snd_emu10k1_resume(struct device *dev)
emu->suspend = 0;
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
+
+ if (emu->card_capabilities->emu_model)
+ schedule_delayed_work(&emu->emu1010.firmware_work, 0);
+
return 0;
}