ide: remove deprecated use of pci api
authorQuentin Lambert <lambert.quentin@gmail.com>
Mon, 13 Apr 2015 08:26:53 +0000 (10:26 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Apr 2015 19:32:07 +0000 (15:32 -0400)
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>
drivers/ide/cs5520.c
drivers/ide/pmac.c
drivers/ide/setup-pci.c
drivers/ide/sgiioc4.c

index 6250aee30503d0b48043a2471a33206d6e04f654..89a4ff100b7a5fbd311fbb149edf28bc0115c438 100644 (file)
@@ -123,7 +123,7 @@ static int cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id)
                return -ENODEV;
        }
        pci_set_master(dev);
-       if (pci_set_dma_mask(dev, DMA_BIT_MASK(32))) {
+       if (dma_set_mask(&dev->dev, DMA_BIT_MASK(32))) {
                printk(KERN_WARNING "%s: No suitable DMA available.\n",
                        d->name);
                return -ENODEV;
index d24a3f8b49bc5fe9569482510ce39f9ae74d33ef..96a345248224b16fe78a2e71fed1920c8088edaa 100644 (file)
@@ -1689,10 +1689,9 @@ static int pmac_ide_init_dma(ide_hwif_t *hwif, const struct ide_port_info *d)
         * The +2 is +1 for the stop command and +1 to allow for
         * aligning the start address to a multiple of 16 bytes.
         */
-       pmif->dma_table_cpu = pci_alloc_consistent(
-               dev,
+       pmif->dma_table_cpu = dma_alloc_coherent(&dev->dev,
                (MAX_DCMDS + 2) * sizeof(struct dbdma_cmd),
-               &hwif->dmatable_dma);
+               &hwif->dmatable_dma, GFP_KERNEL);
        if (pmif->dma_table_cpu == NULL) {
                printk(KERN_ERR "%s: unable to allocate DMA command list\n",
                       hwif->name);
index 34a5e5223d5004010a03ae4e468e1a2a05e871ba..112d2fe1bcdbc8b3acb45d613901afa06798d556 100644 (file)
@@ -209,7 +209,7 @@ static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d)
         * a DMA mask field to the struct ide_port_info if we need it
         * (or let lower level driver set the DMA mask)
         */
-       ret = pci_set_dma_mask(dev, DMA_BIT_MASK(32));
+       ret = dma_set_mask(&dev->dev, DMA_BIT_MASK(32));
        if (ret < 0) {
                printk(KERN_ERR "%s %s: can't set DMA mask\n",
                        d->name, pci_name(dev));
index 63761db61384ec5d681f7629ba36c61b4e2805c8..2d35e9f7516fb7037c597be81602ac73610c2867 100644 (file)
@@ -334,8 +334,8 @@ static int ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d)
        if (ide_allocate_dma_engine(hwif))
                goto dma_pci_alloc_failure;
 
-       pad = pci_alloc_consistent(dev, IOC4_IDE_CACHELINE_SIZE,
-                                  (dma_addr_t *)&hwif->extra_base);
+       pad = dma_alloc_coherent(&dev->dev, IOC4_IDE_CACHELINE_SIZE,
+                                  (dma_addr_t *)&hwif->extra_base, GFP_KERNEL);
        if (pad) {
                ide_set_hwifdata(hwif, pad);
                return 0;