]> git.karo-electronics.de Git - linux-beck.git/commit
staging: comedi: drivers: gsc_hpdi: Remove use of deprecated pci API
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>
Sun, 6 Mar 2016 00:21:52 +0000 (05:51 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Mar 2016 03:34:22 +0000 (19:34 -0800)
commitf3b1e4db825aeef5337501c88c15894ac33f732e
tree9e76c2e65e1db25622e579594efafbe118d81994
parent6e1edc0f8bd9c447b152c29252a9915225d7b8cc
staging: comedi: drivers: gsc_hpdi: 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
  )
)

gsc_hpdi_auto_attach does not affect interrupt status but 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/gsc_hpdi.c