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

ide: 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: David S. Miller <davem@davemloft.net>

authored by

Quentin Lambert and committed by
David S. Miller
d681f116 54e514b9

+6 -7
+1 -1
drivers/ide/cs5520.c
··· 123 123 return -ENODEV; 124 124 } 125 125 pci_set_master(dev); 126 - if (pci_set_dma_mask(dev, DMA_BIT_MASK(32))) { 126 + if (dma_set_mask(&dev->dev, DMA_BIT_MASK(32))) { 127 127 printk(KERN_WARNING "%s: No suitable DMA available.\n", 128 128 d->name); 129 129 return -ENODEV;
+2 -3
drivers/ide/pmac.c
··· 1689 1689 * The +2 is +1 for the stop command and +1 to allow for 1690 1690 * aligning the start address to a multiple of 16 bytes. 1691 1691 */ 1692 - pmif->dma_table_cpu = pci_alloc_consistent( 1693 - dev, 1692 + pmif->dma_table_cpu = dma_alloc_coherent(&dev->dev, 1694 1693 (MAX_DCMDS + 2) * sizeof(struct dbdma_cmd), 1695 - &hwif->dmatable_dma); 1694 + &hwif->dmatable_dma, GFP_KERNEL); 1696 1695 if (pmif->dma_table_cpu == NULL) { 1697 1696 printk(KERN_ERR "%s: unable to allocate DMA command list\n", 1698 1697 hwif->name);
+1 -1
drivers/ide/setup-pci.c
··· 209 209 * a DMA mask field to the struct ide_port_info if we need it 210 210 * (or let lower level driver set the DMA mask) 211 211 */ 212 - ret = pci_set_dma_mask(dev, DMA_BIT_MASK(32)); 212 + ret = dma_set_mask(&dev->dev, DMA_BIT_MASK(32)); 213 213 if (ret < 0) { 214 214 printk(KERN_ERR "%s %s: can't set DMA mask\n", 215 215 d->name, pci_name(dev));
+2 -2
drivers/ide/sgiioc4.c
··· 334 334 if (ide_allocate_dma_engine(hwif)) 335 335 goto dma_pci_alloc_failure; 336 336 337 - pad = pci_alloc_consistent(dev, IOC4_IDE_CACHELINE_SIZE, 338 - (dma_addr_t *)&hwif->extra_base); 337 + pad = dma_alloc_coherent(&dev->dev, IOC4_IDE_CACHELINE_SIZE, 338 + (dma_addr_t *)&hwif->extra_base, GFP_KERNEL); 339 339 if (pad) { 340 340 ide_set_hwifdata(hwif, pad); 341 341 return 0;