Skip to content

Commit

Permalink
ALSA: Use fallthrough pseudo-keyword
Browse files Browse the repository at this point in the history
Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <[email protected]>
Link: https://lore.kernel.org/r/20200708203236.GA5112@embeddedor
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
GustavoARSilva authored and tiwai committed Jul 9, 2020
1 parent a0b224b commit c0dbbda
Show file tree
Hide file tree
Showing 35 changed files with 78 additions and 80 deletions.
16 changes: 8 additions & 8 deletions sound/atmel/ac97c.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,14 @@ atmel_ac97c_playback_trigger(struct snd_pcm_substream *substream, int cmd)
camr = ac97c_readl(chip, CAMR);

switch (cmd) {
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */
case SNDRV_PCM_TRIGGER_RESUME: /* fall through */
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_START:
ptcr = ATMEL_PDC_TXTEN;
camr |= AC97C_CMR_CENA | AC97C_CSR_ENDTX;
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */
case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_STOP:
ptcr |= ATMEL_PDC_TXTDIS;
if (chip->opened <= 1)
Expand All @@ -388,14 +388,14 @@ atmel_ac97c_capture_trigger(struct snd_pcm_substream *substream, int cmd)
ptcr = readl(chip->regs + ATMEL_PDC_PTSR);

switch (cmd) {
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */
case SNDRV_PCM_TRIGGER_RESUME: /* fall through */
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_START:
ptcr = ATMEL_PDC_RXTEN;
camr |= AC97C_CMR_CENA | AC97C_CSR_ENDRX;
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */
case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_STOP:
ptcr |= ATMEL_PDC_RXTDIS;
if (chip->opened <= 1)
Expand Down
2 changes: 1 addition & 1 deletion sound/core/memalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,
*/
dmab->dev.type = SNDRV_DMA_TYPE_DEV;
#endif /* CONFIG_GENERIC_ALLOCATOR */
/* fall through */
fallthrough;
case SNDRV_DMA_TYPE_DEV:
case SNDRV_DMA_TYPE_DEV_UC:
snd_malloc_dev_pages(dmab, size);
Expand Down
2 changes: 1 addition & 1 deletion sound/core/oss/pcm_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -2851,7 +2851,7 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
if (substream)
break;
/* Fall through */
fallthrough;
case VM_READ:
substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
break;
Expand Down
2 changes: 1 addition & 1 deletion sound/core/oss/pcm_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format,
if (snd_mask_test(format_mask, (__force int)format1))
return format1;
}
/* fall through */
fallthrough;
default:
return (__force snd_pcm_format_t)-EINVAL;
}
Expand Down
8 changes: 4 additions & 4 deletions sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -1903,7 +1903,7 @@ static int snd_pcm_prepare(struct snd_pcm_substream *substream,
switch (substream->runtime->status->state) {
case SNDRV_PCM_STATE_PAUSED:
snd_pcm_pause(substream, false);
/* fallthru */
fallthrough;
case SNDRV_PCM_STATE_SUSPENDED:
snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
break;
Expand Down Expand Up @@ -2811,7 +2811,7 @@ static int do_pcm_hwsync(struct snd_pcm_substream *substream)
case SNDRV_PCM_STATE_DRAINING:
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
return -EBADFD;
/* Fall through */
fallthrough;
case SNDRV_PCM_STATE_RUNNING:
return snd_pcm_update_hw_ptr(substream);
case SNDRV_PCM_STATE_PREPARED:
Expand Down Expand Up @@ -3814,15 +3814,15 @@ static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area)
case SNDRV_PCM_MMAP_OFFSET_STATUS_OLD:
if (pcm_file->no_compat_mmap || !IS_ENABLED(CONFIG_64BIT))
return -ENXIO;
/* fallthrough */
fallthrough;
case SNDRV_PCM_MMAP_OFFSET_STATUS_NEW:
if (!pcm_status_mmap_allowed(pcm_file))
return -ENXIO;
return snd_pcm_mmap_status(substream, file, area);
case SNDRV_PCM_MMAP_OFFSET_CONTROL_OLD:
if (pcm_file->no_compat_mmap || !IS_ENABLED(CONFIG_64BIT))
return -ENXIO;
/* fallthrough */
fallthrough;
case SNDRV_PCM_MMAP_OFFSET_CONTROL_NEW:
if (!pcm_control_mmap_allowed(pcm_file))
return -ENXIO;
Expand Down
2 changes: 1 addition & 1 deletion sound/core/seq/oss/seq_oss_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ snd_seq_oss_process_timer_event(struct seq_oss_timer *rec, union evrec *ev)
case TMR_WAIT_REL:
parm += rec->cur_tick;
rec->realtime = 0;
/* fall through */
fallthrough;
case TMR_WAIT_ABS:
if (parm == 0) {
rec->realtime = 1;
Expand Down
2 changes: 1 addition & 1 deletion sound/core/seq/seq_midi_emul.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ do_control(const struct snd_midi_op *ops, void *drv,
break;
case MIDI_CTL_MSB_DATA_ENTRY:
chan->control[MIDI_CTL_LSB_DATA_ENTRY] = 0;
/* fall through */
fallthrough;
case MIDI_CTL_LSB_DATA_ENTRY:
if (chan->param_type == SNDRV_MIDI_PARAM_TYPE_REGISTERED)
rpn(ops, drv, chan, chset);
Expand Down
4 changes: 2 additions & 2 deletions sound/drivers/opl3/opl3_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan)
instr_4op = 1;
break;
}
/* fall through */
fallthrough;
default:
spin_unlock_irqrestore(&opl3->voice_lock, flags);
return;
Expand Down Expand Up @@ -443,7 +443,7 @@ void snd_opl3_note_on(void *p, int note, int vel, struct snd_midi_channel *chan)
switch (connection) {
case 0x03:
snd_opl3_calc_volume(&vol_op[2], vel, chan);
/* fallthru */
fallthrough;
case 0x02:
snd_opl3_calc_volume(&vol_op[0], vel, chan);
break;
Expand Down
6 changes: 3 additions & 3 deletions sound/isa/galaxy/galaxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static int snd_galaxy_match(struct device *dev, unsigned int n)
break;
case 2:
irq[n] = 9;
/* Fall through */
fallthrough;
case 9:
wss_config[n] |= WSS_CONFIG_IRQ_9;
break;
Expand Down Expand Up @@ -292,7 +292,7 @@ static int snd_galaxy_match(struct device *dev, unsigned int n)
case 1:
if (dma1[n] == 0)
break;
/* Fall through */
fallthrough;
default:
dev_err(dev, "invalid capture DMA %d\n", dma2[n]);
return 0;
Expand Down Expand Up @@ -322,7 +322,7 @@ static int snd_galaxy_match(struct device *dev, unsigned int n)
break;
case 2:
mpu_irq[n] = 9;
/* Fall through */
fallthrough;
case 9:
config[n] |= GALAXY_CONFIG_MPUIRQ_2;
break;
Expand Down
4 changes: 1 addition & 3 deletions sound/isa/msnd/msnd_pinnacle_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,9 @@ static int snd_msndmix_set(struct snd_msnd *dev, int d, int left, int right)
case MSND_MIXER_VOLUME: /* master volume */
writew(wLeft, dev->SMA + SMA_wCurrMastVolLeft);
writew(wRight, dev->SMA + SMA_wCurrMastVolRight);
/* fall through */

fallthrough;
case MSND_MIXER_AUX: /* aux pot control */
/* scaled by master volume */
/* fall through */

/* digital controls */
case MSND_MIXER_SYNTH: /* synth vol (dsp mix) */
Expand Down
10 changes: 5 additions & 5 deletions sound/isa/opti9xx/miro.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ static int aci_busy_wait(struct snd_miro_aci *aci)
switch (timeout-ACI_MINTIME) {
case 0 ... 9:
out /= 10;
/* fall through */
fallthrough;
case 10 ... 19:
out /= 10;
/* fall through */
fallthrough;
case 20 ... 30:
out /= 10;
/* fall through */
fallthrough;
default:
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(out);
Expand Down Expand Up @@ -824,7 +824,7 @@ static unsigned char snd_miro_read(struct snd_miro *chip,
retval = inb(chip->mc_base + 9);
break;
}
/* fall through */
fallthrough;

case OPTi9XX_HW_82C929:
retval = inb(chip->mc_base + reg);
Expand Down Expand Up @@ -854,7 +854,7 @@ static void snd_miro_write(struct snd_miro *chip, unsigned char reg,
outb(value, chip->mc_base + 9);
break;
}
/* fall through */
fallthrough;

case OPTi9XX_HW_82C929:
outb(value, chip->mc_base + reg);
Expand Down
12 changes: 7 additions & 5 deletions sound/isa/opti9xx/opti92x-ad1848.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ static unsigned char snd_opti9xx_read(struct snd_opti9xx *chip,
retval = inb(chip->mc_base + 9);
break;
}
/* Fall through */
fallthrough;

case OPTi9XX_HW_82C928:
case OPTi9XX_HW_82C929:
Expand Down Expand Up @@ -292,7 +292,7 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg,
outb(value, chip->mc_base + 9);
break;
}
/* Fall through */
fallthrough;

case OPTi9XX_HW_82C928:
case OPTi9XX_HW_82C929:
Expand Down Expand Up @@ -343,7 +343,7 @@ static int snd_opti9xx_configure(struct snd_opti9xx *chip,
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc);
/* enable wave audio */
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02);
/* Fall through */
fallthrough;

case OPTi9XX_HW_82C925:
/* enable WSS mode */
Expand Down Expand Up @@ -380,7 +380,8 @@ static int snd_opti9xx_configure(struct snd_opti9xx *chip,
case OPTi9XX_HW_82C931:
/* disable 3D sound (set GPIO1 as output, low) */
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(20), 0x04, 0x0c);
/* fall through */
fallthrough;

case OPTi9XX_HW_82C933:
/*
* The BTC 1817DW has QS1000 wavetable which is connected
Expand All @@ -392,7 +393,8 @@ static int snd_opti9xx_configure(struct snd_opti9xx *chip,
* or digital input signal.
*/
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(26), 0x01, 0x01);
/* fall through */
fallthrough;

