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>
This commit is contained in:
Lars-Peter Clausen 2015-01-02 12:24:37 +01:00 committed by Takashi Iwai
parent 7f60541883
commit 4b8ab88518
4 changed files with 6 additions and 12 deletions

View File

@ -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, int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device);
struct snd_pcm **rpcm);
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);

View File

@ -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)

View File

@ -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 snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device)
int device, struct snd_pcm **rpcm)
{ {
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;
} }

View File

@ -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;