Skip to content

Commit

Permalink
ALSA: gus: Remove always NULL parameters
Browse files Browse the repository at this point in the history
snd_gf1_pcm_new() and snd_gf1_rawmidi_new() 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 <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
larsclausen authored and tiwai committed Jan 2, 2015
1 parent 1a2515a commit db5abb3
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 19 deletions.
4 changes: 2 additions & 2 deletions include/sound/gus.h
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ int snd_gf1_new_mixer(struct snd_gus_card * gus);

/* gus_pcm.c */

int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, struct snd_pcm ** rpcm);
int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index);

#ifdef CONFIG_SND_DEBUG
extern void snd_gf1_print_voice_registers(struct snd_gus_card * gus);
Expand Down Expand Up @@ -620,7 +620,7 @@ void snd_gus_irq_profile_init(struct snd_gus_card *gus);

/* gus_uart.c */

int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi **rrawmidi);
int snd_gf1_rawmidi_new(struct snd_gus_card *gus, int device);

/* gus_dram.c */
int snd_gus_dram_write(struct snd_gus_card *gus, char __user *ptr,
Expand Down
6 changes: 1 addition & 5 deletions sound/isa/gus/gus_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,16 +849,14 @@ static struct snd_pcm_ops snd_gf1_pcm_capture_ops = {
.pointer = snd_gf1_pcm_capture_pointer,
};

int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, struct snd_pcm ** rpcm)
int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index)
{
struct snd_card *card;
struct snd_kcontrol *kctl;
struct snd_pcm *pcm;
struct snd_pcm_substream *substream;
int capture, err;

if (rpcm)
*rpcm = NULL;
card = gus->card;
capture = !gus->interwave && !gus->ess_flag && !gus->ace_flag ? 1 : 0;
err = snd_pcm_new(card,
Expand Down Expand Up @@ -903,8 +901,6 @@ int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, s
return err;
kctl->id.index = control_index;

if (rpcm)
*rpcm = pcm;
return 0;
}

6 changes: 1 addition & 5 deletions sound/isa/gus/gus_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,11 @@ static struct snd_rawmidi_ops snd_gf1_uart_input =
.trigger = snd_gf1_uart_input_trigger,
};

int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi ** rrawmidi)
int snd_gf1_rawmidi_new(struct snd_gus_card *gus, int device)
{
struct snd_rawmidi *rmidi;
int err;

if (rrawmidi)
*rrawmidi = NULL;
if ((err = snd_rawmidi_new(gus->card, "GF1", device, 1, 1, &rmidi)) < 0)
return err;
strcpy(rmidi->name, gus->interwave ? "AMD InterWave" : "GF1");
Expand All @@ -256,7 +254,5 @@ int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmid
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX;
rmidi->private_data = gus;
gus->midi_uart = rmidi;
if (rrawmidi)
*rrawmidi = rmidi;
return err;
}
4 changes: 2 additions & 2 deletions sound/isa/gus/gusclassic.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ static int snd_gusclassic_probe(struct device *dev, unsigned int n)
if (error < 0)
goto out;

error = snd_gf1_pcm_new(gus, 0, 0, NULL);
error = snd_gf1_pcm_new(gus, 0, 0);
if (error < 0)
goto out;

if (!gus->ace_flag) {
error = snd_gf1_rawmidi_new(gus, 0, NULL);
error = snd_gf1_rawmidi_new(gus, 0);
if (error < 0)
goto out;
}
Expand Down
2 changes: 1 addition & 1 deletion sound/isa/gus/gusextreme.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ static int snd_gusextreme_probe(struct device *dev, unsigned int n)
snd_component_add(card, "ES1688");

if (pcm_channels[n] > 0) {
error = snd_gf1_pcm_new(gus, 1, 1, NULL);
error = snd_gf1_pcm_new(gus, 1, 1);
if (error < 0)
goto out;
}
Expand Down
4 changes: 2 additions & 2 deletions sound/isa/gus/gusmax.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,14 @@ static int snd_gusmax_probe(struct device *pdev, unsigned int dev)
goto _err;

if (pcm_channels[dev] > 0) {
if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
if ((err = snd_gf1_pcm_new(gus, 1, 1)) < 0)
goto _err;
}
err = snd_gusmax_mixer(wss);
if (err < 0)
goto _err;

err = snd_gf1_rawmidi_new(gus, 0, NULL);
err = snd_gf1_rawmidi_new(gus, 0);
if (err < 0)
goto _err;

Expand Down
4 changes: 2 additions & 2 deletions sound/isa/gus/interwave.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ static int snd_interwave_probe(struct snd_card *card, int dev)
return err;

if (pcm_channels[dev] > 0) {
err = snd_gf1_pcm_new(gus, 1, 1, NULL);
err = snd_gf1_pcm_new(gus, 1, 1);
if (err < 0)
return err;
}
Expand Down Expand Up @@ -740,7 +740,7 @@ static int snd_interwave_probe(struct snd_card *card, int dev)
#endif

gus->uart_enable = midi[dev];
if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
if ((err = snd_gf1_rawmidi_new(gus, 0)) < 0)
return err;

#ifndef SNDRV_STB
Expand Down

0 comments on commit db5abb3

Please sign in to comment.