Commit 4014c38b authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] ak4114 - Use global workqueue

Use global workqueue for simplicity instead of own workqueue.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent e250af29
...@@ -181,7 +181,6 @@ struct ak4114 { ...@@ -181,7 +181,6 @@ struct ak4114 {
unsigned long ccrc_errors; unsigned long ccrc_errors;
unsigned char rcs0; unsigned char rcs0;
unsigned char rcs1; unsigned char rcs1;
struct workqueue_struct *workqueue;
struct delayed_work work; struct delayed_work work;
void *change_callback_private; void *change_callback_private;
void (*change_callback)(struct ak4114 *ak4114, unsigned char c0, unsigned char c1); void (*change_callback)(struct ak4114 *ak4114, unsigned char c0, unsigned char c1);
......
...@@ -66,10 +66,7 @@ static void snd_ak4114_free(struct ak4114 *chip) ...@@ -66,10 +66,7 @@ static void snd_ak4114_free(struct ak4114 *chip)
{ {
chip->init = 1; /* don't schedule new work */ chip->init = 1; /* don't schedule new work */
mb(); mb();
if (chip->workqueue != NULL) { flush_scheduled_work();
flush_workqueue(chip->workqueue);
destroy_workqueue(chip->workqueue);
}
kfree(chip); kfree(chip);
} }
...@@ -106,12 +103,6 @@ int snd_ak4114_create(struct snd_card *card, ...@@ -106,12 +103,6 @@ int snd_ak4114_create(struct snd_card *card,
for (reg = 0; reg < 5; reg++) for (reg = 0; reg < 5; reg++)
chip->txcsb[reg] = txcsb[reg]; chip->txcsb[reg] = txcsb[reg];
chip->workqueue = create_workqueue("snd-ak4114");
if (chip->workqueue == NULL) {
kfree(chip);
return -ENOMEM;
}
snd_ak4114_reinit(chip); snd_ak4114_reinit(chip);
chip->rcs0 = reg_read(chip, AK4114_REG_RCS0) & ~(AK4114_QINT | AK4114_CINT); chip->rcs0 = reg_read(chip, AK4114_REG_RCS0) & ~(AK4114_QINT | AK4114_CINT);
...@@ -143,7 +134,7 @@ void snd_ak4114_reinit(struct ak4114 *chip) ...@@ -143,7 +134,7 @@ void snd_ak4114_reinit(struct ak4114 *chip)
chip->init = 1; chip->init = 1;
mb(); mb();
flush_workqueue(chip->workqueue); flush_scheduled_work();
/* bring the chip to reset state and powerdown state */ /* bring the chip to reset state and powerdown state */
reg_write(chip, AK4114_REG_PWRDN, old & ~(AK4114_RST|AK4114_PWN)); reg_write(chip, AK4114_REG_PWRDN, old & ~(AK4114_RST|AK4114_PWN));
udelay(200); udelay(200);
...@@ -159,7 +150,7 @@ void snd_ak4114_reinit(struct ak4114 *chip) ...@@ -159,7 +150,7 @@ void snd_ak4114_reinit(struct ak4114 *chip)
/* bring up statistics / event queing */ /* bring up statistics / event queing */
chip->init = 0; chip->init = 0;
INIT_DELAYED_WORK(&chip->work, ak4114_stats); INIT_DELAYED_WORK(&chip->work, ak4114_stats);
queue_delayed_work(chip->workqueue, &chip->work, HZ / 10); schedule_delayed_work(&chip->work, HZ / 10);
} }
static unsigned int external_rate(unsigned char rcs1) static unsigned int external_rate(unsigned char rcs1)
...@@ -568,7 +559,7 @@ static void ak4114_stats(struct work_struct *work) ...@@ -568,7 +559,7 @@ static void ak4114_stats(struct work_struct *work)
if (chip->init) if (chip->init)
return; return;
snd_ak4114_check_rate_and_errors(chip, 0); snd_ak4114_check_rate_and_errors(chip, 0);
queue_delayed_work(chip->workqueue, &chip->work, HZ / 10); schedule_delayed_work(&chip->work, HZ / 10);
} }
EXPORT_SYMBOL(snd_ak4114_create); EXPORT_SYMBOL(snd_ak4114_create);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment