提交 72134c4d 编写于 作者: L Lars-Peter Clausen 提交者: Takashi Iwai

ALSA: cs46xx: Remove always NULL parameters

The various PCM and MIDI allocation functions in this driver take a pointer
to a pointer of a PCM/MIDI object 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 shorter and cleaner.
Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 3e4f4776
...@@ -100,16 +100,16 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci, ...@@ -100,16 +100,16 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci,
} }
card->private_data = chip; card->private_data = chip;
chip->accept_valid = mmap_valid[dev]; chip->accept_valid = mmap_valid[dev];
if ((err = snd_cs46xx_pcm(chip, 0, NULL)) < 0) { if ((err = snd_cs46xx_pcm(chip, 0)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
#ifdef CONFIG_SND_CS46XX_NEW_DSP #ifdef CONFIG_SND_CS46XX_NEW_DSP
if ((err = snd_cs46xx_pcm_rear(chip,1, NULL)) < 0) { if ((err = snd_cs46xx_pcm_rear(chip, 1)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
if ((err = snd_cs46xx_pcm_iec958(chip,2,NULL)) < 0) { if ((err = snd_cs46xx_pcm_iec958(chip, 2)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
...@@ -120,13 +120,13 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci, ...@@ -120,13 +120,13 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci,
} }
#ifdef CONFIG_SND_CS46XX_NEW_DSP #ifdef CONFIG_SND_CS46XX_NEW_DSP
if (chip->nr_ac97_codecs ==2) { if (chip->nr_ac97_codecs ==2) {
if ((err = snd_cs46xx_pcm_center_lfe(chip,3,NULL)) < 0) { if ((err = snd_cs46xx_pcm_center_lfe(chip, 3)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
} }
#endif #endif
if ((err = snd_cs46xx_midi(chip, 0, NULL)) < 0) { if ((err = snd_cs46xx_midi(chip, 0)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
} }
......
...@@ -1737,12 +1737,12 @@ int snd_cs46xx_create(struct snd_card *card, ...@@ -1737,12 +1737,12 @@ int snd_cs46xx_create(struct snd_card *card,
struct snd_cs46xx **rcodec); struct snd_cs46xx **rcodec);
extern const struct dev_pm_ops snd_cs46xx_pm; extern const struct dev_pm_ops snd_cs46xx_pm;
int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device);
int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device);
int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device);
int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device);
int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device); int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device);
int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rmidi); int snd_cs46xx_midi(struct snd_cs46xx *chip, int device);
int snd_cs46xx_start_dsp(struct snd_cs46xx *chip); int snd_cs46xx_start_dsp(struct snd_cs46xx *chip);
int snd_cs46xx_gameport(struct snd_cs46xx *chip); int snd_cs46xx_gameport(struct snd_cs46xx *chip);
......
...@@ -1778,13 +1778,11 @@ static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = { ...@@ -1778,13 +1778,11 @@ static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = {
#define MAX_PLAYBACK_CHANNELS 1 #define MAX_PLAYBACK_CHANNELS 1
#endif #endif
int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm) int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device)
{ {
struct snd_pcm *pcm; struct snd_pcm *pcm;
int err; int err;
if (rpcm)
*rpcm = NULL;
if ((err = snd_pcm_new(chip->card, "CS46xx", device, MAX_PLAYBACK_CHANNELS, 1, &pcm)) < 0) if ((err = snd_pcm_new(chip->card, "CS46xx", device, MAX_PLAYBACK_CHANNELS, 1, &pcm)) < 0)
return err; return err;
...@@ -1801,23 +1799,16 @@ int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm) ...@@ -1801,23 +1799,16 @@ int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm)
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_pci_data(chip->pci), 64*1024, 256*1024); snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
if (rpcm)
*rpcm = pcm;
return 0; return 0;
} }
#ifdef CONFIG_SND_CS46XX_NEW_DSP #ifdef CONFIG_SND_CS46XX_NEW_DSP
int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device)
struct snd_pcm **rpcm)
{ {
struct snd_pcm *pcm; struct snd_pcm *pcm;
int err; int err;
if (rpcm)
*rpcm = NULL;
if ((err = snd_pcm_new(chip->card, "CS46xx - Rear", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) if ((err = snd_pcm_new(chip->card, "CS46xx - Rear", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0)
return err; return err;
...@@ -1833,21 +1824,14 @@ int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, ...@@ -1833,21 +1824,14 @@ int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device,
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_pci_data(chip->pci), 64*1024, 256*1024); snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
if (rpcm)
*rpcm = pcm;
return 0; return 0;
} }
int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device)
struct snd_pcm **rpcm)
{ {
struct snd_pcm *pcm; struct snd_pcm *pcm;
int err; int err;
if (rpcm)
*rpcm = NULL;
if ((err = snd_pcm_new(chip->card, "CS46xx - Center LFE", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) if ((err = snd_pcm_new(chip->card, "CS46xx - Center LFE", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0)
return err; return err;
...@@ -1863,21 +1847,14 @@ int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, ...@@ -1863,21 +1847,14 @@ int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device,
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_pci_data(chip->pci), 64*1024, 256*1024); snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
if (rpcm)
*rpcm = pcm;
return 0; return 0;
} }
int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device)
struct snd_pcm **rpcm)
{ {
struct snd_pcm *pcm; struct snd_pcm *pcm;
int err; int err;
if (rpcm)
*rpcm = NULL;
if ((err = snd_pcm_new(chip->card, "CS46xx - IEC958", device, 1, 0, &pcm)) < 0) if ((err = snd_pcm_new(chip->card, "CS46xx - IEC958", device, 1, 0, &pcm)) < 0)
return err; return err;
...@@ -1893,9 +1870,6 @@ int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, ...@@ -1893,9 +1870,6 @@ int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device,
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_pci_data(chip->pci), 64*1024, 256*1024); snd_dma_pci_data(chip->pci), 64*1024, 256*1024);
if (rpcm)
*rpcm = pcm;
return 0; return 0;
} }
#endif #endif
...@@ -2724,13 +2698,11 @@ static struct snd_rawmidi_ops snd_cs46xx_midi_input = ...@@ -2724,13 +2698,11 @@ static struct snd_rawmidi_ops snd_cs46xx_midi_input =
.trigger = snd_cs46xx_midi_input_trigger, .trigger = snd_cs46xx_midi_input_trigger,
}; };
int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rrawmidi) int snd_cs46xx_midi(struct snd_cs46xx *chip, int device)
{ {
struct snd_rawmidi *rmidi; struct snd_rawmidi *rmidi;
int err; int err;
if (rrawmidi)
*rrawmidi = NULL;
if ((err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi)) < 0) if ((err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi)) < 0)
return err; return err;
strcpy(rmidi->name, "CS46XX"); strcpy(rmidi->name, "CS46XX");
...@@ -2739,8 +2711,6 @@ int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rr ...@@ -2739,8 +2711,6 @@ int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rr
rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX;
rmidi->private_data = chip; rmidi->private_data = chip;
chip->rmidi = rmidi; chip->rmidi = rmidi;
if (rrawmidi)
*rrawmidi = NULL;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册