staging: comedi: drivers: Remove use of deprecated pci API
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Wed, 24 Feb 2016 11:15:34 +0000 (16:45 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Mar 2016 22:56:55 +0000 (14:56 -0800)
commitd2b0fc6e29bb6015f811b7574dde64026179e57a
tree55635830594785c79b10c1e9d7a438b0dd431315
parent3545bee9b8ec00ba733e17363f494c8761fb5e49
staging: comedi: drivers: Remove use of deprecated pci API

Replace pci_[alloc|free]_consistent occurences with
dma_[alloc|free]_coherent.

The Coccinelle semantic patch that was used to make some of these
changes is as follows:
@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_KERNEL
  )
|
- pci_alloc_consistent@p ( id,
+ dma_alloc_coherent ( &id->dev,
...
+ , GFP_KERNEL
  )
)

alloc_and_init_dma_members does not affect the interrupt status and is
only called by auto_attach, which also does not affect the interrupt
status. auto_attach() also contains a call to comedi_alloc_devpriv()
which calls kzalloc with GFP_KERNEL flag.  Thus, there seems to be no
danger that dma_alloc_coherent can be called with interrupts turned
off, and GFP_KERNEL can be used.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/cb_pcidas64.c