@@ -169,6 +169,7 @@ struct ak4114 {
ak4114_read_t * read;
void * private_data;
unsigned int init: 1;
+ bool in_workq;
spinlock_t lock;
unsigned char regmap[6];
unsigned char txcsb[5];
@@ -152,9 +152,11 @@ static void ak4114_init_regs(struct ak4114 *chip)
void snd_ak4114_reinit(struct ak4114 *chip)
{
+ if (chip->in_workq)
+ return;
chip->init = 1;
mb();
- flush_delayed_work(&chip->work);
+ cancel_delayed_work_sync(&chip->work);
ak4114_init_regs(chip);
/* bring up statistics / event queing */
chip->init = 0;
@@ -612,10 +614,12 @@ static void ak4114_stats(struct work_struct *work)
{
struct ak4114 *chip = container_of(work, struct ak4114, work.work);
- if (!chip->init)
+ chip->in_workq = true;
+ if (!chip->init) {
snd_ak4114_check_rate_and_errors(chip, chip->check_flags);
-
- schedule_delayed_work(&chip->work, HZ / 10);
+ schedule_delayed_work(&chip->work, HZ / 10);
+ }
+ chip->in_workq = false;
}
EXPORT_SYMBOL(snd_ak4114_create);