]> www.infradead.org Git - users/hch/misc.git/commitdiff
ALSA: lola: Use guard() for spin locks
authorTakashi Iwai <tiwai@suse.de>
Fri, 29 Aug 2025 14:43:15 +0000 (16:43 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 1 Sep 2025 11:52:41 +0000 (13:52 +0200)
Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20250829144342.4290-41-tiwai@suse.de
sound/pci/lola/lola.c
sound/pci/lola/lola_pcm.c

index 8d927ecba165b237da5e8d9dfab00ba28e6852e2..34a3ba17deb4b76bce83438a36d827a4dfdb7f13 100644 (file)
@@ -74,7 +74,6 @@ static int corb_send_verb(struct lola *chip, unsigned int nid,
                          unsigned int verb, unsigned int data,
                          unsigned int extdata)
 {
-       unsigned long flags;
        int ret = -EIO;
 
        chip->last_cmd_nid = nid;
@@ -83,7 +82,7 @@ static int corb_send_verb(struct lola *chip, unsigned int nid,
        chip->last_extdata = extdata;
        data |= (nid << 20) | (verb << 8);
 
-       spin_lock_irqsave(&chip->reg_lock, flags);
+       guard(spinlock_irqsave)(&chip->reg_lock);
        if (chip->rirb.cmds < LOLA_CORB_ENTRIES - 1) {
                unsigned int wp = chip->corb.wp + 1;
                wp %= LOLA_CORB_ENTRIES;
@@ -95,7 +94,6 @@ static int corb_send_verb(struct lola *chip, unsigned int nid,
                smp_wmb();
                ret = 0;
        }
-       spin_unlock_irqrestore(&chip->reg_lock, flags);
        return ret;
 }
 
index 35e919d240bfb7ce9def93e7a2d138bf1a5ba854..6c046ecd6e08dffa6c5f521bb089ddf405159159 100644 (file)
@@ -523,7 +523,7 @@ static int lola_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
         */
        sync_streams = (start && snd_pcm_stream_linked(substream));
        tstamp = lola_get_tstamp(chip, !sync_streams);
-       spin_lock(&chip->reg_lock);
+       guard(spinlock)(&chip->reg_lock);
        snd_pcm_group_for_each_entry(s, substream) {
                if (s->pcm->card != substream->pcm->card)
                        continue;
@@ -536,7 +536,6 @@ static int lola_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
                str->paused = !start;
                snd_pcm_trigger_done(s, substream);
        }
-       spin_unlock(&chip->reg_lock);
        return 0;
 }