Commit 50b8d94e authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Takashi Iwai

ALSA: ens1370: Remove always NULL parameters

The various PCM and MIDI allocation functions in this driver take a pointer
to a pointer of a PCM/MIDI object 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 shorter and cleaner.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 72134c4d
...@@ -1268,14 +1268,11 @@ static const struct snd_pcm_chmap_elem surround_map[] = { ...@@ -1268,14 +1268,11 @@ static const struct snd_pcm_chmap_elem surround_map[] = {
{ } { }
}; };
static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device, static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device)
struct snd_pcm **rpcm)
{ {
struct snd_pcm *pcm; struct snd_pcm *pcm;
int err; int err;
if (rpcm)
*rpcm = NULL;
err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm); err = snd_pcm_new(ensoniq->card, CHIP_NAME "/1", device, 1, 1, &pcm);
if (err < 0) if (err < 0)
return err; return err;
...@@ -1302,22 +1299,14 @@ static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device, ...@@ -1302,22 +1299,14 @@ static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device,
err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
snd_pcm_std_chmaps, 2, 0, NULL); snd_pcm_std_chmaps, 2, 0, NULL);
#endif #endif
if (err < 0) return err;
return err;
if (rpcm)
*rpcm = pcm;
return 0;
} }
static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device, static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device)
struct snd_pcm **rpcm)
{ {
struct snd_pcm *pcm; struct snd_pcm *pcm;
int err; int err;
if (rpcm)
*rpcm = NULL;
err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm); err = snd_pcm_new(ensoniq->card, CHIP_NAME "/2", device, 1, 0, &pcm);
if (err < 0) if (err < 0)
return err; return err;
...@@ -1342,12 +1331,7 @@ static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device, ...@@ -1342,12 +1331,7 @@ static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device,
err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
surround_map, 2, 0, NULL); surround_map, 2, 0, NULL);
#endif #endif
if (err < 0) return err;
return err;
if (rpcm)
*rpcm = pcm;
return 0;
} }
/* /*
...@@ -2362,14 +2346,11 @@ static struct snd_rawmidi_ops snd_ensoniq_midi_input = ...@@ -2362,14 +2346,11 @@ static struct snd_rawmidi_ops snd_ensoniq_midi_input =
.trigger = snd_ensoniq_midi_input_trigger, .trigger = snd_ensoniq_midi_input_trigger,
}; };
static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device, static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device)
struct snd_rawmidi **rrawmidi)
{ {
struct snd_rawmidi *rmidi; struct snd_rawmidi *rmidi;
int err; int err;
if (rrawmidi)
*rrawmidi = NULL;
if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0) if ((err = snd_rawmidi_new(ensoniq->card, "ES1370/1", device, 1, 1, &rmidi)) < 0)
return err; return err;
strcpy(rmidi->name, CHIP_NAME); strcpy(rmidi->name, CHIP_NAME);
...@@ -2379,8 +2360,6 @@ static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device, ...@@ -2379,8 +2360,6 @@ static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device,
SNDRV_RAWMIDI_INFO_DUPLEX; SNDRV_RAWMIDI_INFO_DUPLEX;
rmidi->private_data = ensoniq; rmidi->private_data = ensoniq;
ensoniq->rmidi = rmidi; ensoniq->rmidi = rmidi;
if (rrawmidi)
*rrawmidi = rmidi;
return 0; return 0;
} }
...@@ -2462,15 +2441,15 @@ static int snd_audiopci_probe(struct pci_dev *pci, ...@@ -2462,15 +2441,15 @@ static int snd_audiopci_probe(struct pci_dev *pci,
return err; return err;
} }
#endif #endif
if ((err = snd_ensoniq_pcm(ensoniq, 0, NULL)) < 0) { if ((err = snd_ensoniq_pcm(ensoniq, 0)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
if ((err = snd_ensoniq_pcm2(ensoniq, 1, NULL)) < 0) { if ((err = snd_ensoniq_pcm2(ensoniq, 1)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
if ((err = snd_ensoniq_midi(ensoniq, 0, NULL)) < 0) { if ((err = snd_ensoniq_midi(ensoniq, 0)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment