aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-01-02 06:24:49 -0500
committerTakashi Iwai <tiwai@suse.de>2015-01-02 10:32:45 -0500
commitbb814c396af777c31ed168ce57f620967dd133f1 (patch)
tree70d3942496cbb0f7b708488f885b7e098afc4fc9 /sound/pci/emu10k1
parent50b8d94e1819768e8eccae4d24698a17b8940776 (diff)
ALSA: emu10k1: Remove always NULL parameters
The various PCM and hwdep allocation functions in this driver take a pointer to a pointer of a PCM/hwdep where if this parameter is provided the newly allocated object is stored. All callers pass NULL though, so remove the parameter. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/emu10k1')
-rw-r--r--sound/pci/emu10k1/emu10k1.c12
-rw-r--r--sound/pci/emu10k1/emu10k1x.c19
-rw-r--r--sound/pci/emu10k1/emufx.c7
-rw-r--r--sound/pci/emu10k1/emupcm.c33
-rw-r--r--sound/pci/emu10k1/p16v.c7
5 files changed, 17 insertions, 61 deletions
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index 4c171636efcd..a3c00a668268 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -132,11 +132,11 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
132 goto error; 132 goto error;
133 card->private_data = emu; 133 card->private_data = emu;
134 emu->delay_pcm_irq = delay_pcm_irq[dev] & 0x1f; 134 emu->delay_pcm_irq = delay_pcm_irq[dev] & 0x1f;
135 if ((err = snd_emu10k1_pcm(emu, 0, NULL)) < 0) 135 if ((err = snd_emu10k1_pcm(emu, 0)) < 0)
136 goto error; 136 goto error;
137 if ((err = snd_emu10k1_pcm_mic(emu, 1, NULL)) < 0) 137 if ((err = snd_emu10k1_pcm_mic(emu, 1)) < 0)
138 goto error; 138 goto error;
139 if ((err = snd_emu10k1_pcm_efx(emu, 2, NULL)) < 0) 139 if ((err = snd_emu10k1_pcm_efx(emu, 2)) < 0)
140 goto error; 140 goto error;
141 /* This stores the periods table. */ 141 /* This stores the periods table. */
142 if (emu->card_capabilities->ca0151_chip) { /* P16V */ 142 if (emu->card_capabilities->ca0151_chip) { /* P16V */
@@ -151,10 +151,10 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
151 if ((err = snd_emu10k1_timer(emu, 0)) < 0) 151 if ((err = snd_emu10k1_timer(emu, 0)) < 0)
152 goto error; 152 goto error;
153 153
154 if ((err = snd_emu10k1_pcm_multi(emu, 3, NULL)) < 0) 154 if ((err = snd_emu10k1_pcm_multi(emu, 3)) < 0)
155 goto error; 155 goto error;
156 if (emu->card_capabilities->ca0151_chip) { /* P16V */ 156 if (emu->card_capabilities->ca0151_chip) { /* P16V */
157 if ((err = snd_p16v_pcm(emu, 4, NULL)) < 0) 157 if ((err = snd_p16v_pcm(emu, 4)) < 0)
158 goto error; 158 goto error;
159 } 159 }
160 if (emu->audigy) { 160 if (emu->audigy) {
@@ -164,7 +164,7 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
164 if ((err = snd_emu10k1_midi(emu)) < 0) 164 if ((err = snd_emu10k1_midi(emu)) < 0)
165 goto error; 165 goto error;
166 } 166 }
167 if ((err = snd_emu10k1_fx8010_new(emu, 0, NULL)) < 0) 167 if ((err = snd_emu10k1_fx8010_new(emu, 0)) < 0)
168 goto error; 168 goto error;
169#ifdef ENABLE_SYNTH 169#ifdef ENABLE_SYNTH
170 if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH, 170 if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH,
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 15933f92f63a..6d1b98d14327 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -847,15 +847,13 @@ static const struct snd_pcm_chmap_elem clfe_map[] = {
847 { } 847 { }
848}; 848};
849 849
850static int snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct snd_pcm **rpcm) 850static int snd_emu10k1x_pcm(struct emu10k1x *emu, int device)
851{ 851{
852 struct snd_pcm *pcm; 852 struct snd_pcm *pcm;
853 const struct snd_pcm_chmap_elem *map = NULL; 853 const struct snd_pcm_chmap_elem *map = NULL;
854 int err; 854 int err;
855 int capture = 0; 855 int capture = 0;
856 856
857 if (rpcm)
858 *rpcm = NULL;
859 if (device == 0) 857 if (device == 0)
860 capture = 1; 858 capture = 1;
861 859
@@ -896,15 +894,8 @@ static int snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct snd_pcm **r
896 snd_dma_pci_data(emu->pci), 894 snd_dma_pci_data(emu->pci),
897 32*1024, 32*1024); 895 32*1024, 32*1024);
898 896
899 err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, 897 return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2,
900 1 << 2, NULL); 898 1 << 2, NULL);
901 if (err < 0)
902 return err;
903
904 if (rpcm)
905 *rpcm = pcm;
906
907 return 0;
908} 899}
909 900
910static int snd_emu10k1x_create(struct snd_card *card, 901static int snd_emu10k1x_create(struct snd_card *card,
@@ -1583,15 +1574,15 @@ static int snd_emu10k1x_probe(struct pci_dev *pci,
1583 return err; 1574 return err;
1584 } 1575 }
1585 1576
1586 if ((err = snd_emu10k1x_pcm(chip, 0, NULL)) < 0) { 1577 if ((err = snd_emu10k1x_pcm(chip, 0)) < 0) {
1587 snd_card_free(card); 1578 snd_card_free(card);
1588 return err; 1579 return err;
1589 } 1580 }
1590 if ((err = snd_emu10k1x_pcm(chip, 1, NULL)) < 0) { 1581 if ((err = snd_emu10k1x_pcm(chip, 1)) < 0) {
1591 snd_card_free(card); 1582 snd_card_free(card);
1592 return err; 1583 return err;
1593 } 1584 }
1594 if ((err = snd_emu10k1x_pcm(chip, 2, NULL)) < 0) { 1585 if ((err = snd_emu10k1x_pcm(chip, 2)) < 0) {
1595 snd_card_free(card); 1586 snd_card_free(card);
1596 return err; 1587 return err;
1597 } 1588 }
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index eb5c0aba41c1..56fc47bd6dba 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -2641,14 +2641,11 @@ static int snd_emu10k1_fx8010_release(struct snd_hwdep * hw, struct file *file)
2641 return 0; 2641 return 0;
2642} 2642}
2643 2643
2644int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, 2644int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device)
2645 struct snd_hwdep **rhwdep)
2646{ 2645{
2647 struct snd_hwdep *hw; 2646 struct snd_hwdep *hw;
2648 int err; 2647 int err;
2649 2648
2650 if (rhwdep)
2651 *rhwdep = NULL;
2652 if ((err = snd_hwdep_new(emu->card, "FX8010", device, &hw)) < 0) 2649 if ((err = snd_hwdep_new(emu->card, "FX8010", device, &hw)) < 0)
2653 return err; 2650 return err;
2654 strcpy(hw->name, "EMU10K1 (FX8010)"); 2651 strcpy(hw->name, "EMU10K1 (FX8010)");
@@ -2657,8 +2654,6 @@ int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device,
2657 hw->ops.ioctl = snd_emu10k1_fx8010_ioctl; 2654 hw->ops.ioctl = snd_emu10k1_fx8010_ioctl;
2658 hw->ops.release = snd_emu10k1_fx8010_release; 2655 hw->ops.release = snd_emu10k1_fx8010_release;
2659 hw->private_data = emu; 2656 hw->private_data = emu;
2660 if (rhwdep)
2661 *rhwdep = hw;
2662 return 0; 2657 return 0;
2663} 2658}
2664 2659
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index f82481bd2542..0dc07385af0e 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -1400,15 +1400,12 @@ static struct snd_pcm_ops snd_emu10k1_efx_playback_ops = {
1400 .page = snd_pcm_sgbuf_ops_page, 1400 .page = snd_pcm_sgbuf_ops_page,
1401}; 1401};
1402 1402
1403int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm) 1403int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device)
1404{ 1404{
1405 struct snd_pcm *pcm; 1405 struct snd_pcm *pcm;
1406 struct snd_pcm_substream *substream; 1406 struct snd_pcm_substream *substream;
1407 int err; 1407 int err;
1408 1408
1409 if (rpcm)
1410 *rpcm = NULL;
1411
1412 if ((err = snd_pcm_new(emu->card, "emu10k1", device, 32, 1, &pcm)) < 0) 1409 if ((err = snd_pcm_new(emu->card, "emu10k1", device, 32, 1, &pcm)) < 0)
1413 return err; 1410 return err;
1414 1411
@@ -1429,22 +1426,15 @@ int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
1429 for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; substream; substream = substream->next) 1426 for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; substream; substream = substream->next)
1430 snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); 1427 snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024);
1431 1428
1432 if (rpcm)
1433 *rpcm = pcm;
1434
1435 return 0; 1429 return 0;
1436} 1430}
1437 1431
1438int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device, 1432int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device)
1439 struct snd_pcm **rpcm)
1440{ 1433{
1441 struct snd_pcm *pcm; 1434 struct snd_pcm *pcm;
1442 struct snd_pcm_substream *substream; 1435 struct snd_pcm_substream *substream;
1443 int err; 1436 int err;
1444 1437
1445 if (rpcm)
1446 *rpcm = NULL;
1447
1448 if ((err = snd_pcm_new(emu->card, "emu10k1", device, 1, 0, &pcm)) < 0) 1438 if ((err = snd_pcm_new(emu->card, "emu10k1", device, 1, 0, &pcm)) < 0)
1449 return err; 1439 return err;
1450 1440
@@ -1461,9 +1451,6 @@ int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device,
1461 if ((err = snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(emu->pci), 64*1024, 64*1024)) < 0) 1451 if ((err = snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, snd_dma_pci_data(emu->pci), 64*1024, 64*1024)) < 0)
1462 return err; 1452 return err;
1463 1453
1464 if (rpcm)
1465 *rpcm = pcm;
1466
1467 return 0; 1454 return 0;
1468} 1455}
1469 1456
@@ -1479,15 +1466,11 @@ static struct snd_pcm_ops snd_emu10k1_capture_mic_ops = {
1479 .pointer = snd_emu10k1_capture_pointer, 1466 .pointer = snd_emu10k1_capture_pointer,
1480}; 1467};
1481 1468
1482int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device, 1469int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device)
1483 struct snd_pcm **rpcm)
1484{ 1470{
1485 struct snd_pcm *pcm; 1471 struct snd_pcm *pcm;
1486 int err; 1472 int err;
1487 1473
1488 if (rpcm)
1489 *rpcm = NULL;
1490
1491 if ((err = snd_pcm_new(emu->card, "emu10k1 mic", device, 0, 1, &pcm)) < 0) 1474 if ((err = snd_pcm_new(emu->card, "emu10k1 mic", device, 0, 1, &pcm)) < 0)
1492 return err; 1475 return err;
1493 1476
@@ -1501,8 +1484,6 @@ int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device,
1501 1484
1502 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); 1485 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024);
1503 1486
1504 if (rpcm)
1505 *rpcm = pcm;
1506 return 0; 1487 return 0;
1507} 1488}
1508 1489
@@ -1822,16 +1803,12 @@ static struct snd_pcm_ops snd_emu10k1_fx8010_playback_ops = {
1822 .ack = snd_emu10k1_fx8010_playback_transfer, 1803 .ack = snd_emu10k1_fx8010_playback_transfer,
1823}; 1804};
1824 1805
1825int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device, 1806int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device)
1826 struct snd_pcm **rpcm)
1827{ 1807{
1828 struct snd_pcm *pcm; 1808 struct snd_pcm *pcm;
1829 struct snd_kcontrol *kctl; 1809 struct snd_kcontrol *kctl;
1830 int err; 1810 int err;
1831 1811
1832 if (rpcm)
1833 *rpcm = NULL;
1834
1835 if ((err = snd_pcm_new(emu->card, "emu10k1 efx", device, 8, 1, &pcm)) < 0) 1812 if ((err = snd_pcm_new(emu->card, "emu10k1 efx", device, 8, 1, &pcm)) < 0)
1836 return err; 1813 return err;
1837 1814
@@ -1843,8 +1820,6 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device,
1843 pcm->info_flags = 0; 1820 pcm->info_flags = 0;
1844 strcpy(pcm->name, "Multichannel Capture/PT Playback"); 1821 strcpy(pcm->name, "Multichannel Capture/PT Playback");
1845 emu->pcm_efx = pcm; 1822 emu->pcm_efx = pcm;
1846 if (rpcm)
1847 *rpcm = pcm;
1848 1823
1849 /* EFX capture - record the "FXBUS2" channels, by default we connect the EXTINs 1824 /* EFX capture - record the "FXBUS2" channels, by default we connect the EXTINs
1850 * to these 1825 * to these
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index 7ef3898a7806..b672755815e1 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -640,7 +640,7 @@ int snd_p16v_free(struct snd_emu10k1 *chip)
640 return 0; 640 return 0;
641} 641}
642 642
643int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm) 643int snd_p16v_pcm(struct snd_emu10k1 *emu, int device)
644{ 644{
645 struct snd_pcm *pcm; 645 struct snd_pcm *pcm;
646 struct snd_pcm_substream *substream; 646 struct snd_pcm_substream *substream;
@@ -649,8 +649,6 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
649 649
650 /* dev_dbg(emu->card->dev, "snd_p16v_pcm called. device=%d\n", device); */ 650 /* dev_dbg(emu->card->dev, "snd_p16v_pcm called. device=%d\n", device); */
651 emu->p16v_device_offset = device; 651 emu->p16v_device_offset = device;
652 if (rpcm)
653 *rpcm = NULL;
654 652
655 if ((err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm)) < 0) 653 if ((err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm)) < 0)
656 return err; 654 return err;
@@ -694,9 +692,6 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
694 */ 692 */
695 } 693 }
696 694
697 if (rpcm)
698 *rpcm = pcm;
699
700 return 0; 695 return 0;
701} 696}
702 697