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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user