char: xillybus: Remove usage of remaining deprecated pci_ API
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 27 Aug 2021 17:17:47 +0000 (19:17 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Sep 2021 09:12:56 +0000 (11:12 +0200)
'struct xilly_endpoint' has a 'dev' field which is a 'struct device *' and
a 'pdev' field which is 'struct pci_dev *'.

Both fields are initialized by 'xillybus_init_endpoint()' and in
'xillybus_pcie.c', we have:
xillybus_init_endpoint(pdev, &pdev->dev, &pci_hw);
                                 ^       ^
        xilly_endpoint.pdev = ___|       |___ = xilly_endpoint.dev
So the modification from pci_ to dma_ function is straightforward.

Update all remaining deprecated pci_ function calls to equivalent
dma_ API function.
Switching from 'ep->pdev' to 'ep->dev' makes the transformation
straightforward.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/19d67ac0208a609aef1e28278b3f2477aa714029.1630083668.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/xillybus/xillybus.h
drivers/char/xillybus/xillybus_core.c
drivers/char/xillybus/xillybus_pcie.c

index 7c71bdef7ccbed530edd67f7c51ea9c8e25eaf29..55d47cb13a7bc7ed8ba25d6eff00d99d0afd4b30 100644 (file)
@@ -87,7 +87,6 @@ struct xilly_channel {
 };
 
 struct xilly_endpoint {
-       struct pci_dev *pdev;
        struct device *dev;
        struct xilly_endpoint_hardware *ephw;
 
index 931d0bf4cec608c529815302ed1d85ef3222efc2..0ced9ec6977f8880e3af726ac597fa3c884e6945 100644 (file)
@@ -1783,7 +1783,7 @@ struct xilly_endpoint *xillybus_init_endpoint(struct pci_dev *pdev,
        if (!endpoint)
                return NULL;
 
-       endpoint->pdev = pdev;
+       (void)pdev;     // silence a compiler warning, will be removed
        endpoint->dev = dev;
        endpoint->ephw = ephw;
        endpoint->msg_counter = 0x0b;
index 8360427e42263f868ca68da9be0955672d149c8e..f4be61349ca6e5f0f966e044ece8b369c0af482c 100644 (file)
@@ -48,10 +48,8 @@ static void xilly_dma_sync_single_for_cpu_pci(struct xilly_endpoint *ep,
                                              size_t size,
                                              int direction)
 {
-       pci_dma_sync_single_for_cpu(ep->pdev,
-                                   dma_handle,
-                                   size,
-                                   xilly_pci_direction(direction));
+       dma_sync_single_for_cpu(ep->dev, dma_handle, size,
+                               xilly_pci_direction(direction));
 }
 
 static void xilly_dma_sync_single_for_device_pci(struct xilly_endpoint *ep,
@@ -59,10 +57,8 @@ static void xilly_dma_sync_single_for_device_pci(struct xilly_endpoint *ep,
                                                 size_t size,
                                                 int direction)
 {
-       pci_dma_sync_single_for_device(ep->pdev,
-                                      dma_handle,
-                                      size,
-                                      xilly_pci_direction(direction));
+       dma_sync_single_for_device(ep->dev, dma_handle, size,
+                                  xilly_pci_direction(direction));
 }
 
 static void xilly_pci_unmap(void *ptr)
@@ -98,9 +94,9 @@ static int xilly_map_single_pci(struct xilly_endpoint *ep,
 
        pci_direction = xilly_pci_direction(direction);
 
-       addr = pci_map_single(ep->pdev, ptr, size, pci_direction);
+       addr = dma_map_single(ep->dev, ptr, size, pci_direction);
 
-       if (pci_dma_mapping_error(ep->pdev, addr)) {
+       if (dma_mapping_error(ep->dev, addr)) {
                kfree(this);
                return -ENODEV;
        }