ALSA: sb8: Remove always NULL parameters
snd_sb8dsp_pcm() and snd_sb8dsp_midi() take a pointer to a pointer of a PCM/MIDI where if this parameter is provided the newly allocated object is stored. All callers pass NULL though, so remove the parameter. This makes the code a bit cleaner and shorter. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Родитель
f6be4e624a
Коммит
8c77629996
|
@ -308,7 +308,7 @@ void snd_sbmixer_resume(struct snd_sb *chip);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* sb8_init.c */
|
/* sb8_init.c */
|
||||||
int snd_sb8dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm);
|
int snd_sb8dsp_pcm(struct snd_sb *chip, int device);
|
||||||
/* sb8.c */
|
/* sb8.c */
|
||||||
irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip);
|
irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip);
|
||||||
int snd_sb8_playback_open(struct snd_pcm_substream *substream);
|
int snd_sb8_playback_open(struct snd_pcm_substream *substream);
|
||||||
|
@ -317,7 +317,7 @@ int snd_sb8_playback_close(struct snd_pcm_substream *substream);
|
||||||
int snd_sb8_capture_close(struct snd_pcm_substream *substream);
|
int snd_sb8_capture_close(struct snd_pcm_substream *substream);
|
||||||
/* midi8.c */
|
/* midi8.c */
|
||||||
irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip);
|
irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip);
|
||||||
int snd_sb8dsp_midi(struct snd_sb *chip, int device, struct snd_rawmidi ** rrawmidi);
|
int snd_sb8dsp_midi(struct snd_sb *chip, int device);
|
||||||
|
|
||||||
/* sb16_init.c */
|
/* sb16_init.c */
|
||||||
int snd_sb16dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm);
|
int snd_sb16dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm);
|
||||||
|
|
|
@ -297,7 +297,7 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev)
|
||||||
"Media Vision Jazz16 at 0x%lx, irq %d, dma8 %d, dma16 %d",
|
"Media Vision Jazz16 at 0x%lx, irq %d, dma8 %d, dma16 %d",
|
||||||
port[dev], xirq, xdma8, xdma16);
|
port[dev], xirq, xdma8, xdma16);
|
||||||
|
|
||||||
err = snd_sb8dsp_pcm(chip, 0, NULL);
|
err = snd_sb8dsp_pcm(chip, 0);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto err_free;
|
goto err_free;
|
||||||
err = snd_sbmixer_new(chip);
|
err = snd_sbmixer_new(chip);
|
||||||
|
|
|
@ -157,7 +157,7 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev)
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = snd_sb8dsp_pcm(chip, 0, NULL)) < 0)
|
if ((err = snd_sb8dsp_pcm(chip, 0)) < 0)
|
||||||
goto _err;
|
goto _err;
|
||||||
|
|
||||||
if ((err = snd_sbmixer_new(chip)) < 0)
|
if ((err = snd_sbmixer_new(chip)) < 0)
|
||||||
|
@ -182,7 +182,7 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev)
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = snd_sb8dsp_midi(chip, 0, NULL)) < 0)
|
if ((err = snd_sb8dsp_midi(chip, 0)) < 0)
|
||||||
goto _err;
|
goto _err;
|
||||||
|
|
||||||
strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8");
|
strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8");
|
||||||
|
|
|
@ -594,15 +594,13 @@ static struct snd_pcm_ops snd_sb8_capture_ops = {
|
||||||
.pointer = snd_sb8_capture_pointer,
|
.pointer = snd_sb8_capture_pointer,
|
||||||
};
|
};
|
||||||
|
|
||||||
int snd_sb8dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm)
|
int snd_sb8dsp_pcm(struct snd_sb *chip, int device)
|
||||||
{
|
{
|
||||||
struct snd_card *card = chip->card;
|
struct snd_card *card = chip->card;
|
||||||
struct snd_pcm *pcm;
|
struct snd_pcm *pcm;
|
||||||
int err;
|
int err;
|
||||||
size_t max_prealloc = 64 * 1024;
|
size_t max_prealloc = 64 * 1024;
|
||||||
|
|
||||||
if (rpcm)
|
|
||||||
*rpcm = NULL;
|
|
||||||
if ((err = snd_pcm_new(card, "SB8 DSP", device, 1, 1, &pcm)) < 0)
|
if ((err = snd_pcm_new(card, "SB8 DSP", device, 1, 1, &pcm)) < 0)
|
||||||
return err;
|
return err;
|
||||||
sprintf(pcm->name, "DSP v%i.%i", chip->version >> 8, chip->version & 0xff);
|
sprintf(pcm->name, "DSP v%i.%i", chip->version >> 8, chip->version & 0xff);
|
||||||
|
@ -618,8 +616,6 @@ int snd_sb8dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm)
|
||||||
snd_dma_isa_data(),
|
snd_dma_isa_data(),
|
||||||
64*1024, max_prealloc);
|
64*1024, max_prealloc);
|
||||||
|
|
||||||
if (rpcm)
|
|
||||||
*rpcm = pcm;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -263,13 +263,11 @@ static struct snd_rawmidi_ops snd_sb8dsp_midi_input =
|
||||||
.trigger = snd_sb8dsp_midi_input_trigger,
|
.trigger = snd_sb8dsp_midi_input_trigger,
|
||||||
};
|
};
|
||||||
|
|
||||||
int snd_sb8dsp_midi(struct snd_sb *chip, int device, struct snd_rawmidi ** rrawmidi)
|
int snd_sb8dsp_midi(struct snd_sb *chip, int device)
|
||||||
{
|
{
|
||||||
struct snd_rawmidi *rmidi;
|
struct snd_rawmidi *rmidi;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (rrawmidi)
|
|
||||||
*rrawmidi = NULL;
|
|
||||||
if ((err = snd_rawmidi_new(chip->card, "SB8 MIDI", device, 1, 1, &rmidi)) < 0)
|
if ((err = snd_rawmidi_new(chip->card, "SB8 MIDI", device, 1, 1, &rmidi)) < 0)
|
||||||
return err;
|
return err;
|
||||||
strcpy(rmidi->name, "SB8 MIDI");
|
strcpy(rmidi->name, "SB8 MIDI");
|
||||||
|
@ -280,7 +278,5 @@ int snd_sb8dsp_midi(struct snd_sb *chip, int device, struct snd_rawmidi ** rrawm
|
||||||
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_DUPLEX;
|
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_DUPLEX;
|
||||||
rmidi->private_data = chip;
|
rmidi->private_data = chip;
|
||||||
chip->rmidi = rmidi;
|
chip->rmidi = rmidi;
|
||||||
if (rrawmidi)
|
|
||||||
*rrawmidi = rmidi;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче