ASoC: sb16: Simplify snd_sb16dsp_pcm()
All callers of snd_sb16dsp_pcm() always pass the pcm field of the first parameter as the last parameter. Simplify the function by moving this inside the function itself. This makes the code a bit shorter and cleaner. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
8c77629996
commit
92533f1888
@ -320,7 +320,7 @@ irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip);
|
|||||||
int snd_sb8dsp_midi(struct snd_sb *chip, int device);
|
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);
|
||||||
const struct snd_pcm_ops *snd_sb16dsp_get_pcm_ops(int direction);
|
const struct snd_pcm_ops *snd_sb16dsp_get_pcm_ops(int direction);
|
||||||
int snd_sb16dsp_configure(struct snd_sb *chip);
|
int snd_sb16dsp_configure(struct snd_sb *chip);
|
||||||
/* sb16.c */
|
/* sb16.c */
|
||||||
|
@ -233,7 +233,7 @@ static int snd_card_als100_probe(int dev,
|
|||||||
irq[dev], dma8[dev], dma16[dev]);
|
irq[dev], dma8[dev], dma16[dev]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((error = snd_sb16dsp_pcm(chip, 0, &chip->pcm)) < 0) {
|
if ((error = snd_sb16dsp_pcm(chip, 0)) < 0) {
|
||||||
snd_card_free(card);
|
snd_card_free(card);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ static int snd_sb16_probe(struct snd_card *card, int dev)
|
|||||||
if (! is_isapnp_selected(dev) && (err = snd_sb16dsp_configure(chip)) < 0)
|
if (! is_isapnp_selected(dev) && (err = snd_sb16dsp_configure(chip)) < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if ((err = snd_sb16dsp_pcm(chip, 0, &chip->pcm)) < 0)
|
if ((err = snd_sb16dsp_pcm(chip, 0)) < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
strcpy(card->driver,
|
strcpy(card->driver,
|
||||||
|
@ -860,19 +860,18 @@ static struct snd_pcm_ops snd_sb16_capture_ops = {
|
|||||||
.pointer = snd_sb16_capture_pointer,
|
.pointer = snd_sb16_capture_pointer,
|
||||||
};
|
};
|
||||||
|
|
||||||
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_card *card = chip->card;
|
struct snd_card *card = chip->card;
|
||||||
struct snd_pcm *pcm;
|
struct snd_pcm *pcm;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (rpcm)
|
|
||||||
*rpcm = NULL;
|
|
||||||
if ((err = snd_pcm_new(card, "SB16 DSP", device, 1, 1, &pcm)) < 0)
|
if ((err = snd_pcm_new(card, "SB16 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);
|
||||||
pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;
|
pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;
|
||||||
pcm->private_data = chip;
|
pcm->private_data = chip;
|
||||||
|
chip->pcm = pcm;
|
||||||
|
|
||||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb16_playback_ops);
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb16_playback_ops);
|
||||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb16_capture_ops);
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb16_capture_ops);
|
||||||
@ -885,9 +884,6 @@ int snd_sb16dsp_pcm(struct snd_sb * chip, int device, struct snd_pcm ** rpcm)
|
|||||||
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
|
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
|
||||||
snd_dma_isa_data(),
|
snd_dma_isa_data(),
|
||||||
64*1024, 128*1024);
|
64*1024, 128*1024);
|
||||||
|
|
||||||
if (rpcm)
|
|
||||||
*rpcm = pcm;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ static int snd_cs5530_create(struct snd_card *card,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = snd_sb16dsp_pcm(chip->sb, 0, &chip->sb->pcm);
|
err = snd_sb16dsp_pcm(chip->sb, 0);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
dev_err(card->dev, "Could not create PCM\n");
|
dev_err(card->dev, "Could not create PCM\n");
|
||||||
snd_cs5530_free(chip);
|
snd_cs5530_free(chip);
|
||||||
|
Loading…
Reference in New Issue
Block a user