Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: snd_ps3: Use guard() for spin locks

Clean up the code using guard() for spin locks.

Merely code refactoring, and no behavior change.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

+5 -16
+5 -16
sound/ppc/snd_ps3.c
··· 221 221 int fill_stages, dma_ch, stage; 222 222 enum snd_ps3_ch ch; 223 223 uint32_t ch0_kick_event = 0; /* initialize to mute gcc */ 224 - unsigned long irqsave; 225 224 int silent = 0; 226 225 227 226 switch (filltype) { ··· 241 242 242 243 snd_ps3_verify_dma_stop(card, 700, 0); 243 244 fill_stages = 4; 244 - spin_lock_irqsave(&card->dma_lock, irqsave); 245 + guard(spinlock_irqsave)(&card->dma_lock); 245 246 for (ch = 0; ch < 2; ch++) { 246 247 for (stage = 0; stage < fill_stages; stage++) { 247 248 dma_ch = stage * 2 + ch; ··· 288 289 } 289 290 /* ensure the hardware sees the change */ 290 291 wmb(); 291 - spin_unlock_irqrestore(&card->dma_lock, irqsave); 292 292 293 293 return 0; 294 294 } ··· 559 561 { 560 562 struct snd_pcm_runtime *runtime = substream->runtime; 561 563 struct snd_ps3_card_info *card = snd_pcm_substream_chip(substream); 562 - unsigned long irqsave; 563 564 564 565 if (!snd_ps3_set_avsetting(substream)) { 565 566 /* some parameter changed */ ··· 575 578 } 576 579 577 580 /* restart ring buffer pointer */ 578 - spin_lock_irqsave(&card->dma_lock, irqsave); 579 - { 581 + scoped_guard(spinlock_irqsave, &card->dma_lock) { 580 582 card->dma_buffer_size = runtime->dma_bytes; 581 583 582 584 card->dma_last_transfer_vaddr[SND_PS3_CH_L] = ··· 596 600 card->dma_start_bus_addr[SND_PS3_CH_L]); 597 601 598 602 } 599 - spin_unlock_irqrestore(&card->dma_lock, irqsave); 600 603 601 604 /* ensure the hardware sees the change */ 602 605 mb(); ··· 613 618 /* clear outstanding interrupts */ 614 619 update_reg(PS3_AUDIO_AX_IS, 0); 615 620 616 - spin_lock(&card->dma_lock); 617 - { 621 + scoped_guard(spinlock, &card->dma_lock) { 618 622 card->running = 1; 619 623 } 620 - spin_unlock(&card->dma_lock); 621 624 622 625 snd_ps3_program_dma(card, 623 626 SND_PS3_DMA_FILLTYPE_SILENT_FIRSTFILL); ··· 629 636 break; 630 637 631 638 case SNDRV_PCM_TRIGGER_STOP: 632 - spin_lock(&card->dma_lock); 633 - { 639 + scoped_guard(spinlock, &card->dma_lock) { 634 640 card->running = 0; 635 641 } 636 - spin_unlock(&card->dma_lock); 637 642 snd_ps3_wait_for_dma_stop(card); 638 643 break; 639 644 default: ··· 652 661 size_t bytes; 653 662 snd_pcm_uframes_t ret; 654 663 655 - spin_lock(&card->dma_lock); 656 - { 664 + scoped_guard(spinlock, &card->dma_lock) { 657 665 bytes = (size_t)(card->dma_last_transfer_vaddr[SND_PS3_CH_L] - 658 666 card->dma_start_vaddr[SND_PS3_CH_L]); 659 667 } 660 - spin_unlock(&card->dma_lock); 661 668 662 669 ret = bytes_to_frames(substream->runtime, bytes * 2); 663 670