Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: remove deprecated use of pci api

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>

authored by

Quentin Lambert and committed by
Takashi Iwai
412b979c 30477555

+48 -48
+2 -2
sound/pci/ad1889.c
··· 898 898 return err; 899 899 900 900 /* check PCI availability (32bit DMA) */ 901 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || 902 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 901 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 || 902 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) { 903 903 dev_err(card->dev, "error setting 32-bit DMA mask.\n"); 904 904 pci_disable_device(pci); 905 905 return -ENXIO;
+2 -2
sound/pci/ali5451/ali5451.c
··· 2105 2105 if (err < 0) 2106 2106 return err; 2107 2107 /* check, if we can restrict PCI DMA transfers to 31 bits */ 2108 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(31)) < 0 || 2109 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(31)) < 0) { 2108 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(31)) < 0 || 2109 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(31)) < 0) { 2110 2110 dev_err(card->dev, 2111 2111 "architecture does not support 31bit PCI busmaster DMA\n"); 2112 2112 pci_disable_device(pci);
+2 -2
sound/pci/als300.c
··· 658 658 if ((err = pci_enable_device(pci)) < 0) 659 659 return err; 660 660 661 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 662 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 661 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(28)) < 0 || 662 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(28)) < 0) { 663 663 dev_err(card->dev, "error setting 28bit DMA mask\n"); 664 664 pci_disable_device(pci); 665 665 return -ENXIO;
+2 -2
sound/pci/als4000.c
··· 871 871 return err; 872 872 } 873 873 /* check, if we can restrict PCI DMA transfers to 24 bits */ 874 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 875 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 874 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(24)) < 0 || 875 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(24)) < 0) { 876 876 dev_err(&pci->dev, "architecture does not support 24bit PCI busmaster DMA\n"); 877 877 pci_disable_device(pci); 878 878 return -ENXIO;
+2 -2
sound/pci/au88x0/au88x0.c
··· 150 150 // check PCI availability (DMA). 151 151 if ((err = pci_enable_device(pci)) < 0) 152 152 return err; 153 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || 154 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 153 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 || 154 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) { 155 155 dev_err(card->dev, "error to set DMA mask\n"); 156 156 pci_disable_device(pci); 157 157 return -ENXIO;
+2 -2
sound/pci/aw2/aw2-alsa.c
··· 258 258 pci_set_master(pci); 259 259 260 260 /* check PCI availability (32bit DMA) */ 261 - if ((pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) || 262 - (pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0)) { 261 + if ((dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) || 262 + (dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0)) { 263 263 dev_err(card->dev, "Impossible to set 32bit mask DMA\n"); 264 264 pci_disable_device(pci); 265 265 return -ENXIO;
+2 -2
sound/pci/azt3328.c
··· 2420 2420 chip->irq = -1; 2421 2421 2422 2422 /* check if we can restrict PCI DMA transfers to 24 bits */ 2423 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 2424 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 2423 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(24)) < 0 || 2424 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(24)) < 0) { 2425 2425 dev_err(card->dev, 2426 2426 "architecture does not support 24bit PCI busmaster DMA\n" 2427 2427 );
+2 -2
sound/pci/ca0106/ca0106_main.c
··· 1676 1676 err = pci_enable_device(pci); 1677 1677 if (err < 0) 1678 1678 return err; 1679 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || 1680 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 1679 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 || 1680 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) { 1681 1681 dev_err(card->dev, "error to set 32bit mask DMA\n"); 1682 1682 pci_disable_device(pci); 1683 1683 return -ENXIO;
+2 -2
sound/pci/cs5535audio/cs5535audio.c
··· 289 289 if ((err = pci_enable_device(pci)) < 0) 290 290 return err; 291 291 292 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || 293 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 292 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0 || 293 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) { 294 294 dev_warn(card->dev, "unable to get 32bit dma\n"); 295 295 err = -ENXIO; 296 296 goto pcifail;
+2 -2
sound/pci/ctxfi/cthw20k1.c
··· 1910 1910 return err; 1911 1911 1912 1912 /* Set DMA transfer mask */ 1913 - if (pci_set_dma_mask(pci, CT_XFI_DMA_MASK) < 0 || 1914 - pci_set_consistent_dma_mask(pci, CT_XFI_DMA_MASK) < 0) { 1913 + if (dma_set_mask(&pci->dev, CT_XFI_DMA_MASK) < 0 || 1914 + dma_set_coherent_mask(&pci->dev, CT_XFI_DMA_MASK) < 0) { 1915 1915 dev_err(hw->card->dev, 1916 1916 "architecture does not support PCI busmaster DMA with mask 0x%llx\n", 1917 1917 CT_XFI_DMA_MASK);
+2 -2
sound/pci/ctxfi/cthw20k2.c
··· 2035 2035 return err; 2036 2036 2037 2037 /* Set DMA transfer mask */ 2038 - if (pci_set_dma_mask(pci, CT_XFI_DMA_MASK) < 0 || 2039 - pci_set_consistent_dma_mask(pci, CT_XFI_DMA_MASK) < 0) { 2038 + if (dma_set_mask(&pci->dev, CT_XFI_DMA_MASK) < 0 || 2039 + dma_set_coherent_mask(&pci->dev, CT_XFI_DMA_MASK) < 0) { 2040 2040 dev_err(hw->card->dev, 2041 2041 "architecture does not support PCI busmaster DMA with mask 0x%llx\n", 2042 2042 CT_XFI_DMA_MASK);
+2 -2
sound/pci/emu10k1/emu10k1_main.c
··· 1904 1904 1905 1905 /* set the DMA transfer mask */ 1906 1906 emu->dma_mask = is_audigy ? AUDIGY_DMA_MASK : EMU10K1_DMA_MASK; 1907 - if (pci_set_dma_mask(pci, emu->dma_mask) < 0 || 1908 - pci_set_consistent_dma_mask(pci, emu->dma_mask) < 0) { 1907 + if (dma_set_mask(&pci->dev, emu->dma_mask) < 0 || 1908 + dma_set_coherent_mask(&pci->dev, emu->dma_mask) < 0) { 1909 1909 dev_err(card->dev, 1910 1910 "architecture does not support PCI busmaster DMA with mask 0x%lx\n", 1911 1911 emu->dma_mask);
+2 -2
sound/pci/es1938.c
··· 1580 1580 if ((err = pci_enable_device(pci)) < 0) 1581 1581 return err; 1582 1582 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1583 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 1584 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 1583 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(24)) < 0 || 1584 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(24)) < 0) { 1585 1585 dev_err(card->dev, 1586 1586 "architecture does not support 24bit PCI busmaster DMA\n"); 1587 1587 pci_disable_device(pci);
+2 -2
sound/pci/es1968.c
··· 2689 2689 if ((err = pci_enable_device(pci)) < 0) 2690 2690 return err; 2691 2691 /* check, if we can restrict PCI DMA transfers to 28 bits */ 2692 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 2693 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 2692 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(28)) < 0 || 2693 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(28)) < 0) { 2694 2694 dev_err(card->dev, 2695 2695 "architecture does not support 28bit PCI busmaster DMA\n"); 2696 2696 pci_disable_device(pci);
+4 -4
sound/pci/hda/hda_intel.c
··· 1528 1528 /* allow 64bit DMA address if supported by H/W */ 1529 1529 if (!(gcap & AZX_GCAP_64OK)) 1530 1530 dma_bits = 32; 1531 - if (!pci_set_dma_mask(pci, DMA_BIT_MASK(dma_bits))) { 1532 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(dma_bits)); 1531 + if (!dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) { 1532 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(dma_bits)); 1533 1533 } else { 1534 - pci_set_dma_mask(pci, DMA_BIT_MASK(32)); 1535 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)); 1534 + dma_set_mask(&pci->dev, DMA_BIT_MASK(32)); 1535 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(32)); 1536 1536 } 1537 1537 1538 1538 /* read number of streams from GCAP register instead of using
+2 -2
sound/pci/ice1712/ice1712.c
··· 2530 2530 if (err < 0) 2531 2531 return err; 2532 2532 /* check, if we can restrict PCI DMA transfers to 28 bits */ 2533 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 2534 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 2533 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(28)) < 0 || 2534 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(28)) < 0) { 2535 2535 dev_err(card->dev, 2536 2536 "architecture does not support 28bit PCI busmaster DMA\n"); 2537 2537 pci_disable_device(pci);
+1 -1
sound/pci/lx6464es/lx6464es.c
··· 981 981 pci_set_master(pci); 982 982 983 983 /* check if we can restrict PCI DMA transfers to 32 bits */ 984 - err = pci_set_dma_mask(pci, DMA_BIT_MASK(32)); 984 + err = dma_set_mask(&pci->dev, DMA_BIT_MASK(32)); 985 985 if (err < 0) { 986 986 dev_err(card->dev, 987 987 "architecture does not support 32bit PCI busmaster DMA\n");
+2 -2
sound/pci/maestro3.c
··· 2537 2537 return -EIO; 2538 2538 2539 2539 /* check, if we can restrict PCI DMA transfers to 28 bits */ 2540 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 2541 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 2540 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(28)) < 0 || 2541 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(28)) < 0) { 2542 2542 dev_err(card->dev, 2543 2543 "architecture does not support 28bit PCI busmaster DMA\n"); 2544 2544 pci_disable_device(pci);
+1 -1
sound/pci/mixart/mixart.c
··· 1269 1269 pci_set_master(pci); 1270 1270 1271 1271 /* check if we can restrict PCI DMA transfers to 32 bits */ 1272 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 1272 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) { 1273 1273 dev_err(&pci->dev, 1274 1274 "architecture does not support 32bit PCI busmaster DMA\n"); 1275 1275 pci_disable_device(pci);
+1 -1
sound/pci/pcxhr/pcxhr.c
··· 1537 1537 pci_set_master(pci); 1538 1538 1539 1539 /* check if we can restrict PCI DMA transfers to 32 bits */ 1540 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 1540 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(32)) < 0) { 1541 1541 dev_err(&pci->dev, 1542 1542 "architecture does not support 32bit PCI busmaster DMA\n"); 1543 1543 pci_disable_device(pci);
+5 -5
sound/pci/sis7019.c
··· 383 383 { 384 384 /* Helper function: must hold sis->voice_lock on entry */ 385 385 if (!sis->silence_users) 386 - sis->silence_dma_addr = pci_map_single(sis->pci, 386 + sis->silence_dma_addr = dma_map_single(&sis->pci->dev, 387 387 sis->suspend_state[0], 388 - 4096, PCI_DMA_TODEVICE); 388 + 4096, DMA_TO_DEVICE); 389 389 sis->silence_users++; 390 390 } 391 391 ··· 394 394 /* Helper function: must hold sis->voice_lock on entry */ 395 395 sis->silence_users--; 396 396 if (!sis->silence_users) 397 - pci_unmap_single(sis->pci, sis->silence_dma_addr, 4096, 398 - PCI_DMA_TODEVICE); 397 + dma_unmap_single(&sis->pci->dev, sis->silence_dma_addr, 4096, 398 + DMA_TO_DEVICE); 399 399 } 400 400 401 401 static void sis_free_voice(struct sis7019 *sis, struct voice *voice) ··· 1325 1325 if (rc) 1326 1326 goto error_out; 1327 1327 1328 - rc = pci_set_dma_mask(pci, DMA_BIT_MASK(30)); 1328 + rc = dma_set_mask(&pci->dev, DMA_BIT_MASK(30)); 1329 1329 if (rc < 0) { 1330 1330 dev_err(&pci->dev, "architecture does not support 30-bit PCI busmaster DMA"); 1331 1331 goto error_out_enabled;
+2 -2
sound/pci/sonicvibes.c
··· 1259 1259 if ((err = pci_enable_device(pci)) < 0) 1260 1260 return err; 1261 1261 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1262 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 1263 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 1262 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(24)) < 0 || 1263 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(24)) < 0) { 1264 1264 dev_err(card->dev, 1265 1265 "architecture does not support 24bit PCI busmaster DMA\n"); 1266 1266 pci_disable_device(pci);
+2 -2
sound/pci/trident/trident_main.c
··· 3551 3551 if ((err = pci_enable_device(pci)) < 0) 3552 3552 return err; 3553 3553 /* check, if we can restrict PCI DMA transfers to 30 bits */ 3554 - if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0 || 3555 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(30)) < 0) { 3554 + if (dma_set_mask(&pci->dev, DMA_BIT_MASK(30)) < 0 || 3555 + dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(30)) < 0) { 3556 3556 dev_err(card->dev, 3557 3557 "architecture does not support 30bit PCI busmaster DMA\n"); 3558 3558 pci_disable_device(pci);