Skip to content

Commit 92533f1

Browse files
larsclausentiwai
authored andcommitted
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>
1 parent 8c77629 commit 92533f1

5 files changed

Lines changed: 6 additions & 10 deletions

File tree

‎include/sound/sb.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip);
320320
int snd_sb8dsp_midi(struct snd_sb *chip, int device);
321321

322322
/* sb16_init.c */
323-
int snd_sb16dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm);
323+
int snd_sb16dsp_pcm(struct snd_sb *chip, int device);
324324
const struct snd_pcm_ops *snd_sb16dsp_get_pcm_ops(int direction);
325325
int snd_sb16dsp_configure(struct snd_sb *chip);
326326
/* sb16.c */

‎sound/isa/als100.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ static int snd_card_als100_probe(int dev,
233233
irq[dev], dma8[dev], dma16[dev]);
234234
}
235235

236-
if ((error = snd_sb16dsp_pcm(chip, 0, &chip->pcm)) < 0) {
236+
if ((error = snd_sb16dsp_pcm(chip, 0)) < 0) {
237237
snd_card_free(card);
238238
return error;
239239
}

‎sound/isa/sb/sb16.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ static int snd_sb16_probe(struct snd_card *card, int dev)
374374
if (! is_isapnp_selected(dev) && (err = snd_sb16dsp_configure(chip)) < 0)
375375
return err;
376376

377-
if ((err = snd_sb16dsp_pcm(chip, 0, &chip->pcm)) < 0)
377+
if ((err = snd_sb16dsp_pcm(chip, 0)) < 0)
378378
return err;
379379

380380
strcpy(card->driver,

‎sound/isa/sb/sb16_main.c‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -860,19 +860,18 @@ static struct snd_pcm_ops snd_sb16_capture_ops = {
860860
.pointer = snd_sb16_capture_pointer,
861861
};
862862

863-
int snd_sb16dsp_pcm(struct snd_sb * chip, int device, struct snd_pcm ** rpcm)
863+
int snd_sb16dsp_pcm(struct snd_sb *chip, int device)
864864
{
865865
struct snd_card *card = chip->card;
866866
struct snd_pcm *pcm;
867867
int err;
868868

869-
if (rpcm)
870-
*rpcm = NULL;
871869
if ((err = snd_pcm_new(card, "SB16 DSP", device, 1, 1, &pcm)) < 0)
872870
return err;
873871
sprintf(pcm->name, "DSP v%i.%i", chip->version >> 8, chip->version & 0xff);
874872
pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;
875873
pcm->private_data = chip;
874+
chip->pcm = pcm;
876875

877876
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb16_playback_ops);
878877
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)
885884
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
886885
snd_dma_isa_data(),
887886
64*1024, 128*1024);
888-
889-
if (rpcm)
890-
*rpcm = pcm;
891887
return 0;
892888
}
893889

‎sound/pci/cs5530.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static int snd_cs5530_create(struct snd_card *card,
223223
return err;
224224
}
225225

226-
err = snd_sb16dsp_pcm(chip->sb, 0, &chip->sb->pcm);
226+
err = snd_sb16dsp_pcm(chip->sb, 0);
227227
if (err < 0) {
228228
dev_err(card->dev, "Could not create PCM\n");
229229
snd_cs5530_free(chip);

0 commit comments

Comments
 (0)