Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa60c065 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Takashi Iwai
Browse files

ALSA: wss: Remove (almost) always NULL parameters



Most callers of snd_wss_pcm(), snd_wss_timer() and snd_cs4236_pcm() pass
NULL as the last parameter, some callers pass a pointer but never use it
after the function has been called and only a few callers pass a pointer and
actually use it. The later is only the case for snd_wss_pcm() for
snd_cs4236_pcm() and it is possible to get the same PCM object by accessing
the pcm field of the snd_wss struct that was passed as the first parameter.

This function removes the last parameters from the functions mentioned above
and updates the callers which used it to use chip->pcm instead. This allows
us to slightly simplify the functions since they don't have to check and set
the last parameter anymore which makes the code slightly shorter and
cleaner.

Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 92533f18
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -154,8 +154,8 @@ int snd_wss_create(struct snd_card *card,
		      unsigned short hardware,
		      unsigned short hwshare,
		      struct snd_wss **rchip);
int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer);
int snd_wss_pcm(struct snd_wss *chip, int device);
int snd_wss_timer(struct snd_wss *chip, int device);
int snd_wss_mixer(struct snd_wss *chip);

const struct snd_pcm_ops *snd_wss_get_pcm_ops(int direction);
@@ -167,7 +167,7 @@ int snd_cs4236_create(struct snd_card *card,
		      unsigned short hardware,
		      unsigned short hwshare,
		      struct snd_wss **rchip);
int snd_cs4236_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
int snd_cs4236_pcm(struct snd_wss *chip, int device);
int snd_cs4236_mixer(struct snd_wss *chip);

/*
+3 −4
Original line number Diff line number Diff line
@@ -88,7 +88,6 @@ static int snd_ad1848_probe(struct device *dev, unsigned int n)
{
	struct snd_card *card;
	struct snd_wss *chip;
	struct snd_pcm *pcm;
	int error;

	error = snd_card_new(dev, index[n], id[n], THIS_MODULE, 0, &card);
@@ -103,7 +102,7 @@ static int snd_ad1848_probe(struct device *dev, unsigned int n)

	card->private_data = chip;

	error = snd_wss_pcm(chip, 0, &pcm);
	error = snd_wss_pcm(chip, 0);
	if (error < 0)
		goto out;

@@ -112,10 +111,10 @@ static int snd_ad1848_probe(struct device *dev, unsigned int n)
		goto out;

	strcpy(card->driver, "AD1848");
	strcpy(card->shortname, pcm->name);
	strcpy(card->shortname, chip->pcm->name);

	sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
		pcm->name, chip->port, irq[n], dma1[n]);
		chip->pcm->name, chip->port, irq[n], dma1[n]);
	if (thinkpad[n])
		strcat(card->longname, " [Thinkpad]");

+2 −2
Original line number Diff line number Diff line
@@ -215,7 +215,7 @@ static int snd_card_azt2320_probe(int dev,
	sprintf(card->longname, "%s, WSS at 0x%lx, irq %i, dma %i&%i",
		card->shortname, chip->port, irq[dev], dma1[dev], dma2[dev]);

	error = snd_wss_pcm(chip, 0, NULL);
	error = snd_wss_pcm(chip, 0);
	if (error < 0) {
		snd_card_free(card);
		return error;
@@ -225,7 +225,7 @@ static int snd_card_azt2320_probe(int dev,
		snd_card_free(card);
		return error;
	}
	error = snd_wss_timer(chip, 0, NULL);
	error = snd_wss_timer(chip, 0);
	if (error < 0) {
		snd_card_free(card);
		return error;
+2 −2
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@ static int snd_cmi8328_probe(struct device *pdev, unsigned int ndev)
	if (err < 0)
		goto error;

	err = snd_wss_pcm(cmi->wss, 0, NULL);
	err = snd_wss_pcm(cmi->wss, 0);
	if (err < 0)
		goto error;

@@ -318,7 +318,7 @@ static int snd_cmi8328_probe(struct device *pdev, unsigned int ndev)
	if (err < 0)
		goto error;

	if (snd_wss_timer(cmi->wss, 0, NULL) < 0)
	if (snd_wss_timer(cmi->wss, 0) < 0)
		snd_printk(KERN_WARNING "error initializing WSS timer\n");

	if (mpuport[ndev] == SNDRV_AUTO_PORT) {
+4 −5
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@ static int snd_cs4231_probe(struct device *dev, unsigned int n)
{
	struct snd_card *card;
	struct snd_wss *chip;
	struct snd_pcm *pcm;
	int error;

	error = snd_card_new(dev, index[n], id[n], THIS_MODULE, 0, &card);
@@ -106,15 +105,15 @@ static int snd_cs4231_probe(struct device *dev, unsigned int n)

	card->private_data = chip;

	error = snd_wss_pcm(chip, 0, &pcm);
	error = snd_wss_pcm(chip, 0);
	if (error < 0)
		goto out;

	strcpy(card->driver, "CS4231");
	strcpy(card->shortname, pcm->name);
	strcpy(card->shortname, chip->pcm->name);

	sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
		pcm->name, chip->port, irq[n], dma1[n]);
		chip->pcm->name, chip->port, irq[n], dma1[n]);
	if (dma2[n] >= 0)
		sprintf(card->longname + strlen(card->longname), "&%d", dma2[n]);

@@ -122,7 +121,7 @@ static int snd_cs4231_probe(struct device *dev, unsigned int n)
	if (error < 0)
		goto out;

	error = snd_wss_timer(chip, 0, NULL);
	error = snd_wss_timer(chip, 0);
	if (error < 0)
		goto out;

Loading