ASoC: codecs: jz4725b: fix capture selector naming
[platform/kernel/linux-rpi.git] / sound / core / timer.c
index 92b7008..e08a37c 100644 (file)
@@ -83,7 +83,7 @@ struct snd_timer_user {
        unsigned int filter;
        struct timespec64 tstamp;               /* trigger tstamp */
        wait_queue_head_t qchange_sleep;
-       struct fasync_struct *fasync;
+       struct snd_fasync *fasync;
        struct mutex ioctl_lock;
 };
 
@@ -624,13 +624,13 @@ static int snd_timer_stop1(struct snd_timer_instance *timeri, bool stop)
        if (!timer)
                return -EINVAL;
        spin_lock_irqsave(&timer->lock, flags);
+       list_del_init(&timeri->ack_list);
+       list_del_init(&timeri->active_list);
        if (!(timeri->flags & (SNDRV_TIMER_IFLG_RUNNING |
                               SNDRV_TIMER_IFLG_START))) {
                result = -EBUSY;
                goto unlock;
        }
-       list_del_init(&timeri->ack_list);
-       list_del_init(&timeri->active_list);
        if (timer->card && timer->card->shutdown)
                goto unlock;
        if (stop) {
@@ -665,23 +665,22 @@ static int snd_timer_stop1(struct snd_timer_instance *timeri, bool stop)
 static int snd_timer_stop_slave(struct snd_timer_instance *timeri, bool stop)
 {
        unsigned long flags;
+       bool running;
 
        spin_lock_irqsave(&slave_active_lock, flags);
-       if (!(timeri->flags & SNDRV_TIMER_IFLG_RUNNING)) {
-               spin_unlock_irqrestore(&slave_active_lock, flags);
-               return -EBUSY;
-       }
+       running = timeri->flags & SNDRV_TIMER_IFLG_RUNNING;
        timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
        if (timeri->timer) {
                spin_lock(&timeri->timer->lock);
                list_del_init(&timeri->ack_list);
                list_del_init(&timeri->active_list);
-               snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP :
-                                 SNDRV_TIMER_EVENT_PAUSE);
+               if (running)
+                       snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP :
+                                         SNDRV_TIMER_EVENT_PAUSE);
                spin_unlock(&timeri->timer->lock);
        }
        spin_unlock_irqrestore(&slave_active_lock, flags);
-       return 0;
+       return running ? 0 : -EBUSY;
 }
 
 /*
@@ -1346,7 +1345,7 @@ static void snd_timer_user_interrupt(struct snd_timer_instance *timeri,
        }
       __wake:
        spin_unlock(&tu->qlock);
-       kill_fasync(&tu->fasync, SIGIO, POLL_IN);
+       snd_kill_fasync(tu->fasync, SIGIO, POLL_IN);
        wake_up(&tu->qchange_sleep);
 }
 
@@ -1384,7 +1383,7 @@ static void snd_timer_user_ccallback(struct snd_timer_instance *timeri,
        spin_lock_irqsave(&tu->qlock, flags);
        snd_timer_user_append_to_tqueue(tu, &r1);
        spin_unlock_irqrestore(&tu->qlock, flags);
-       kill_fasync(&tu->fasync, SIGIO, POLL_IN);
+       snd_kill_fasync(tu->fasync, SIGIO, POLL_IN);
        wake_up(&tu->qchange_sleep);
 }
 
@@ -1454,7 +1453,7 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri,
        spin_unlock(&tu->qlock);
        if (append == 0)
                return;
-       kill_fasync(&tu->fasync, SIGIO, POLL_IN);
+       snd_kill_fasync(tu->fasync, SIGIO, POLL_IN);
        wake_up(&tu->qchange_sleep);
 }
 
@@ -1522,6 +1521,7 @@ static int snd_timer_user_release(struct inode *inode, struct file *file)
                        snd_timer_instance_free(tu->timeri);
                }
                mutex_unlock(&tu->ioctl_lock);
+               snd_fasync_free(tu->fasync);
                kfree(tu->queue);
                kfree(tu->tqueue);
                kfree(tu);
@@ -2136,7 +2136,7 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on)
        struct snd_timer_user *tu;
 
        tu = file->private_data;
-       return fasync_helper(fd, file, on, &tu->fasync);
+       return snd_fasync_helper(fd, file, on, &tu->fasync);
 }
 
 static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,