Browse Source

ALSA: es1688: Remove almost always NULL parameter

snd_es1688_pcm() takes a pointer to a pointer of a PCM where if this
parameter is provided the newly allocated PCM is stored. This PCM is also
available from the pcm field of the snd_es1688 struct that got passed to the
same function. This patch updates all callers which passed a pointer to use
that field instead and then removes the parameter from the function. 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>
Lars-Peter Clausen 11 years ago
parent
commit
4b8ab88518

+ 1 - 2
include/sound/es1688.h

@@ -115,8 +115,7 @@ int snd_es1688_create(struct snd_card *card,
 		      int mpu_irq,
 		      int mpu_irq,
 		      int dma8,
 		      int dma8,
 		      unsigned short hardware);
 		      unsigned short hardware);
-int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device,
-		   struct snd_pcm **rpcm);
+int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device);
 int snd_es1688_mixer(struct snd_card *card, struct snd_es1688 *chip);
 int snd_es1688_mixer(struct snd_card *card, struct snd_es1688 *chip);
 int snd_es1688_reset(struct snd_es1688 *chip);
 int snd_es1688_reset(struct snd_es1688 *chip);
 
 

+ 3 - 4
sound/isa/es1688/es1688.c

@@ -138,10 +138,9 @@ static int snd_es1688_probe(struct snd_card *card, unsigned int n)
 {
 {
 	struct snd_es1688 *chip = card->private_data;
 	struct snd_es1688 *chip = card->private_data;
 	struct snd_opl3 *opl3;
 	struct snd_opl3 *opl3;
-	struct snd_pcm *pcm;
 	int error;
 	int error;
 
 
-	error = snd_es1688_pcm(card, chip, 0, &pcm);
+	error = snd_es1688_pcm(card, chip, 0);
 	if (error < 0)
 	if (error < 0)
 		return error;
 		return error;
 
 
@@ -150,9 +149,9 @@ static int snd_es1688_probe(struct snd_card *card, unsigned int n)
 		return error;
 		return error;
 
 
 	strlcpy(card->driver, "ES1688", sizeof(card->driver));
 	strlcpy(card->driver, "ES1688", sizeof(card->driver));
-	strlcpy(card->shortname, pcm->name, sizeof(card->shortname));
+	strlcpy(card->shortname, chip->pcm->name, sizeof(card->shortname));
 	snprintf(card->longname, sizeof(card->longname),
 	snprintf(card->longname, sizeof(card->longname),
-		"%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port,
+		"%s at 0x%lx, irq %i, dma %i", chip->pcm->name, chip->port,
 		 chip->irq, chip->dma8);
 		 chip->irq, chip->dma8);
 
 
 	if (fm_port[n] == SNDRV_AUTO_PORT)
 	if (fm_port[n] == SNDRV_AUTO_PORT)

+ 1 - 5
sound/isa/es1688/es1688_lib.c

@@ -728,8 +728,7 @@ static struct snd_pcm_ops snd_es1688_capture_ops = {
 	.pointer =		snd_es1688_capture_pointer,
 	.pointer =		snd_es1688_capture_pointer,
 };
 };
 
 
-int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip,
-		   int device, struct snd_pcm **rpcm)
+int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device)
 {
 {
 	struct snd_pcm *pcm;
 	struct snd_pcm *pcm;
 	int err;
 	int err;
@@ -749,9 +748,6 @@ int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip,
 	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, 64*1024);
 					      64*1024, 64*1024);
-
-	if (rpcm)
-		*rpcm = pcm;
 	return 0;
 	return 0;
 }
 }
 
 

+ 1 - 1
sound/isa/gus/gusextreme.c

@@ -284,7 +284,7 @@ static int snd_gusextreme_probe(struct device *dev, unsigned int n)
 	}
 	}
 	gus->codec_flag = 1;
 	gus->codec_flag = 1;
 
 
-	error = snd_es1688_pcm(card, es1688, 0, NULL);
+	error = snd_es1688_pcm(card, es1688, 0);
 	if (error < 0)
 	if (error < 0)
 		goto out;
 		goto out;