diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-01-02 06:24:47 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-01-02 10:32:03 -0500 |
commit | 72134c4d9e97bcde376a8746510408da3fe039cc (patch) | |
tree | 477bd6684161c6a3fb2c46f878db29c41d6fd7bd | |
parent | 3e4f4776f427ddeeba6972f34cca04df478a67b4 (diff) |
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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/cs46xx/cs46xx.c | 10 | ||||
-rw-r--r-- | sound/pci/cs46xx/cs46xx.h | 10 | ||||
-rw-r--r-- | sound/pci/cs46xx/cs46xx_lib.c | 40 |
3 files changed, 15 insertions, 45 deletions
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index 6a6858c07826..655fbea1692c 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c | |||
@@ -100,16 +100,16 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci, | |||
100 | } | 100 | } |
101 | card->private_data = chip; | 101 | card->private_data = chip; |
102 | chip->accept_valid = mmap_valid[dev]; | 102 | chip->accept_valid = mmap_valid[dev]; |
103 | if ((err = snd_cs46xx_pcm(chip, 0, NULL)) < 0) { | 103 | if ((err = snd_cs46xx_pcm(chip, 0)) < 0) { |
104 | snd_card_free(card); | 104 | snd_card_free(card); |
105 | return err; | 105 | return err; |
106 | } | 106 | } |
107 | #ifdef CONFIG_SND_CS46XX_NEW_DSP | 107 | #ifdef CONFIG_SND_CS46XX_NEW_DSP |
108 | if ((err = snd_cs46xx_pcm_rear(chip,1, NULL)) < 0) { | 108 | if ((err = snd_cs46xx_pcm_rear(chip, 1)) < 0) { |
109 | snd_card_free(card); | 109 | snd_card_free(card); |
110 | return err; | 110 | return err; |
111 | } | 111 | } |
112 | if ((err = snd_cs46xx_pcm_iec958(chip,2,NULL)) < 0) { | 112 | if ((err = snd_cs46xx_pcm_iec958(chip, 2)) < 0) { |
113 | snd_card_free(card); | 113 | snd_card_free(card); |
114 | return err; | 114 | return err; |
115 | } | 115 | } |
@@ -120,13 +120,13 @@ static int snd_card_cs46xx_probe(struct pci_dev *pci, | |||
120 | } | 120 | } |
121 | #ifdef CONFIG_SND_CS46XX_NEW_DSP | 121 | #ifdef CONFIG_SND_CS46XX_NEW_DSP |
122 | if (chip->nr_ac97_codecs ==2) { | 122 | if (chip->nr_ac97_codecs ==2) { |
123 | if ((err = snd_cs46xx_pcm_center_lfe(chip,3,NULL)) < 0) { | 123 | if ((err = snd_cs46xx_pcm_center_lfe(chip, 3)) < 0) { |
124 | snd_card_free(card); | 124 | snd_card_free(card); |
125 | return err; | 125 | return err; |
126 | } | 126 | } |
127 | } | 127 | } |
128 | #endif | 128 | #endif |
129 | if ((err = snd_cs46xx_midi(chip, 0, NULL)) < 0) { | 129 | if ((err = snd_cs46xx_midi(chip, 0)) < 0) { |
130 | snd_card_free(card); | 130 | snd_card_free(card); |
131 | return err; | 131 | return err; |
132 | } | 132 | } |
diff --git a/sound/pci/cs46xx/cs46xx.h b/sound/pci/cs46xx/cs46xx.h index c49a082c378b..9c9f89a8be5f 100644 --- a/sound/pci/cs46xx/cs46xx.h +++ b/sound/pci/cs46xx/cs46xx.h | |||
@@ -1737,12 +1737,12 @@ int snd_cs46xx_create(struct snd_card *card, | |||
1737 | struct snd_cs46xx **rcodec); | 1737 | struct snd_cs46xx **rcodec); |
1738 | extern const struct dev_pm_ops snd_cs46xx_pm; | 1738 | extern const struct dev_pm_ops snd_cs46xx_pm; |
1739 | 1739 | ||
1740 | int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); | 1740 | int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device); |
1741 | int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); | 1741 | int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device); |
1742 | int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); | 1742 | int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device); |
1743 | int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm); | 1743 | int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device); |
1744 | int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device); | 1744 | int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device); |
1745 | int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rmidi); | 1745 | int snd_cs46xx_midi(struct snd_cs46xx *chip, int device); |
1746 | int snd_cs46xx_start_dsp(struct snd_cs46xx *chip); | 1746 | int snd_cs46xx_start_dsp(struct snd_cs46xx *chip); |
1747 | int snd_cs46xx_gameport(struct snd_cs46xx *chip); | 1747 | int snd_cs46xx_gameport(struct snd_cs46xx *chip); |
1748 | 1748 | ||
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 32b44f25b5c8..dfec84e1a575 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -1778,13 +1778,11 @@ static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = { | |||
1778 | #define MAX_PLAYBACK_CHANNELS 1 | 1778 | #define MAX_PLAYBACK_CHANNELS 1 |
1779 | #endif | 1779 | #endif |
1780 | 1780 | ||
1781 | int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm) | 1781 | int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device) |
1782 | { | 1782 | { |
1783 | struct snd_pcm *pcm; | 1783 | struct snd_pcm *pcm; |
1784 | int err; | 1784 | int err; |
1785 | 1785 | ||
1786 | if (rpcm) | ||
1787 | *rpcm = NULL; | ||
1788 | if ((err = snd_pcm_new(chip->card, "CS46xx", device, MAX_PLAYBACK_CHANNELS, 1, &pcm)) < 0) | 1786 | if ((err = snd_pcm_new(chip->card, "CS46xx", device, MAX_PLAYBACK_CHANNELS, 1, &pcm)) < 0) |
1789 | return err; | 1787 | return err; |
1790 | 1788 | ||
@@ -1801,23 +1799,16 @@ int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm) | |||
1801 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1799 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1802 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1800 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1803 | 1801 | ||
1804 | if (rpcm) | ||
1805 | *rpcm = pcm; | ||
1806 | |||
1807 | return 0; | 1802 | return 0; |
1808 | } | 1803 | } |
1809 | 1804 | ||
1810 | 1805 | ||
1811 | #ifdef CONFIG_SND_CS46XX_NEW_DSP | 1806 | #ifdef CONFIG_SND_CS46XX_NEW_DSP |
1812 | int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, | 1807 | int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device) |
1813 | struct snd_pcm **rpcm) | ||
1814 | { | 1808 | { |
1815 | struct snd_pcm *pcm; | 1809 | struct snd_pcm *pcm; |
1816 | int err; | 1810 | int err; |
1817 | 1811 | ||
1818 | if (rpcm) | ||
1819 | *rpcm = NULL; | ||
1820 | |||
1821 | if ((err = snd_pcm_new(chip->card, "CS46xx - Rear", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) | 1812 | if ((err = snd_pcm_new(chip->card, "CS46xx - Rear", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) |
1822 | return err; | 1813 | return err; |
1823 | 1814 | ||
@@ -1833,21 +1824,14 @@ int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, | |||
1833 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1824 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1834 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1825 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1835 | 1826 | ||
1836 | if (rpcm) | ||
1837 | *rpcm = pcm; | ||
1838 | |||
1839 | return 0; | 1827 | return 0; |
1840 | } | 1828 | } |
1841 | 1829 | ||
1842 | int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, | 1830 | int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device) |
1843 | struct snd_pcm **rpcm) | ||
1844 | { | 1831 | { |
1845 | struct snd_pcm *pcm; | 1832 | struct snd_pcm *pcm; |
1846 | int err; | 1833 | int err; |
1847 | 1834 | ||
1848 | if (rpcm) | ||
1849 | *rpcm = NULL; | ||
1850 | |||
1851 | if ((err = snd_pcm_new(chip->card, "CS46xx - Center LFE", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) | 1835 | if ((err = snd_pcm_new(chip->card, "CS46xx - Center LFE", device, MAX_PLAYBACK_CHANNELS, 0, &pcm)) < 0) |
1852 | return err; | 1836 | return err; |
1853 | 1837 | ||
@@ -1863,21 +1847,14 @@ int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, | |||
1863 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1847 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1864 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1848 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1865 | 1849 | ||
1866 | if (rpcm) | ||
1867 | *rpcm = pcm; | ||
1868 | |||
1869 | return 0; | 1850 | return 0; |
1870 | } | 1851 | } |
1871 | 1852 | ||
1872 | int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, | 1853 | int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device) |
1873 | struct snd_pcm **rpcm) | ||
1874 | { | 1854 | { |
1875 | struct snd_pcm *pcm; | 1855 | struct snd_pcm *pcm; |
1876 | int err; | 1856 | int err; |
1877 | 1857 | ||
1878 | if (rpcm) | ||
1879 | *rpcm = NULL; | ||
1880 | |||
1881 | if ((err = snd_pcm_new(chip->card, "CS46xx - IEC958", device, 1, 0, &pcm)) < 0) | 1858 | if ((err = snd_pcm_new(chip->card, "CS46xx - IEC958", device, 1, 0, &pcm)) < 0) |
1882 | return err; | 1859 | return err; |
1883 | 1860 | ||
@@ -1893,9 +1870,6 @@ int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, | |||
1893 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1870 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1894 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); | 1871 | snd_dma_pci_data(chip->pci), 64*1024, 256*1024); |
1895 | 1872 | ||
1896 | if (rpcm) | ||
1897 | *rpcm = pcm; | ||
1898 | |||
1899 | return 0; | 1873 | return 0; |
1900 | } | 1874 | } |
1901 | #endif | 1875 | #endif |
@@ -2724,13 +2698,11 @@ static struct snd_rawmidi_ops snd_cs46xx_midi_input = | |||
2724 | .trigger = snd_cs46xx_midi_input_trigger, | 2698 | .trigger = snd_cs46xx_midi_input_trigger, |
2725 | }; | 2699 | }; |
2726 | 2700 | ||
2727 | int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rrawmidi) | 2701 | int snd_cs46xx_midi(struct snd_cs46xx *chip, int device) |
2728 | { | 2702 | { |
2729 | struct snd_rawmidi *rmidi; | 2703 | struct snd_rawmidi *rmidi; |
2730 | int err; | 2704 | int err; |
2731 | 2705 | ||
2732 | if (rrawmidi) | ||
2733 | *rrawmidi = NULL; | ||
2734 | if ((err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi)) < 0) | 2706 | if ((err = snd_rawmidi_new(chip->card, "CS46XX", device, 1, 1, &rmidi)) < 0) |
2735 | return err; | 2707 | return err; |
2736 | strcpy(rmidi->name, "CS46XX"); | 2708 | strcpy(rmidi->name, "CS46XX"); |
@@ -2739,8 +2711,6 @@ int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rr | |||
2739 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; | 2711 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; |
2740 | rmidi->private_data = chip; | 2712 | rmidi->private_data = chip; |
2741 | chip->rmidi = rmidi; | 2713 | chip->rmidi = rmidi; |
2742 | if (rrawmidi) | ||
2743 | *rrawmidi = NULL; | ||
2744 | return 0; | 2714 | return 0; |
2745 | } | 2715 | } |
2746 | 2716 | ||