case OPTi9XX_HW_82C930:
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x03);
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0x00, 0xff);
Expand Down
10 changes: 5 additions & 5 deletions sound/isa/sb/sb8_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ static int snd_sb8_playback_prepare(struct snd_pcm_substream *substream)
chip->playback_format = SB_DSP_HI_OUTPUT_AUTO;
break;
}
/* fall through */
fallthrough;
case SB_HW_201:
if (rate > 23000) {
chip->playback_format = SB_DSP_HI_OUTPUT_AUTO;
break;
}
/* fall through */
fallthrough;
case SB_HW_20:
chip->playback_format = SB_DSP_LO_OUTPUT_AUTO;
break;
Expand Down Expand Up @@ -261,7 +261,7 @@ static int snd_sb8_capture_prepare(struct snd_pcm_substream *substream)
chip->capture_format = SB_DSP_HI_INPUT_AUTO;
break;
}
/* fall through */
fallthrough;
case SB_HW_20:
chip->capture_format = SB_DSP_LO_INPUT_AUTO;
break;
Expand Down Expand Up @@ -361,7 +361,7 @@ irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip)
case SB_MODE_PLAYBACK_16: /* ok.. playback is active */
if (chip->hardware != SB_HW_JAZZ16)
break;
/* fall through */
fallthrough;
case SB_MODE_PLAYBACK_8:
substream = chip->playback_substream;
if (chip->playback_format == SB_DSP_OUTPUT)
Expand All @@ -371,7 +371,7 @@ irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip)
case SB_MODE_CAPTURE_16:
if (chip->hardware != SB_HW_JAZZ16)
break;
/* fall through */
fallthrough;
case SB_MODE_CAPTURE_8:
substream = chip->capture_substream;
if (chip->capture_format == SB_DSP_INPUT)
Expand Down
2 changes: 1 addition & 1 deletion sound/oss/dmasound/dmasound_atari.c
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ static int FalconMixerIoctl(u_int cmd, u_long arg)
tt_dmasnd.input_gain =
RECLEVEL_VOXWARE_TO_GAIN(data & 0xff) << 4 |
RECLEVEL_VOXWARE_TO_GAIN(data >> 8 & 0xff);
/* fall through - return set value */
fallthrough; /* return set value */
case SOUND_MIXER_READ_MIC:
return IOCTL_OUT(arg,
RECLEVEL_GAIN_TO_VOXWARE(tt_dmasnd.input_gain >> 4 & 0xf) |
Expand Down
4 changes: 2 additions & 2 deletions sound/oss/dmasound/dmasound_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1478,13 +1478,13 @@ static int dmasound_setup(char *str)
printk("dmasound_setup: invalid catch radius, using default = %d\n", catchRadius);
else
catchRadius = ints[3];
/* fall through */
fallthrough;
case 2:
if (ints[1] < MIN_BUFFERS)
printk("dmasound_setup: invalid number of buffers, using default = %d\n", numWriteBufs);
else
numWriteBufs = ints[1];
/* fall through */
fallthrough;
case 1:
if ((size = ints[2]) < 256) /* check for small buffer specs */
size <<= 10 ;
Expand Down
4 changes: 2 additions & 2 deletions sound/pci/ac97/ac97_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ static int snd_ac97_valid_reg(struct snd_ac97 *ac97, unsigned short reg)
case AC97_ID_ST_AC97_ID4:
if (reg == 0x08)
return 0;
/* fall through */
fallthrough;
case AC97_ID_ST7597:
if (reg == 0x22 || reg == 0x7a)
return 1;
/* fall through */
fallthrough;
case AC97_ID_AK4540:
case AC97_ID_AK4542:
if (reg <= 0x1c || reg == 0x20 || reg == 0x26 || reg >= 0x7c)
Expand Down
6 changes: 3 additions & 3 deletions sound/pci/atiixp.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,15 +896,15 @@ static int snd_atiixp_playback_prepare(struct snd_pcm_substream *substream)
case 8:
data |= ATI_REG_OUT_DMA_SLOT_BIT(10) |
ATI_REG_OUT_DMA_SLOT_BIT(11);
/* fall through */
fallthrough;
case 6:
data |= ATI_REG_OUT_DMA_SLOT_BIT(7) |
ATI_REG_OUT_DMA_SLOT_BIT(8);
/* fall through */
fallthrough;
case 4:
data |= ATI_REG_OUT_DMA_SLOT_BIT(6) |
ATI_REG_OUT_DMA_SLOT_BIT(9);
/* fall through */
fallthrough;
default:
data |= ATI_REG_OUT_DMA_SLOT_BIT(3) |
ATI_REG_OUT_DMA_SLOT_BIT(4);
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/azt3328.c
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ snd_azf3328_codec_setfmt(struct snd_azf3328_codec_data *codec,
case AZF_FREQ_32000: freq = SOUNDFORMAT_FREQ_32000; break;
default:
snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate);
/* fall-through */
fallthrough;
case AZF_FREQ_44100: freq = SOUNDFORMAT_FREQ_44100; break;
case AZF_FREQ_48000: freq = SOUNDFORMAT_FREQ_48000; break;
case AZF_FREQ_66200: freq = SOUNDFORMAT_FREQ_SUSPECTED_66200; break;
Expand Down
4 changes: 2 additions & 2 deletions sound/pci/echoaudio/echoaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ static int pcm_prepare(struct snd_pcm_substream *substream)
break;
case SNDRV_PCM_FORMAT_S32_BE:
format.data_are_bigendian = 1;
/* fall through */
fallthrough;
case SNDRV_PCM_FORMAT_S32_LE:
format.bits_per_sample = 32;
break;
Expand Down Expand Up @@ -764,7 +764,7 @@ static int pcm_trigger(struct snd_pcm_substream *substream, int cmd)
pipe->last_counter = 0;
pipe->position = 0;
*pipe->dma_counter = 0;
/* fall through */
fallthrough;
case PIPE_STATE_PAUSED:
pipe->state = PIPE_STATE_STARTED;
break;
Expand Down
Loading

0 comments on commit c0dbbda

Please sign in to comment.