]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ALSA: remove deprecated use of pci api
authorQuentin Lambert <lambert.quentin@gmail.com>
Wed, 15 Apr 2015 14:10:17 +0000 (16:10 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 16 Apr 2015 10:19:52 +0000 (12:19 +0200)
Replace occurences of the pci api by appropriate call to the dma api.

A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr)

@deprecated@
idexpression id;
position p;
@@

(
  pci_dma_supported@p ( id, ...)
|
  pci_alloc_consistent@p ( id, ...)
)

@bad1@
idexpression id;
position deprecated.p;
@@
...when != &id->dev
   when != pci_get_drvdata ( id )
   when != pci_enable_device ( id )
(
  pci_dma_supported@p ( id, ...)
|
  pci_alloc_consistent@p ( id, ...)
)

@depends on !bad1@
idexpression id;
expression direction;
position deprecated.p;
@@

(
- pci_dma_supported@p ( id,
+ dma_supported ( &id->dev,
...
+ , GFP_ATOMIC
  )
|
- pci_alloc_consistent@p ( id,
+ dma_alloc_coherent ( &id->dev,
...
+ , GFP_ATOMIC
  )
)

Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
23 files changed:
sound/pci/ad1889.c
sound/pci/ali5451/ali5451.c
sound/pci/als300.c
sound/pci/als4000.c
sound/pci/au88x0/au88x0.c
sound/pci/aw2/aw2-alsa.c
sound/pci/azt3328.c
sound/pci/ca0106/ca0106_main.c
sound/pci/cs5535audio/cs5535audio.c
sound/pci/ctxfi/cthw20k1.c
sound/pci/ctxfi/cthw20k2.c
sound/pci/emu10k1/emu10k1_main.c
sound/pci/es1938.c
sound/pci/es1968.c
sound/pci/hda/hda_intel.c
sound/pci/ice1712/ice1712.c
sound/pci/lx6464es/lx6464es.c
sound/pci/maestro3.c
sound/pci/mixart/mixart.c
sound/pci/pcxhr/pcxhr.c
sound/pci/sis7019.c
sound/pci/sonicvibes.c
sound/pci/trident/trident_main.c

index 66ddd981d1d5d48f419f8fb712a1c3bef913dd6d..1fc6d8bc09e54084a3cd38a4116342dd616f2698 100644 (file)
@@ -898,8 +898,8 @@ snd_ad1889_create(struct snd_card *card,
                return err;
 
        /* check PCI availability (32bit DMA) */
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) {
                dev_err(card->dev, "error setting 32-bit DMA mask.\n");
                pci_disable_device(pci);
                return -ENXIO;
index c8d499575c012f35e24d3c9472a7f8d196a84fde..36470af7eda70689619388f6b2e774cf850492cd 100644 (file)
@@ -2105,8 +2105,8 @@ static int snd_ali_create(struct snd_card *card,
        if (err < 0)
                return err;
        /* check, if we can restrict PCI DMA transfers to 31 bits */
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(31)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(31)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(31)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(31)) < 0) {
                dev_err(card->dev,
                        "architecture does not support 31bit PCI busmaster DMA\n");
                pci_disable_device(pci);
index 57e034f208dc164363323b833c926afe170b195b..add3176398d3269781172d9a600193554f851258 100644 (file)
@@ -658,8 +658,8 @@ static int snd_als300_create(struct snd_card *card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 ||
-               pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(28)) < 0 ||
+               dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(28)) < 0) {
                dev_err(card->dev, "error setting 28bit DMA mask\n");
                pci_disable_device(pci);
                return -ENXIO;
index a3dea464134d79524a59dbb000b16a73379b4562..ff39a0c7277b6d42f646ca0790fffa4ca8fd9c5c 100644 (file)
@@ -871,8 +871,8 @@ static int snd_card_als4000_probe(struct pci_dev *pci,
                return err;
        }
        /* check, if we can restrict PCI DMA transfers to 24 bits */
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(24)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(24)) < 0) {
                dev_err(&pci->dev, "architecture does not support 24bit PCI busmaster DMA\n");
                pci_disable_device(pci);
                return -ENXIO;
index 996369134ea8267616450ad66bb244244431d438..32092184bbf237b62847fa22fe8b8b86ade01081 100644 (file)
@@ -150,8 +150,8 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
        // check PCI availability (DMA).
        if ((err = pci_enable_device(pci)) < 0)
                return err;
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) {
                dev_err(card->dev, "error to set DMA mask\n");
                pci_disable_device(pci);
                return -ENXIO;
index 8d2fee7b33bd75edcb634602788ae70b6946418a..1677143030700380f661d8183a22c77f60ad0ce6 100644 (file)
@@ -258,8 +258,8 @@ static int snd_aw2_create(struct snd_card *card,
        pci_set_master(pci);
 
        /* check PCI availability (32bit DMA) */
-       if ((pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) ||
-           (pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0)) {
+       if ((dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) ||
+           (dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0)) {
                dev_err(card->dev, "Impossible to set 32bit mask DMA\n");
                pci_disable_device(pci);
                return -ENXIO;
index 33b2a0af1b594017959fada0b8d26ec61e43689e..07a4acc99541da6a4279efdb2a393d91226b028d 100644 (file)
@@ -2420,8 +2420,8 @@ snd_azf3328_create(struct snd_card *card,
        chip->irq = -1;
 
        /* check if we can restrict PCI DMA transfers to 24 bits */
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(24)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(24)) < 0) {
                dev_err(card->dev,
                        "architecture does not support 24bit PCI busmaster DMA\n"
                );
index dd75b7536fa2ccc457c09e89fe8bcff88e1e47e3..0b31732eb4dc8eba20b0303d518d85f5f01a0bc4 100644 (file)
@@ -1676,8 +1676,8 @@ static int snd_ca0106_create(int dev, struct snd_card *card,
        err = pci_enable_device(pci);
        if (err < 0)
                return err;
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) {
                dev_err(card->dev, "error to set 32bit mask DMA\n");
                pci_disable_device(pci);
                return -ENXIO;
index 963b912550d477fe946d74095791159d4b15caae..de409cda50aa0c0cd2405b2cab4263c1738e83f3 100644 (file)
@@ -289,8 +289,8 @@ static int snd_cs5535audio_create(struct snd_card *card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) {
                dev_warn(card->dev, "unable to get 32bit dma\n");
                err = -ENXIO;
                goto pcifail;
index 1cac55fd113992020585ceba4b61a3478a6557f1..9667cbfb0ca2b38eae7e76f45f742195631b271e 100644 (file)
@@ -1910,8 +1910,8 @@ static int hw_card_start(struct hw *hw)
                return err;
 
        /* Set DMA transfer mask */
-       if (pci_set_dma_mask(pci, CT_XFI_DMA_MASK) < 0 ||
-           pci_set_consistent_dma_mask(pci, CT_XFI_DMA_MASK) < 0) {
+       if (dma_set_mask(&pci->dev, CT_XFI_DMA_MASK) < 0 ||
+           dma_set_coherent_mask(&pci->dev, CT_XFI_DMA_MASK) < 0) {
                dev_err(hw->card->dev,
                        "architecture does not support PCI busmaster DMA with mask 0x%llx\n",
                        CT_XFI_DMA_MASK);
index 955ad871e9a861dfd444e5ec85f4b9736548778e..9dc2950e1ab7466974be04588a1c5bbe7c7175c5 100644 (file)
@@ -2035,8 +2035,8 @@ static int hw_card_start(struct hw *hw)
                return err;
 
        /* Set DMA transfer mask */
-       if (pci_set_dma_mask(pci, CT_XFI_DMA_MASK) < 0 ||
-           pci_set_consistent_dma_mask(pci, CT_XFI_DMA_MASK) < 0) {
+       if (dma_set_mask(&pci->dev, CT_XFI_DMA_MASK) < 0 ||
+           dma_set_coherent_mask(&pci->dev, CT_XFI_DMA_MASK) < 0) {
                dev_err(hw->card->dev,
                        "architecture does not support PCI busmaster DMA with mask 0x%llx\n",
                        CT_XFI_DMA_MASK);
index 54079f5d5673951ad739c81e2e679d3864f0ea79..e66103ad9a213160f73e83a39e5ce1562771039f 100644 (file)
@@ -1904,8 +1904,8 @@ int snd_emu10k1_create(struct snd_card *card,
 
        /* set the DMA transfer mask */
        emu->dma_mask = is_audigy ? AUDIGY_DMA_MASK : EMU10K1_DMA_MASK;
-       if (pci_set_dma_mask(pci, emu->dma_mask) < 0 ||
-           pci_set_consistent_dma_mask(pci, emu->dma_mask) < 0) {
+       if (dma_set_mask(&pci->dev, emu->dma_mask) < 0 ||
+           dma_set_coherent_mask(&pci->dev, emu->dma_mask) < 0) {
                dev_err(card->dev,
                        "architecture does not support PCI busmaster DMA with mask 0x%lx\n",
                        emu->dma_mask);
index e1858d9d23d8711d29ee131363c7997a090db847..8963d7688fb039db81abed97db9a5898e40401f2 100644 (file)
@@ -1580,8 +1580,8 @@ static int snd_es1938_create(struct snd_card *card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
         /* check, if we can restrict PCI DMA transfers to 24 bits */
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(24)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(24)) < 0) {
                dev_err(card->dev,
                        "architecture does not support 24bit PCI busmaster DMA\n");
                pci_disable_device(pci);
index 059f3846d7b814af26f15e624e4c861b81d9cc9c..e0d9363dc7fd2435ef894a6a6060d53c48e68334 100644 (file)
@@ -2689,8 +2689,8 @@ static int snd_es1968_create(struct snd_card *card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
        /* check, if we can restrict PCI DMA transfers to 28 bits */
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(28)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(28)) < 0) {
                dev_err(card->dev,
                        "architecture does not support 28bit PCI busmaster DMA\n");
                pci_disable_device(pci);
index e1c2105155815ebc16c2fdc8e18e0ac8fe5c75d8..626b5b20d2aeeac3cc4d4f45e1131cd43fd27e3c 100644 (file)
@@ -1528,11 +1528,11 @@ static int azx_first_init(struct azx *chip)
        /* allow 64bit DMA address if supported by H/W */
        if (!(gcap & AZX_GCAP_64OK))
                dma_bits = 32;
-       if (!pci_set_dma_mask(pci, DMA_BIT_MASK(dma_bits))) {
-               pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(dma_bits));
+       if (!dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) {
+               dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(dma_bits));
        } else {
-               pci_set_dma_mask(pci, DMA_BIT_MASK(32));
-               pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32));
+               dma_set_mask(&pci->dev, DMA_BIT_MASK(32));
+               dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32));
        }
 
        /* read number of streams from GCAP register instead of using
index f7b1523e8a82a071f64960634204313a1fb3b529..8ae3bb7975d1a1a1807dce63e681f96e2fcac50e 100644 (file)
@@ -2530,8 +2530,8 @@ static int snd_ice1712_create(struct snd_card *card,
        if (err < 0)
                return err;
        /* check, if we can restrict PCI DMA transfers to 28 bits */
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(28)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(28)) < 0) {
                dev_err(card->dev,
                        "architecture does not support 28bit PCI busmaster DMA\n");
                pci_disable_device(pci);
index 601315a1f58fbef5b50c757844dd376bc22c74c8..32c6f6ba1442f0f0e52e05cffb2242fe65eb867c 100644 (file)
@@ -981,7 +981,7 @@ static int snd_lx6464es_create(struct snd_card *card,
        pci_set_master(pci);
 
        /* check if we can restrict PCI DMA transfers to 32 bits */
-       err = pci_set_dma_mask(pci, DMA_BIT_MASK(32));
+       err = dma_set_mask(&pci->dev, DMA_BIT_MASK(32));
        if (err < 0) {
                dev_err(card->dev,
                        "architecture does not support 32bit PCI busmaster DMA\n");
index 9be660993bd022bb7f662a213f6662dce1a7de98..72e89cedc52de3c1f115454e827e9d4e2c88895c 100644 (file)
@@ -2537,8 +2537,8 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
                return -EIO;
 
        /* check, if we can restrict PCI DMA transfers to 28 bits */
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(28)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(28)) < 0) {
                dev_err(card->dev,
                        "architecture does not support 28bit PCI busmaster DMA\n");
                pci_disable_device(pci);
index c3a9f39f8d61a822921e647b2bea5e147c10c7ae..bc81b9f75ed0dd904f8f1eeed2e78a97dbb70a50 100644 (file)
@@ -1269,7 +1269,7 @@ static int snd_mixart_probe(struct pci_dev *pci,
        pci_set_master(pci);
 
        /* check if we can restrict PCI DMA transfers to 32 bits */
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) {
                dev_err(&pci->dev,
                        "architecture does not support 32bit PCI busmaster DMA\n");
                pci_disable_device(pci);
index c6092e48ceb6a4bc9aafe769cb07f637751adc6d..9293235281dc41a104f3f9748cea1cfd337f8528 100644 (file)
@@ -1537,7 +1537,7 @@ static int pcxhr_probe(struct pci_dev *pci,
        pci_set_master(pci);
 
        /* check if we can restrict PCI DMA transfers to 32 bits */
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) {
                dev_err(&pci->dev,
                        "architecture does not support 32bit PCI busmaster DMA\n");
                pci_disable_device(pci);
index efe669b802569904a211f7cef8235d95b505cf71..f3860b850210152f2333be252a887d9ac6c15319 100644 (file)
@@ -383,9 +383,9 @@ static void __sis_map_silence(struct sis7019 *sis)
 {
        /* Helper function: must hold sis->voice_lock on entry */
        if (!sis->silence_users)
-               sis->silence_dma_addr = pci_map_single(sis->pci,
+               sis->silence_dma_addr = dma_map_single(&sis->pci->dev,
                                                sis->suspend_state[0],
-                                               4096, PCI_DMA_TODEVICE);
+                                               4096, DMA_TO_DEVICE);
        sis->silence_users++;
 }
 
@@ -394,8 +394,8 @@ static void __sis_unmap_silence(struct sis7019 *sis)
        /* Helper function: must hold sis->voice_lock on entry */
        sis->silence_users--;
        if (!sis->silence_users)
-               pci_unmap_single(sis->pci, sis->silence_dma_addr, 4096,
-                                       PCI_DMA_TODEVICE);
+               dma_unmap_single(&sis->pci->dev, sis->silence_dma_addr, 4096,
+                                       DMA_TO_DEVICE);
 }
 
 static void sis_free_voice(struct sis7019 *sis, struct voice *voice)
@@ -1325,7 +1325,7 @@ static int sis_chip_create(struct snd_card *card,
        if (rc)
                goto error_out;
 
-       rc = pci_set_dma_mask(pci, DMA_BIT_MASK(30));
+       rc = dma_set_mask(&pci->dev, DMA_BIT_MASK(30));
        if (rc < 0) {
                dev_err(&pci->dev, "architecture does not support 30-bit PCI busmaster DMA");
                goto error_out_enabled;
index 0f40624a427577caa5feab5aeda799be19bc4955..1b6fad7d4d562e86c54836aa352fead389209798 100644 (file)
@@ -1259,8 +1259,8 @@ static int snd_sonicvibes_create(struct snd_card *card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
        /* check, if we can restrict PCI DMA transfers to 24 bits */
-        if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(24)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(24)) < 0) {
                dev_err(card->dev,
                        "architecture does not support 24bit PCI busmaster DMA\n");
                pci_disable_device(pci);
index b72be035f785b632a415dfcaa9772e0f602eb320..599d2b7eb5b8022b4a8ea0f6f6b9eef72656f470 100644 (file)
@@ -3551,8 +3551,8 @@ int snd_trident_create(struct snd_card *card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
        /* check, if we can restrict PCI DMA transfers to 30 bits */
-       if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0 ||
-           pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(30)) < 0) {
+       if (dma_set_mask(&pci->dev, DMA_BIT_MASK(30)) < 0 ||
+           dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(30)) < 0) {
                dev_err(card->dev,
                        "architecture does not support 30bit PCI busmaster DMA\n");
                pci_disable_device(pci);