All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	alsa-devel@alsa-project.org,
	Eliot Blennerhassett <eliot@blennerhassett.gen.nz>
Subject: [PATCH 05/21] ALSA: gus: Remove always NULL parameters
Date: Fri,  2 Jan 2015 12:24:39 +0100	[thread overview]
Message-ID: <1420197895-17696-6-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1420197895-17696-1-git-send-email-lars@metafoo.de>

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 <lars@metafoo.de>
---
 include/sound/gus.h        | 4 ++--
 sound/isa/gus/gus_pcm.c    | 6 +-----
 sound/isa/gus/gus_uart.c   | 6 +-----
 sound/isa/gus/gusclassic.c | 4 ++--
 sound/isa/gus/gusextreme.c | 2 +-
 sound/isa/gus/gusmax.c     | 4 ++--
 sound/isa/gus/interwave.c  | 4 ++--
 7 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/include/sound/gus.h b/include/sound/gus.h
index 42905d8..06bbdc2 100644
--- a/include/sound/gus.h
+++ b/include/sound/gus.h
@@ -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);
@@ -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,
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c
index 2dcf45b..25f6788 100644
--- a/sound/isa/gus/gus_pcm.c
+++ b/sound/isa/gus/gus_pcm.c
@@ -849,7 +849,7 @@ 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;
@@ -857,8 +857,6 @@ int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, s
 	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,
@@ -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;
 }
 
diff --git a/sound/isa/gus/gus_uart.c b/sound/isa/gus/gus_uart.c
index 21cc42e..3992912 100644
--- a/sound/isa/gus/gus_uart.c
+++ b/sound/isa/gus/gus_uart.c
@@ -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");
@@ -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;
 }
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c
index 7ce29ff..f001971 100644
--- a/sound/isa/gus/gusclassic.c
+++ b/sound/isa/gus/gusclassic.c
@@ -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;
 	}
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index acc6552..693d95f 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -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;
 	}
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index 39df36c..b2b3734 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -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;
 
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index ad55e5c..8ea54a7 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -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;
 	}
@@ -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
-- 
1.8.0

  parent reply	other threads:[~2015-01-02 11:25 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-02 11:24 [PATCH 00/21] ALSA: Remove always NULL parameters Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 01/21] ALSA: ml403-ac97cr: Remove always NULL parameter Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 02/21] ALSA: ad1816a: Remove always NULL parameters Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 03/21] ALSA: es1688: Remove almost always NULL parameter Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 04/21] ALSA: es18xx: Remove " Lars-Peter Clausen
2015-01-02 11:24 ` Lars-Peter Clausen [this message]
2015-01-02 11:24 ` [PATCH 06/21] ALSA: msnd: " Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 07/21] ALSA: sb8: Remove always NULL parameters Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 08/21] ASoC: sb16: Simplify snd_sb16dsp_pcm() Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 09/21] ALSA: wss: Remove (almost) always NULL parameters Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 10/21] ASLA: ad1889: Remove always NULL parameter Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 11/21] ALSA: asihpi: " Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 12/21] ALSA: cs4281: Remove always NULL parameters Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 13/21] ALSA: cs46xx: " Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 14/21] ALSA: ens1370: " Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 15/21] ALSA: emu10k1: " Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 16/21] ALSA: fm801: Remove always NULL parameter Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 17/21] ALSA: ice1712: Remove always NULL parameters Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 18/21] ALSA: riptide: Remove always NULL parameter Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 19/21] ALSA: sonicvibes: " Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 20/21] ALSA: trident: Remove always NULL parameters Lars-Peter Clausen
2015-01-02 11:24 ` [PATCH 21/21] ALSA: ymfpci: " Lars-Peter Clausen
2015-01-02 15:35 ` [PATCH 00/21] ALSA: " Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420197895-17696-6-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=eliot@blennerhassett.gen.nz \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.